Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I log data from my serial ports consistently?

Tags:

linux

putty

udev

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
like image 684
Nick ODell Avatar asked Dec 18 '12 21:12

Nick ODell


1 Answers

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.

like image 157
freewill Avatar answered Oct 01 '22 20:10

freewill