I’m running a udev rule:
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1164", ATTRS{idProduct}=="757a", SYMLINK+="myCamera"
It seems that randomly the udev rule will symlink to /dev/video1 instead of /dev/video0:
lrwxrwxrwx 1 root root 6 May 15 13:47 /dev/myCamera -> video1
I know that /dev/video0 has the capture capability:
ubuntu@ubuntu:~$ udevadm info /dev/video1
...
E: ID_V4L_CAPABILITIES=:
...
ubuntu@ubuntu:~$ udevadm info /dev/video0
...
E: ID_V4L_CAPABILITIES=:capture:
...
and that /dev/video1 is only for metadata purposes.
I’ve developed a work around udev rule:
SUBSYSTEM=="video4linux", ATTR{index}=="0", ATTRS{idVendor}=="1164", ATTRS{idProduct}=="757a", SYMLINK+="myCamera"
But this only works because I know that there is a single camera and the index of the camera I want will be 0. I’m wondering if there is a more robust way to write a udev rule for this that accounts for when I would have multiple cameras hooked up to a single system and that ensures the symlinks will always go to the one that have the capture capabilities.
e.g. if I have 2 cameras that are going to be labeled /dev/video0 and /dev/video1 for one camera, and /dev/video2 and /dev/video3 for the other camera. How would I make sure that the symlinks go to /dev/video0 and /dev/video3 (assuming they are the ones with the capture capability) appropriately?