On a Raspberry Pi 4 running Ubuntu 20.04 on aarch64, I have a USB ZWave device that I want to expose at a specific name, so I wrote a simple udev
rule to do so, but it doesn't seem to work.
The vendor:product id is 0658:0200
My rule is
ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", NAME="ttyZWAVE0"
Yet the device continues to show up as ttyACM0
.
If I use the following rule, which has the same match criteria, to create a symbolic link instead, the symbolic link does show up correctly:
ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyZWAVE0"
Here was my udevadm --name=/dev/ttyACM0 --attribute-walk
output before creating the rule:
looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1':
KERNELS=="1-1.1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{bcdDevice}=="0000"
ATTRS{version}==" 2.00"
ATTRS{rx_lanes}=="1"
ATTRS{devpath}=="1.1"
ATTRS{removable}=="unknown"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bMaxPower}=="100mA"
ATTRS{idVendor}=="0658"
ATTRS{bmAttributes}=="80"
ATTRS{ltm_capable}=="no"
ATTRS{bNumInterfaces}==" 2"
ATTRS{bConfigurationValue}=="1"
ATTRS{idProduct}=="0200"
ATTRS{bDeviceSubClass}=="00"
ATTRS{busnum}=="1"
ATTRS{urbnum}=="12"
ATTRS{configuration}==""
ATTRS{speed}=="12"
ATTRS{tx_lanes}=="1"
ATTRS{maxchild}=="0"
ATTRS{devspec}=="(null)"
ATTRS{devnum}=="3"
ATTRS{bNumConfigurations}=="1"
ATTRS{quirks}=="0x0"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceClass}=="02"
Why does the rule to straight-up rename it not work, either with a udev trigger
or a full system restart, yet the rule to add a symlink does work? Am I missing something simple?
I see nothing useful at all in journalctl (literally nothing even mentioning it, no errors, no nothing).
Edit to add:
This also seems to fail in the same way on my laptop, running Ubuntu 20.04 on amd64, with the exact same results (obviously with different parent device paths).
udevadm test /sys/path/to/device
is giving no obvious answers, either, as to why it doesn't do what I expect. It does show it reading my rules and there are no errors...
KERNELS=="1-3", NAME="ttyZWAVE0", SYMLINK+="ttyZWAVE1"
and what do I get? Still ttyACM0 and also the symlink for ttyZWAVE1. Why is it refusing to rename the device? It obviously is matching and taking action... But then it is ignoring the part I actually care about.grep ACM /usr/lib/udev/rules.d/*
and I can't find one that seems like it should be matching this device more specifically than my rule. Are udev rules a last-match-wins sort of thing, or does the most specific match win? Because my rules runs first, before any other rule.udevadm test
gave a new bit of useful output...ttyACM0: /etc/udev/rules.d/zzz.rules:1 Kernel device nodes cannot be renamed, ignoring NAME="ttyZWAVE0"; please fix it.
So is this just not something I'm allowed to do at all, or is there a way around this? I found this, butman udev
on my system has no such text: askubuntu.com/questions/546100/…