v4l_id: use device_caps if available
authorMichael Olbrich <m.olbrich@pengutronix.de>
Sun, 3 Feb 2019 09:52:02 +0000 (10:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Feb 2019 11:14:05 +0000 (12:14 +0100)
commit646876105fe1799355715839477958adf1d096fd
tree588b2ec86822e04dbd66c8c629b573a27dea799e
parenteca3d5d567fe3c85a10b22af2e2e8ba7e0dd480f
v4l_id: use device_caps if available

According to the specification[1] the 'capabilities' describe the physical
device as a whole and the 'device_caps' describe the current device node.
The existence of 'device_caps' is indicated by the V4L2_CAP_DEVICE_CAPS
capability flag.
Use the 'device_caps' if available to generate the correct
ID_V4L_CAPABILITIES for the current device node.

This is relevant for UVC devices with current kernels: Two /dev/videoX
devices exist for those. One for video and one for metadata. The
 V4L2_CAP_VIDEO_CAPTURE flag is present in the 'capabilities' for both
device nodes but only in the 'device_caps' of the video device node.

Without this, the ID_V4L_CAPABILITIES of the metadata device node
incorrectly contains 'capture'.

[1] https://www.linuxtv.org/downloads/v4l-dvb-apis-new/uapi/v4l/vidioc-querycap.html
src/udev/v4l_id/v4l_id.c