11

I need to deal with two pieces of custom hardware which both send debugging data over two serial connections. Those serial connections go through two serial-to-USB converters. The serial-to-USB devices have the same vendor numbers, device numbers, and, apparently, the same serial numbers.

Here's the issue: I want to log the two serial ports separately. The custom hardware needs to be rebooted constantly, and whether they attach to the same /dev/ttyUSB* is completely random. How can I make them pick the same device path every time? I could make it dependent on what port it is plugged into, but that seems kind of hacky.

So, I ran a diff against the output of udevadm, like so:

$ udevadm info -a -p `udevadm info -q path -n /dev/ttyUSB1` > usb1
$ udevadm info -a -p `udevadm info -q path -n /dev/ttyUSB2` > usb2
$ diff usb1 usb2

The output of the diff is long; you can see it here

Grepping for serial (same for both):

$ udevadm info -a -p `udevadm info -q path -n /dev/ttyUSB2` | grep serial
SUBSYSTEMS=="usb-serial"
ATTRS{serial}=="0001"
ATTRS{serial}=="0000:00:1d.7"

Other info:

I'm using PuTTY to read from the serial ports.
OS:

$ uname -a
Linux xxxxxxxx.localdomain 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Nick ODell
  • 5,641
  • 1
  • 23
  • 47
  • 3
    See http://askubuntu.com/questions/49910/how-to-distinguish-between-identical-usb-to-serial-adapters – Karl Bielefeldt Dec 18 '12 at 22:11
  • @KarlBielefeldt I'd prefer to not make it dependent on which port it is plugged into, but I'll take it if that's the only way. – Nick ODell Dec 18 '12 at 22:55
  • 1
    As far as I know, that *is* the only way if the serial numbers are identical. – Karl Bielefeldt Dec 18 '12 at 22:57
  • I don't suppose if they're two different devices it's possible determine from the debug stream which is which? If so I have some C code that's probably quite similar to what you need. – PeterJ Dec 21 '12 at 03:40
  • As far as I know if the device has a unique ID, the device may map the `/dev-file` using `udev`. Otherwise, the desired behavior can not be achieved. – ymn Dec 21 '12 at 11:10
  • What's output of `dmesg` (or what's new if `kern.log`) when (and each time) you plug one or two of this devices? – F. Hauri Dec 21 '12 at 21:14
  • 1
    @nick if the s/n are same, maybe you can change the s/n on the device? – Roger Dec 26 '12 at 09:59
  • Yes, knowing the vendor and device numbers would help determine if the serial numbers can be programmed. – Fls'Zen Dec 27 '12 at 20:31

1 Answers1

1

Please check if the usb-serial converter is based on a ftdi chip? (You can check driver filenames)

If so; you have a chance to change serial number,or even the manufacturer info.

http://www.ftdichip.com/Support/Utilities.htm Check the tools; MProg and FT_PROG utility tools.

freewill
  • 912
  • 1
  • 9
  • 19
  • I do not have an ftdi chip, because it uses a cp210x driver. However, some googling showed me there was a cp210x equivalent: http://www.silabs.com/support%20documents/technicaldocs/an144.pdf I appears that this chip supports it too. (cp2103) – Nick ODell Dec 28 '12 at 00:39