I have a 3G/GPS device that creates 5 tty nodes, although it's only one physical USB connection. Basically, a multi port usb-serial adapter.
I'm trying to create some udev
rules to make sure those nodes always have the same name, or at least a symlink to them.
I can indeed find the device at /sys/devices/platform/pxa27x-ohci/usb1/1-2/1-2.2/
. Inside are 1-2.2:1.0/
to 1-2.2:1.4/
, for the 5 nodes it creates.
I can also find it at /sys/bus/usb/devices/1-2.2
.
The udev info for the device is as follows:
udevadm info -a -p /sys/bus/usb/devices/1-2.2/1-2.2\:1.0
looking at device '/bus/usb/devices/1-2.2/1-2.2:1.0':
KERNEL=="1-2.2:1.0"
SUBSYSTEM=="usb"
DRIVER=="option"
ATTR{bInterfaceNumber}=="00"
ATTR{bAlternateSetting}==" 0"
ATTR{bNumEndpoints}=="03"
ATTR{bInterfaceClass}=="ff"
ATTR{bInterfaceSubClass}=="01"
ATTR{bInterfaceProtocol}=="01"
ATTR{modalias}=="usb:v12D1p1506d0000dc00dsc00dp00icFFisc01ip01"
ATTR{supports_autosuspend}=="0"
From this point on, all the nodes have the same info. And the only thing varying between nodes is the bInterfaceNumber property, and the device path. So, I thought of writing a rule by dev path.
Now, for some reason, the following rule gets matched by all those nodes.
ACTION=="add", DEV="/devices/platform/pxa27x-ohci/usb1/1-2/1-2.2/1-2.2:1.0" SYMLINK+="huawey0"
So basically, huawey0
points to the last node enumerated. The device created nodes from ttyUSB2 to 6, and this link points to USB6.
So, I tried by kernel node:
ACTION=="add", KERNEL=="1-2.2:1.0" SYMLINK+="huawey0"
Now, nothing appears on /dev.
After this, I tried using the bInterfaceNumber to separate them. I used the following rule
ACTION=="add", DEV="/devices/platform/pxa27x-ohci/usb1/1-2/1-2.2/1-2.2:1.[0-4]" ATTR{bInterfaceNumber}=="00" SYMLINK+="huawey0"
And still, nothing happens. I even tried a trimmed down version of the rule..
ACTION=="add", ATTR{bInterfaceNumber}=="00" SYMLINK+="huawey0"
And still nothing happens. Why is it not matching?