# multiple FTDI usb serial adapter - ttyUSBx moves on reboot

## TonyErcolano

I have 7 ftdi adapters on a usb hub.  On boot they come up as /dev/ttyUSB0 through /dev/ttyUSB6.

All well and good.

Let's say on boot the ftdi in the first slot of the hub will be USB0 and so on down the line on slots on the hub.

However on reboot, the adapter that was in the first slot of the hub will come up as say USB4, the second might come up as USB1, the third comes up as USB0 and so on.

Note that I get USB0 through USB6 but the're just in different slots!  This is somewhat of a pain as I am using these as consoles for to 7 other machines.

Anyone seen this?  Is this normal?  Anyway I can force them to stay the same name from boot to boot?

----------

## poly_poly-man

Hmm... I know this is possible with network cards, and I will soon see a very similar problem...

My guess will be to check out udev - however, is there any unique identification per-device?

poly-p man

----------

## TonyErcolano

That was perfect.

I created the following rules in 99-local.rules in /etc/udev/rules.d

KERNEL=="ttyUSB[0-9]*",ATTRS{serial}=="FTCW3PYQ",SYMLINK="target1"

KERNEL=="ttyUSB[0-9]*",ATTRS{serial}=="FTCAX1YN",SYMLINK="target2"

KERNEL=="ttyUSB[0-9]*",ATTRS{serial}=="FTCYPIJO",SYMLINK="target3",

KERNEL=="ttyUSB[0-9]*",ATTRS{serial}=="FTCW3RMP",SYMLINK="target4"

KERNEL=="ttyUSB[0-9]*",ATTRS{serial}=="ftDXEF67",SYMLINK="target5"

KERNEL=="ttyUSB[0-9]*",ATTRS{serial}=="FTCW3PBW",SYMLINK="target6"

which created symlinks /dev/target1 and so on.

Thank you for your time!

Tony

----------

## poly_poly-man

For future reference, what exactly are those numbers? How can I access them?

My situation right now is a bit different; I have an ipaq (which is a usb->serial device) and I'm getting a generic something usb->serial cable, so I can probably use pid/vid to seperate, but I (and others) could potentially use the info for FTDI's.

thanks,

poly-p man

----------

## TonyErcolano

They seem to be what FTDI is supplying as a unique serial number or identifier.

Sorry for the long output here but:

# udevinfo -a -p /sys/class/tty/ttyUSB0

Udevinfo starts with the device specified by the devpath and then

walks up the chain of parent devices. It prints for every device

found, all possible attributes in the udev rules key format.

A rule to match, can be composed by the attributes of the device

and the attributes from one single parent device.

  looking at device '/class/tty/ttyUSB0':

    KERNEL=="ttyUSB0"

    SUBSYSTEM=="tty"

    DRIVER==""

    ATTR{dev}=="188:0"

  looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.5/1-1.5:1.0/ttyUSB0':

    KERNELS=="ttyUSB0"

    SUBSYSTEMS=="usb-serial"

    DRIVERS=="ftdi_sio"

    ATTRS{latency_timer}=="16"

  looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.5/1-1.5:1.0':

    KERNELS=="1-1.5:1.0"

    SUBSYSTEMS=="usb"

    DRIVERS=="ftdi_sio"

    ATTRS{interface}=="usb seril conuerter"

    ATTRS{modalias}=="usb:v0403p6001d0400dc00dsc00dp00icFFiscFFipFF"

    ATTRS{bInterfaceProtocol}=="ff"

    ATTRS{bInterfaceSubClass}=="ff"

    ATTRS{bInterfaceClass}=="ff"

    ATTRS{bNumEndpoints}=="02"

    ATTRS{bAlternateSetting}==" 0"

    ATTRS{bInterfaceNumber}=="00"

  looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.5':

    KERNELS=="1-1.5"

    SUBSYSTEMS=="usb"

    DRIVERS=="usb"

    ATTRS{serial}==" FTCW3PYQ"

    ATTRS{product}=="usb seril conuerter"

    ATTRS{manufacturer}=="FTDI"

    ATTRS{quirks}=="0x0"

    ATTRS{maxchild}=="0"

    ATTRS{version}==" 1.10"

    ATTRS{devnum}=="22"

    ATTRS{busnum}=="1"

    ATTRS{speed}=="12"

    ATTRS{bMaxPacketSize0}=="8"

    ATTRS{bNumConfigurations}=="1"

    ATTRS{bDeviceProtocol}=="00"

    ATTRS{bDeviceSubClass}=="00"

    ATTRS{bDeviceClass}=="00"

    ATTRS{bcdDevice}=="0400"

    ATTRS{idProduct}=="6001"

    ATTRS{idVendor}=="0403"

    ATTRS{bMaxPower}==" 44mA"

    ATTRS{bmAttributes}=="a0"

    ATTRS{bConfigurationValue}=="1"

    ATTRS{bNumInterfaces}==" 1"

    ATTRS{configuration}==""

    ATTRS{dev}=="189:21"

