tags:

views:

219

answers:

2

I have two legacy machines connected to a Linux box with USB using the ftdi_sio driver, to /dev/ttyUSB0 and /dev/ttyUSB1. The Linux box is relaying and analyzing the traffic between the machines. When the Linux box boots up, the machines are connected to the files pretty much randomly. The problem is to know which one is which.

I could just ask the devices, of course, but I'd like to avoid the risk of malfunction due to sending wrong data to the wrong device. Is there a way to figure out, for example, the id of the device connected to a tty file?

+1  A: 

Check this Using Linux USB page.

/proc/bus/usb/devices lists information about the devices currently attached to the USB bus. This is very useful when trying to figure out if the device is correctly enumerated.

nik
Looking at `/proc/bus/usb/devices` solved the problem. The tricky part was figuring out that although port enumeration starts at 0, the `ftdi_sio` driver seems to start it at 1, so Bus 2 Port 0 would show up in `dmesg` as `usb 2-1`.
Ville Sundberg
A: 

Maybe you can use the output from lsusb -v and look at iProduct + iSerial to determine the order the devices are attached.

hlovdal
No dice, the lsusb -v output does not depend on which port the device is attached to.
Ville Sundberg