Multiple /dev/video for one physical device

The second device provides metadata about the video data from the first device. The new devices were introduced by this patch:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=088ead25524583e2200aa99111bea2f66a86545a

More information on the V4L metadata interface can be found here:

https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/dev-meta.html

For run of the mill USB Video Class devices, this mostly just provides more accurate timestamp information. For cameras like Intel's RealSense line, provide a wider range of data about how the image was captured.

Presumably this data was split out into a separate device node because it couldn't easily be delivered on the primary device node in a compatible way. It's a bit of a pain though, since (a) applications that don't care about this metadata now need to filter out the extra devices, and (b) applications that do care about the metadata need a way to tie the two devices together.


Really annoying, but just found a solution: let udev assign symlinks for device nodes just for the "real" cams, not the metadata. They are identical (?) to udev, i.e.

udevadm info -n /dev/video0 is the "same" as udevadm info -n /dev/video1, but they get a different ATTR{index}. So for my 2 cams I ended up with the following /etc/udev/rules.d/99-cam.rules:

SUBSYSTEM=="video4linux", ATTRS{idVendor}=="eb1a", ATTRS{idProduct}=="299f", ATTR{index}=="0", MODE="0664", GROUP="video", SYMLINK+="cams/cam1"

SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1908", ATTRS{idProduct}=="2311", ATTR{index}=="0", MODE="0664", GROUP="video", SYMLINK+="cams/cam2"

After that just use /dev/cams/camX in your application instead of the /dev/videoY