media: uvcvideo: Fix handling on Bitmask controls
authorRicardo Ribalda <ribalda@chromium.org>
Tue, 3 Jan 2023 14:36:23 +0000 (15:36 +0100)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 15 Jan 2023 21:45:12 +0000 (23:45 +0200)
commit7faf8ae4277156da32eada72c07f5edeb82cd9e4
tree39dd148352c6e05a202737801a1683be08a32ef7
parenta763b9fb58be869e252a7d33acb0a6390b01c801
media: uvcvideo: Fix handling on Bitmask controls

Minimum and step values for V4L2_CTRL_TYPE_BITMASK controls should be 0.
There is no need to query the camera firmware about this and maybe get
invalid results.

Also value should be masked to the max value advertised by the
hardware.

Finally, handle UVC 1.5 mask controls that use MAX instead of RES to
describe the valid bits.

Fixes v4l2-compliane:
Control ioctls (Input 0):
                fail: v4l2-test-controls.cpp(97): minimum must be 0 for a bitmask control
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/media/usb/uvc/uvc_ctrl.c