You are not logged in.

#1 2020-04-19 19:54:55

gen2arch
Member
Registered: 2013-05-16
Posts: 206

udev rules for consistent webcam device names

Hi, I want to write an udev rule in order for my external ubs-connected webcams to always receive the same name during boot.
Wtih regard to this I came up with the following:

KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="04f2", ATTRS{idProduct}=="b596", SYMLINK+="video-P50"
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="09a1", ATTRS{idProduct}=="0021", SYMLINK+="video-MX1"
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="2b19", ATTRS{idProduct}=="0200", SYMLINK+="video-DC80"

This actually does work, as far as consistent naming is concerned. Problem is: not a single program can deal with these symlinks, neither qv4l2, nor, guvcview, nor obs: all of these seem to be able to handle exclusively "/dev/videoX" type of device names.
How would the udev rule have to look like to produce "videoX" names and at the same time not interfere with the kernels own naming scheme?
I tried

SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="04f2", ATTRS{idProduct}=="b596", NAME="video0"
SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="09a1", ATTRS{idProduct}=="0021", NAME="video2"
SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="2b19", ATTRS{idProduct}=="0200", NAME="video4"

but this gave me different names upon every boot, dependent of plugged in devices.

I also remarked that for every webcam I plug in there are three device names created (as schon by v4l2-ctl --list-devices); for example:

Integrated Camera: Integrated C (usb-0000:00:14.0-8):
        /dev/video4
        /dev/video5
        /dev/media2

why is that??
Thanks.

Offline

Board footer

Powered by FluxBB