Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

ttyUSB0 sometimes boots as ttyUSB4

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Bouwser
Posts: 13
Joined: 2014-09-04 14:12

ttyUSB0 sometimes boots as ttyUSB4

#1 Post by Bouwser »

Hello,
I am running debian linux Wheezy version 7. I have a device with an FTDI driver plugged into my USB port that usually enumerates as ttyUSB0. The software that uses the USB device is hard coded to use ttyUSB0. Sometimes a cell modem is plugged into another USB port. When this happens it enumerates and takes ttyUSB0 - 3, and the FTDI device enumerates to ttyUSB3. This causes the software trying to use the FTDI device not to work.
I am trying to change the boot order so that the FTDI driver loads before the driver for the cell modem, so that the FTDI device is always ttyUSB0, but I can't figure out how to do this. Would someone please explain how to change the order that drivers are loaded? Is there a different way you recommend solving this problem?

Any help is greatly appreciated,
Brent

lkawamot
Posts: 9
Joined: 2014-07-27 17:47

Re: ttyUSB0 sometimes boots as ttyUSB4

#2 Post by lkawamot »

As I understand it, you can not permanently assign the FTDI adapter to USB0. However, a possible solution (if you can get the hard coded USB0 to something else, say "/dev/my_ftdi_interface") is to make a udev rule to symlink to the USBx location that the system assigns.

Look up the serial number for the FTDI interface
1. plug in the device
2. find out what USBx interface it was assigned
3. at the command line type "udevadm info -a -n /dev/ttyUSBx | grep '{serial}'
4. look for the line that looks something like: ATTRS{serial}="AS0288V8" (letters and numbers, but no colons)
5. unplug the device from the USB port.

Create a local udev rule file in /etc/udev/rules.d (I named my file 99-local.rules) with the following line in it:
KERNEL=="ttyUSB?", ATTRS{serial}=="SOME_SERIAL_NUMBER_FROM_ABOVE_LOOK_UP_STEP", SYMLINK+="my_ftdi_interface", MODE="0666"

Now, when you plug in your device, the system will create a symlink from "/dev/my_ftdi_interface" to whatever USBX it assigns. ls -l on /dev/my_ftdi_interface might look something like this:
lrwxrwwxrwx 1 root root 7 Aug 21 09:19 /dev/my_ftdi_interface -> ttyUSB4

Of course, the challenge is to get that hardcoded USB0 to something a little more friendly.

HTH

Bouwser
Posts: 13
Joined: 2014-09-04 14:12

Re: ttyUSB0 sometimes boots as ttyUSB4

#3 Post by Bouwser »

Thank you HTH. Your method works great. The symlink detects whether my FTDI device is assigned to USB0 or USB4 and links to it appropriately. I was able to get the hardcoded value changed to point to my symlink, and all is working well.
I do have one follow up question, to make sure I didn't do something wrong that will be bite me later. In step #4 you said...

4. look for the line that looks something like: ATTRS{serial}="AS0288V8" (letters and numbers, but no colons)

But the only thing that was returned had colons in it...
ATTRS{serial}=="0000:00:1d.1"
So I used the serial number with colons in it and it worked. Why the warning against not using a value with colons in it?

thanks,
Brent

Post Reply