usbSerialPorts

How to deal with shifting USB ports

A lot of ham radio applications interface to radios, rotators, etc using serial ports. In the last few years, very few computers have built-in serial ports, and serial interfaces are typically USB devices.

If the correct drivers are present, USB serial devices will end up assigned to devices "ttyUSB0", "ttyUSB1", etc. However, they don't always get assigned in the same order. if you change the port they're plugged into, or the module load order changes, the devices are assigned in a different order.

This is a problem when (for example) your radio is connected to /dev/ttyUSB0, and the antenna rotator is connected to /dev/ttyUSB1.

There is a solution to this - The kernel creates symlinks based upon the device identifier, which you can use to open the specific device you want.

For example, the devices may appear as follows:

  • sconklin@Shack:~$ ls -l /dev/serial/by-id
    total 0
    lrwxrwxrwx 1 root root 13 Mar  7 11:30 usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0 -> ../../ttyUSB0
    lrwxrwxrwx 1 root root 13 Mar  7 11:30 usb-Silicon_Labs_West_Mountain_Radio_RIGblaster_Advantage_55b64d42-if00-port0 -> ../../ttyUSB1

In the above case, the prolific adapter is connected to a rotator, and the rigblaster is the serial CAT control for the radio. By using the following path for the device for the radio, you access the correct serial port, even if it changes to a different /dev/ttyUSB device:

/dev/serial/by-id/usb-Silicon_Labs_West_Mountain_Radio_RIGblaster_Advantage_55b64d42-if00-port0

UbuntuHams/usbSerialPorts (last edited 2013-03-07 18:33:12 by sconklin)