Define a patch to each serial port

115 Views Asked by At

I'm using CentOS 6 and I have two serial ports (two USB interfaces on two different ports), USB1 and USB2. When I connect the USB1, the OS sets her patch to "/dev/ttyACM0", and when I connect the USB2, "/dev/ttyACM1". But when I connect first the USB2, the OS sets her patch to "/dev/ttyACM0" and no to "/dev/ttyACM1". I need that the USB1 patch be "/dev/ttyACM0" and USB2 "/dev/ttyACM1", regardless of the order that I connect the interfaces. How I do to do it?

Thank you

1

There are 1 best solutions below

0
On

Create a udev rule that defines the symlink based on the attributes of the USB device (such as the serial number).

Find out information about your device-

udevadm info -n /dev/ttyACM0 -a
udevadm info -n /dev/ttyACM1 -a

Then go into /etc/udev/rules.d/ and create a udev rule. Something similar to the blurb below. Here is a good reference. For lots of examples and more discussion, do searches for udev persistent usb serial.

SUBSYSTEM=="tty", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0000", ATTRS{serial}=="000001", SYMLINK+="ACM0"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0000", ATTRS{serial}=="000002", SYMLINK+="ACM1"