Skip to content

Linux program to turn on serial number enumeration on MCP2221A

License

Notifications You must be signed in to change notification settings

drboone/ninotnc_setserialno

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# README, Boone, 12/04/22
# Brief explanation of ninotnc_setserialno

Linux programs to configure USB enumeration fields on MCP2221A
==============================================================

To build (x86 Debian):
----------------------

	Clone the git repository https://github.com/ZakKemble/libmcp2221

	cd libmcp2221/libmcp2221

	Copy libmcp2221.h to /usr/local/include/

	Copy ./lib/unix/libmcp2221.so and ./lib/unix/libmcp2221.a to /usr/local/lib/

	Clone the git repository https://github.com/drboone/ninotnc_setserialno

	cd into the resulting directory

	Install the following packages:

		libhidapi-dev
		libhidapi-hidraw0

	Run make

	You should now have ninotnc_setserialno

ninotnc_setserialno
-------------------

This crude tool turns on the "serial number enumeration" configuration
bit in a Microchip MCP2221A chip.  This chip is used in the USB
interface for the "ninotnc" N9600A TNC board.  If the board reports
a serial number during USB enumeration, then you can use udev rules
to make the device have a consistent device name each time it is
connected.

This tool is likely Linux-only.  For Windows, you can use the
Microchip-supplied utility to change this configuration on the
MCP2221A.  (It can change other settings too, including customizing
the actual serial number.)  As of December, 2022, the Microchip
utility can be found at:

	https://ww1.microchip.com/downloads/en/DeviceDoc/MCP2221Utility.zip

To run:

	THERE MUST BE ONLY _ONE_ USB DEVICE connected with an MCP2221
	chip.  If there's more than one, the program aborts.  If there's
	only one connected, it will reconfigure it without further ado.

	To see what's connected, run lsusb.  An MCP2221A looks like this:

		Bus 001 Device 041: ID 04d8:00dd Microchip Technology, Inc. 

	The bus and device numbers will vary, but the ID won't.

nino_setlabel
-------------

	This tool sets two of the strings associated with USB enumeration.
	Specifically, it sets the Manufacturer label to 'TARPN', and the
	Product label to 'N9600A NinoTNC'.  These strings show up in the
	Linux kernel messages when the device connects.  Again, probably
	Linux-only.

	[3548077.334201] hid-generic 0003:04D8:00DD.002C: hiddev0,hidraw3:
	USB HID v1.11 Device [TARPN            N9600A NinoTNC  ]
	on usb-0000:00:1a.0-1.3/input2


udev rules:
-----------

	Create a file named something like 99-n9600a.rules in
	/etc/udev/rules.d/ containing lines like this for each TNC you
	want to manage.  Change the number in quotes after ATTRS{serial}=
	to match your device, and the value in quotes after SYMLINK+=
	to be whatever name you want to have end up in /dev/:

		SUBSYSTEM=="tty", \
		ATTRS{idVendor}=="04d8", \
		ATTRS{idProduct}=="00dd", \
		ATTRS{serial}=="0001401082", \
		SYMLINK+="n9600a-0001401082"

	This example would produce /dev/n9600a-0001401082 for my test board:

		lrwxrwxrwx  1 root root  7 sep 13 17:20 n9600a-0001401082 -> ttyACM0

Hackery by Dennis Boone, KB8ZQZ

About

Linux program to turn on serial number enumeration on MCP2221A

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published