1

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?

0

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>"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.