Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 2 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

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.

share|improve this answer
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 at 8:40
1  
@Pilot6 This looks like an answer to me. – Seth Feb 9 at 23:21
    
This information was very useful: use one SINGLE parent. – Pablo Reyes Feb 26 at 22:07

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.