Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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