1

My USB device keeps changing its number in its name /dev/ttyUSB?.

I have seen this and this, and tried to do the same with no luck.

gauthier@sobel:/etc/udev/rules.d $ udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB1)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/ttyUSB1/tty/ttyUSB1':
    KERNEL=="ttyUSB1"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/ttyUSB1':
    KERNELS=="ttyUSB1"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="ftdi_sio"
    ATTRS{port_number}=="0"
    ATTRS{latency_timer}=="1"
[...]

Then I created a file /etc/udev/rules.d/50-udev.rules (it did not exist) and put this inside:

SUBSYSTEM=="usb-serial", KERNEL=="ttyUSB?", SYMLINK+="ttyUSBserial"

But did not get the symlink, even after udevadm trigger:

gauthier@sobel:/etc/udev/rules.d $ ls /dev|grep USB
ttyUSB1

How can I create a device name that does not change? What am I doing wrong with my rule?

2 Answers 2

2

If I had read correctly, I would have noticed the differences between the attributes of the device (KERNEL, SUBSYSTEM) and that of the parent device (KERNEL**S**, SUBSYSTEM**S**).

Adding the 'S's in the rule worked!

On the way, I also noticed that udev created a persistent symlink in /dev/serial/by-id/usb-*, through its rules in /lib/udev/rules.d/60-persistent-serial.rules, which I could use instead.

1

oh, I followed your journey as well and I cannot get symlink to work even after I added 'S' after. It took me ages to find that you have to use the rules from the device itself (without an 'S'), or one SINGLE parent... I referenced 2 levels of parents so I failed to create the symlink.. Just to share with other guys who happened to have a similar case with me.

3
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. - From Review
    – Pilot6
    Feb 9, 2016 at 8:40
  • 1
    @Pilot6 This looks like an answer to me.
    – Seth
    Feb 9, 2016 at 23:21
  • This information was very useful: use one SINGLE parent. Feb 26, 2016 at 22:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .