udev rules for webcam

Fred Smith fredex at fcshome.stoneham.ma.us
Thu Nov 6 23:47:23 UTC 2014


Hi all!

I've got an old eeepc 901 set up with Fedora 20, in a captive situation
where it operates a USB web cam (not the built-in one, but something a
good deal better, though modestly priced) snapping an image once per
minute.

Unfortunately, on the rare occasions when the eeepc gets rebooted, the
location in /dev of the particular web cam I'm interested in sometimes
changes from /dev/video0 to /dev/video1, or sometimes the other way.

I was looking to see if I could grope /proc files to find out which 
one was the camera I'm interested in, so the script that runs it
could adapt.

not finding anything on that, I hit on writing a udev rule for the
USB device to make sure it appeared as a predictable /dev/video<x>.

So, I found a bunch of advice on the web, and tried two rather
different udev rules, neither of which works in any way I can confirm.
Here's one of 'em:

lsusb:
Bus 001 Device 002: ID 046d:0825 Logitech, Inc. Webcam C270

so, according to one of the recipes I found, if I make a rule like this
it should work:

SUBSYSTEM=="video4linux", SUBSYSTEM=="usb", ATTRS{idVendor}=="0x046d", ATTRS{idProduct}=="0x0825", SYMLINK+="logitechcam"

if I understand it, this should make the camera appear as "/dev/logitechcam".

If I'm off-base here I hope someone will straighten me out.

this rule is stored in a file in /etc/udev/rules.d/25<stuff>.rules.

unplug/replug the camera elicits no change, and no /dev/logitechcam node,
either. neither does a reboot.

Advice will be gladly accepted! Thanks in advance.

Fred
-- 
---- Fred Smith -- fredex at fcshome.stoneham.ma.us -----------------------------
    "Not everyone who says to me, 'Lord, Lord,' will enter the kingdom of
     heaven, but only he who does the will of my Father who is in heaven."
------------------------------ Matthew 7:21 (niv) -----------------------------


More information about the users mailing list