USB ports; dynamic vs fixed names

Problem: The USB ports on a modern linux PC do not always show up with the same port numbers if you unplug/replug the device.  (It is a dynamic allocation by design.)  This is an issue for things like logging software which is configured to look for my K1EL USB Winkeyer on a certain port.  Sometimes it works, sometimes it doesn't until I change the port number. (I am running Ubuntu 12.04, 12.10, and 13.04 as I type this.)

Resolution: I added a UDEV rule to create a symbolic link between the usb product tied to the exact serial number of the USB device and a simple name like "KX3" or "WINKEYER"

Now I can point my software at the simple name without needing to know about the port info. This is typically just a problem when I am adding/removing USB devices but it happens often enough to be a PiA. In the past I had just dealt with it an update the configuration… now it is seamless to me.

It was about a 5 minute fix once I read through a couple of articles to explain the how & why.
 
 http://www.linuxforu.com/2012/06/some-nifty-udev-rules-and-examples/

http://manpages.ubuntu.com/manpages/quantal/en/man7/udev.7.html 

http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/ 

You can use the following two commands to get more info about the USB port:
 udevadm info -a -n /dev/ttyUSB0 | grep '{serial}' | head -n1 
 
 udevadm info -n /dev/ttyUSB0 -a

I then created called /etc/udev/rules.d/99-usb-serial.rules with my product info

 

You are looking for the idVendor, idProduct, and serial key values and then you can put what ever name you want into the symlink field. If you unplug & replug the the USB device and then ls -la /dev you should see the device listed twice; once with the ttyUSB0 id, and the second time with the symbolic link name.

 

It is a quick & simple hack that restores some level of simplicity back to the software stack that wants to look at a stack location.