3

I have two USB Type A to COM cables. Let’s call them: Cable 1 and cable 2. Now I need to make sure their TTY device assignments stay the same after reboot. I am using Ubuntu.

For example I want to the computer to assign cable 1 to ttyUSB1 and cable 2 to ttyUSB2. Because of after the computer reboots, it will shuffle those cable to TTY assignments.

So I read some solutions for similar problems for other similar devices.

But there is a problem.

So when I try this:

sudo udevadm info --query=property --name=/dev/ttyUSB0 > usb0
sudo udevadm info --query=property --name=/dev/ttyUSB1 > usb1

And this:

vimdiff usb0 usb1

The cables don’t have ID_SERIAL_SHORT value. There is no difference except names ttyUSB0 and ttyUSB1. The cables are manufactured by the same company. So there is no difference by serial name.

Output of diff first secnd

1a2
> Bus 002 Device 020: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
12
  • Connect first cable, do lsusb | tee first in a shell, disconnect the cable connect the other, do lsusb | tee secnd, then diff first secnd and add the diff output text to your posting - with <pre> before and </pre> after it.
    – Hannu
    Mar 21 '19 at 14:51
  • @Hannu I add the output to my post
    – Samvel
    Mar 21 '19 at 15:04
  • 1
    If there's no difference, how do you expect the OS to tell the difference... That said, if both devices are connected at the same time, surely at least the port number (ID_PATH) should be different?
    – user1686
    Mar 21 '19 at 15:05
  • 1
    They are supposed to represent the physical connection, so hopefully yes...
    – user1686
    Mar 21 '19 at 15:20
  • 1
    For the benefit of everyone else, and maybe enhancing your own understanding; why not add an answer telling what you did step by step?
    – Hannu
    Mar 30 '19 at 9:40
1

To understand the answer let's understand the question first. I have two devices. They are connected to computer by 'RS232 to USB' deices. And I have to config files. In each file there is a section called [SERIAL].

E.g.

[SERIAL]
port = /dev/ttyUSB1

After the reboot there is a chance that "dev path" can be changed.

Now I fix this problem by fixing ID_PATH by adding this code to ACTION=="add",ENV{ID_BUS}=="usb",ENV{ID_PATH}=YOUR_ID_PATH, SYMLINK+="ttyUSBPort1"

And as I understood we create link that refer to one of the /dev/ttyUSB*

So now after reboot there is a chance that /dev/ttyUSBPort1 will refer to another /dev/ttyUSB* but it does not prevent me as in my config file the port is set as /dev/ttyUSBPort1 and this port does not change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.