This is an old revision of the document!
Table of Contents
NinoTNC udev Guide
This guide is intended to assist you in creating static devices for any number of NinoTNCs connected your Raspberry Pi. The device nodes set up will remain constant across restarts, power cycles, and moving the NinoTNC usb cable to a different usb port.
This wiki article is NOT to be used as an exact key-for-key and click-for-click guide, and also assumes that you are comfortable using the command line. If you are not using a Pi, the steps should also applicable to any Debian/Ubuntu derived system.
Software Prerequisites
A few specific pieces of software are required for configuring the USB chip used on the NinoTNC so that each individual unit can be identified by a serial number, instead of the USB socket that it is plugged into.
- The ability to act and edit files as the system superuser (root)
- A working git installation
- MPC2221a USB chip setting adjustment tool
First, ensure you have a working git installation with the command sudo apt install git
After git is installed/updated, get a copy of the MPC2221a settings utility using cd ~ && git clone https://github.com/g5dsg/2221aTool.git
The settings tool is written in the python language, and it needs a couple of extra support packages to be able to work. To install the click
and pyusb
packages: sudo apt install python3-click python3-usb
Set the Serial Number
Before proceeding with any steps in this section, you should only have one NinoTNC connected. This ensures that the changes are made on the correct device.
First, enable the serial number reporting with sudo ~/2221aTool/2221aTool.py enum-serial 1
When the command completes you can change the reported serial number with one of your own choosing with
sudo python3 ./2221aTool.py set-serial
followed by your desired serial number, which can be up to 30 unicode characters.
Example: sudo python3 ./2221aTool.py set-serial 0123456789
When you are finished enter the command sudo dmesg -W
then remove and reconnect your NinoTNC. The new serial number will be displayed as part of the device information. Use CRTL + c to return to your prompt.
Set the Product Info
Before proceeding with any steps in this section, you should only have one NinoTNC connected. This ensures that the changes are made on the correct device.
You can change the reported product description to better identify the device. This can be used as an alternative to the serial number. The process is very similar. Use sudo python3 ./2221aTool.py set-description
followed by your desired description, which can be up to 30 unicode characters.
Example: sudo python3 ./2221aTool.py set-description NinoTNC-GB7BMY-HF
When you are finished enter the command sudo dmesg -W
then remove and reconnect your NinoTNC. The new description will be displayed as part of the device information. Use CRTL + c to return to your prompt.
Create the udev Rules
You will need to create or amend the file /etc/udev/rules.d/99-ninotnc.rules
using the serial numbers you have chosen, or located using the dmesg -W
command.
Devices named by hand
This example will make named links for each device based on their serial numbers, allowing the function to be visible
Example udev rules for 2 TNCs with serials 0123456789
and 987654321
:
- /etc/udev/rules.d/99-ninotnc.rules
# Create descriptive links to make refering to NinoTNC's easier SUBSYSTEM=="tty", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00dd", ATTRS{serial}=="0123456789", SYMLINK+="NinoTNC-2m" SUBSYSTEM=="tty", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00dd", ATTRS{serial}=="9876543210", SYMLINK+="NinoTNC-4m"
Serial number names
This example will create a link for each NinoTNC using it's serial number as the device name, but requires you to remember which NinoTNC serial is used for each purpose
- /etc/udev/rules.d/99-ninotnc.rules
# Create descriptive links to make refering to NinoTNC's easier SUBSYSTEM=="tty", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00dd", SYMLINK+="NinoTNC-%s{serial}"
Final Steps
To activate the newly-created rules you can either remove and reconnect the NinoTNC USB cable, or use the command sudo udevadm trigger
. Once either has been carried out, the new devices will be visible in /dev
for use in your application.