I added an udev rule to generate a separate link to a special tty device. I took the vendor and product id from lsusb:
Bus 001 Device 016: ID abcd:1234 Foo Device
The dmesg
output for the device is:
[ 369.384850] usb 1-1.1: new full-speed USB device number 4 using xhci_hcd
[ 369.470492] usb 1-1.1: New USB device found, idVendor=09d8, idProduct=0420
[ 369.470506] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 369.470515] usb 1-1.1: Product: TWN4/B1.06/CCL3.12/PRS1.04
[ 369.470522] usb 1-1.1: Manufacturer: OEM
[ 369.475188] cdc_acm 1-1.1:1.0: ttyACM0: USB ACM device
Normally the Debian system generates an ACM* tty for this device:
$ ls /dev/ttyACM*
/dev/ttyACM0
So I created /ect/udev/rules.d/99-bizrfid.rules
:
ACTION=="add", ATTRS{idVendor}=="09d8", ATTRS{idProduct}=="0420", SYMLINK+="ttyMyDevice"
But ls /dev/tty*
does not show ttyMyDevice
.
What I tried so far without success:
- Running
udevadm trigger
. This should apply the new udev rule. - I did a reboot.
- I had a look to
udevadm test /dev/ttyACM0
. My udevrule is shown at the end. So I am sure that it had not been overridden. But I wonder about the ‘unable to open’ hint. Nevertheless this hint is present for other ttys, such as tty0 or ttyS0, too.
... Reading rules file: /lib/udev/rules.d/98-systemd.rules Reading rules file: /etc/udev/rules.d/99-bizrfid.rules rules contain 49152 bytes tokens (4096 * 12 bytes), 12883 bytes strings 4240 strings (40079 bytes), 3515 de-duplicated (27922 bytes), 726 trie nodes used unable to open device '/sys/dev/ttyACM0' Unload module index Unloaded link configuration context.
- I reconnected the USB device.
- I tried another udev rule. This rule is 100% correct because I use this rule already fo other devices. But it does not work for the ttyACM0:
ACTION=="add", KERNEL=="ttyACM*", MODE="0666"
I wonder why this is not working.
How to find reasons why an udev rule is not applied?
2
Answers
According to the comments I the following can be tried to debug the problem:
Check the driver
Use
dmesg
to check the driver you are using and ensure that it is a generic one. If it is a custom compiled one, the problem could be inside your custom implementation. If it is a generic one, go on to step two. I found the driver name in the last line:cdc_acm
Check the user permissions
Ensure that the permission of your udev rule is correct:
Do a test run for the add-action
Check the output of
udevadm test -a add $(udevadm info -q path -n /dev/ttyACM0)
. My output looks like this:calling: test
For the
udev
rule/ect/udev/rules.d/99-bizrfid.rules
I would add theSUBSYSTEM
:You could add also
ATTRS{manufacturer}==
, butidVendor
andidProduct
are sufficient.Otherwise it looks correct and the test run creates the symlink:
creating link '/dev/ttyMyDevice' to '/dev/ttyACM0'