Super User is a question and answer site for computer enthusiasts and power users. 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've got a few usb webcams, but unfortunately they have no serial numbers. So upon boot they tend to switch device file names.

Since they'll always be in the same usb port I want to create a rule based on that. But it's failing miserably.

Here's what I tried so far:

# /sys/bus/usb/devices/2-5.1:1.1/uevent
#SUBSYSTEM=="usb", SYSFS{idVendor}=="05e1", SYSFS{idProduct}=="0408", PLACE=="2-5.1", NAME="video98"
#SUBSYSTEM=="usb", PLACE=="2-5.1", NAME="video98"
#SUBSYSTEM=="usb", ATTR{busnum}="002", ATTR{devnum}="009", ATTR{idVendor}="05e1", NAME="video98"
SUBSYSTEM=="usb", ATTR{busnum}="002", ATTR{devpath}="/devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.1", ATTR{idVendor}="05e1", NAME="video98"

# /sys/bus/usb/devices/2-5.3:1.1/uevent
#SUBSYSTEM=="usb", ATTR{busnum}="002", ATTR{devnum}="010", ATTR{idVendor}="05e1", NAME="video99"
SUBSYSTEM=="usb", ATTR{busnum}="002", ATTR{devpath}="/devices/pci0000:00/0000:00:1d.7/usb2/2-5/2-5.3", ATTR{idVendor}="05e1", NAME="video99"

So yeah, I've made a few attempts. I've seen that devnum also changes on boot, so I don't want to use that.

I actually just want to use the "2-5.3" and "2-5.1" thing. That's always the same. But how?

share|improve this question
up vote 0 down vote accepted

I've done almost exactly this before, weirdly enough. Mine were external hard drives, but it shouldn't be any different for USB cameras. I used the SCSI bus addresses for the ports, which worked well.

I got my info using lsscsi, which will print something like the following for a USB device:

[2:0:0:0] disk <descriptor> <dev name>

Then something similar the following rule should do what you want:

SUBSYSTEM=="usb", KERNEL=="sd*1", KERNELS=="2:0:0:0", SYMLINK+="<label_1>"

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.