You'll note on the final parent the value for ATTR{serial}=="FTCW3PYQ".  It is also somewhat amusing to note the next line has a rather bizzare spelling.  Here is the usbinfo on another device

udevinfo -a -p /sys/class/tty/ttyUSB4

Udevinfo starts with the device specified by the devpath and then

walks up the chain of parent devices. It prints for every device

found, all possible attributes in the udev rules key format.

A rule to match, can be composed by the attributes of the device

and the attributes from one single parent device.

  looking at device '/class/tty/ttyUSB4':

    KERNEL=="ttyUSB4"

    SUBSYSTEM=="tty"

    DRIVER==""

    ATTR{dev}=="188:4"

  looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.7/1-1.7:1.0/ttyUSB4':

    KERNELS=="ttyUSB4"

    SUBSYSTEMS=="usb-serial"

    DRIVERS=="ftdi_sio"

    ATTRS{latency_timer}=="16"

  looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.7/1-1.7:1.0':

    KERNELS=="1-1.7:1.0"

    SUBSYSTEMS=="usb"

    DRIVERS=="ftdi_sio"

    ATTRS{interface}=="usb serial converter"

    ATTRS{modalias}=="usb:v0403p6001d0400dc00dsc00dp00icFFiscFFipFF"

    ATTRS{bInterfaceProtocol}=="ff"

    ATTRS{bInterfaceSubClass}=="ff"

    ATTRS{bInterfaceClass}=="ff"

    ATTRS{bNumEndpoints}=="02"

    ATTRS{bAlternateSetting}==" 0"

    ATTRS{bInterfaceNumber}=="00"

  looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.7':

    KERNELS=="1-1.7"

    SUBSYSTEMS=="usb"

    DRIVERS=="usb"

    ATTRS{serial}=="ftDXEF67"

    ATTRS{product}=="usb serial converter"

    ATTRS{manufacturer}=="ftdi"

    ATTRS{quirks}=="0x0"

    ATTRS{maxchild}=="0"

    ATTRS{version}==" 1.10"

    ATTRS{devnum}=="30"

    ATTRS{busnum}=="1"

    ATTRS{speed}=="12"

    ATTRS{bMaxPacketSize0}=="8"

    ATTRS{bNumConfigurations}=="1"

    ATTRS{bDeviceProtocol}=="00"

    ATTRS{bDeviceSubClass}=="00"

    ATTRS{bDeviceClass}=="00"

    ATTRS{bcdDevice}=="0400"

    ATTRS{idProduct}=="6001"

    ATTRS{idVendor}=="0403"

    ATTRS{bMaxPower}==" 44mA"

    ATTRS{bmAttributes}=="a0"

    ATTRS{bConfigurationValue}=="1"

    ATTRS{bNumInterfaces}==" 1"

    ATTRS{configuration}==""

    ATTRS{dev}=="189:29"

Note the slightly different format for the serial attr and the correct spelling on the product attr.

Another interesting point is that using one of these devices on Apples OS X 10.5.4 you end up with a device, created by the stock ftdi driver for OS X with no playing around rules, named:

tty.usbserial-FTCYONGM

However on OS X when you reboot, the OS doesn't always find the device.  I used to find it necessary to unplug and replug all of the converters to get them all to be seen.  A bit of a pain.

----------

## mamac

TonyErcolano,

I try to use FTDI USB serial converter and get some issue with the rate, the transfer of data is very slow.

What driver do you use?

Thank you

----------

## TonyErcolano

http://www.ftdichip.com/Drivers/VCP.htm

----------

