Picking right serial device

3

I have several identical USB to serial port adapters on my Fedora FC12 server. Each time I boot, the devices seem to change devices names (/dev/ttyUSBn). Now I will assume that the bus and device names do that change. That thye are tied to the USB hubs inside the motherboard. So is it possible to determine the /dev name given a Bus and Device ID? I am hoping for a command line interface, but I am not scared to write some C code, but would need to help with what system functions I might need to call.

Skye Sweeney

Posted 2012-08-06T00:38:47.360

Reputation: 31

I have not encounterred the naming issue you mention when using Ubuntu 10.4 (a 2.6.3? kernel). As long as the same USB-serial adapters are connected to the same USB ports, I see the same device names. Review the system log, with 'dmesg' command, for the device recognition and name assignment. – sawdust – 2012-08-06T03:03:51.537

Answers

0

You could address this problem by writing a custom UDEV rule for every converter you want to use. This usually boils down to creating a text file in a specific location, typically /etc/udev/rules.d/*.rules or something similar (depending on your distro).

I usually create symlinks to the device instead of renaming it... it is just easier and it allows me to abstract my devices from the operating system naming scheme. In the following an example of what you want to accomplish: KERNEL=="ttyUSB*", KERNELS=="1-1.4", SYMLINK+="bridge0" KERNEL=="ttyUSB*", KERNELS=="1-1.5", SYMLINK+="bridge1" KERNEL=="ttyUSB*", KERNELS=="1-1.2", SYMLINK+="bridge2" KERNEL=="ttyUSB*", KERNELS=="1-1.1", SYMLINK+="bridge3" KERNEL=="ttyUSB*", KERNELS=="2-1.1", SYMLINK+="bridge4"

And now an example that leverages the serial number of the device instead (so the name is bound to the converter, not to where you connect it): SUBSYSTEM=="tty", ATTRS{serial}=="FTFV8YRP", SYMLINK+="bridge0" SUBSYSTEM=="tty", ATTRS{serial}=="A600N0ER", SYMLINK+="bridge1" SUBSYSTEM=="tty", ATTRS{serial}=="FTZ2CBOD", SYMLINK+="bridge2" SUBSYSTEM=="tty", ATTRS{serial}=="FTZ2CBVE", SYMLINK+="bridge3" SUBSYSTEM=="tty", ATTRS{serial}=="FTZ29GWA", SYMLINK+="bridge4"

ntd

Posted 2012-08-06T00:38:47.360

Reputation: 103