Udev rule to match multiple node USB device
Your rules all have syntax errors in them:
=
is for assignment==
is for comparison, so you were not actually looking at whatDEV
equaled, you were assigning it.- You need
,
between all the statements, there were none beforeSYMLINK+=
.
Fist Rule
ACTION=="add", DEV=="/devices/platform/pxa27x-ohci/usb1/1-2/1-2.2/1-2.2:1.0", SYMLINK+="huawey0"
Second Rule
ACTION=="add", KERNEL=="1-2.2:1.0", SYMLINK+="huawey0"
Third 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"
Fourth Rule
ACTION=="add", ATTR{bInterfaceNumber}=="00", SYMLINK+="huawey0"
All these rules should do what you want now (I would use the first one personally).
Although this post was asked three years ago, and this might not address the answer, I still want to share my successful experience here for the future reference.
According to Jens Reimann's Identify GSM modem devices using udev, "the device attribute “bInterfaceNumber” is not on the tty device, but on the usb device in the parent hierarchy", so I created two rules for my FTDI usb-to-4-port-serial adapter:
SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", SYMLINK+="ttyUSB_FTDI_4_PORT_%E{.LOCAL_ifNum}"
This stores the attribute “bInterfaceNumber” into the environment variable “.LOCAL_ifNum” (the prefixed dot is a notation for temporary or hidden variables). In the second rule the same variable is pulled on using the “%E” syntax. Newer udev versions also support “$env” instead of “%E”.
(by Jens Reimann)
where ttyUSB_FTDI_4_PORT_
is the symlink name.
These two rules will create symlinks as ttyUSB_FTDI_4_PORT_00
, ttyUSB_FTDI_4_PORT_01
, ttyUSB_FTDI_4_PORT_02
, ttyUSB_FTDI_4_PORT_03
.
You can add ATTRS{serial}
attribute to constrain the enumeration further.
Jens Reimann also acknowlegfed the contribution of Ketan Patel's U&L question, Udev rule file for modem not working, with accepted answer by derobert.