Naming your /dev/ttyUSBx devices on a Raspberry Pi

Don’t think I will post this anywhere but here in the blog section, as it is well documented, but I recently needed to name the /dev/ttyUSBx devices on one of my Pi’s. This was because on reboot, sometimes my ARPS TNC would get /dev/ttyUSB0, and other times my Icom 4100 Radio would get /dev/ttyUSB0. Rather than checking and re-writing my APRS and D-Star hotspot configurations at each boot, I found that I can create my own static names for these devices.

First, create a file called /etc/udev/rules.d/99-usb-serial.rules file with the contents similar to this:

SUBSYSTEM=="tty", ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0109", SYMLINK+="aprsTNC"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="icomTAP"

I say similar, because really what you are doing is binding the idVendor/idProduct hardware ID’s to the new name. If you have the same idVendor/idProduct for both devices, you may need to add the Serial Number attribute as well. You can find this attributes by executing:

udevadm info --name=/dev/ttyUSBx --attribute-walk

After you have /etc/udev/rules.d/99-usb-serial.rules configured the way you want to, you can either reboot, or execute the following command to read the new rules and setup the new symbolic links to your devices:

sudo udevadm trigger


Leave a Reply

Your email address will not be published. Required fields are marked *

You can encrypt your comment so that only Robert can read it.