Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

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':
ATTR{bAlternateSetting}==" 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?

share|improve this question
up vote 4 down vote accepted

Your rules all have syntax errors in them:

  1. = is for assignment == is for comparison, so you were not actually looking at what DEV equaled, you were assigning it.
  2. You need , between all the statements, there were none before SYMLINK+=.

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).

share|improve this answer

In addition to Alex's comments, there is another issue. It seems ATTR{bInterfaceNumber} doesn't work for some reason. To quote the answer to a related question, you should use something along the lines of

SUBSYSTEM=="tty", ACTION=="add", \
    ENV{ID_VENDOR_ID}=="067b", ENV{ID_MODEL_ID}="2303", \
share|improve this answer

Your Answer


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.