Udev webcam rule read, but not respected?

Solution 1:

It looks like you have two problems.

The first is an ordering problem. Reading the kernel.org manpage on udev, it mentions:

All rules files are ... processed in lexical order

Meaning rules are processed in alphabetical order. The first rule that triggers for a device creates the device file. It looks like you've named your rule file jj-video.rules. Looking at the output you provided of udevadm --debug test, it shows that this file is parsed LAST of all the rule files on your system.

Try renaming your file 00-jj-video.rules. That should put it first in the udev rule list, and make it trigger before the other rules.

The second issue is with the rules themselves. The rules read that you're trying to create /dev/webcam2 when the Logitech QuickCam Pro 3000 is plugged in and when the kernel puts it on /dev/video2. From what you said, you don't want to match on the device name. Another problem is that you aren't always using hexadecimal notation in your ATTRS.

This rule should work for the Logitech QuickCam Pro 3000, based on the information you provided in the question:

SUBSYSTEM=="video4linux", ATTRS{idVendor}=="0x046d", ATTRS{idProduct}=="0x08b0", SYMLINK+="webcam2"

The following may work for the other webcam. I can't be sure, because you didn't provide full information on it:

SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0x1d6b", ATTRS{idProduct}=="0x0001", SYMLINK+="webcam1"

The most useful tutorial I've found on writing udev rules is http://www.reactivated.net/writing_udev_rules.html.