diff mbox series

[09/10] media: uvcvideo: Do not create initial events for class ctrls

Message ID 20210311122040.1264410-11-ribalda@chromium.org
State New
Headers show
Series uvcvideo: Pass v4l2-compliance test | expand

Commit Message

Ricardo Ribalda March 11, 2021, 12:20 p.m. UTC
V4L2_CTRL_TYPE_CTRL_CLASS do not generate events.

Fixes v4l2-compliance:
Control ioctls (Input 0):
                fail: v4l2-test-controls.cpp(844): found event for control class 'User Controls'
        test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 273eccc136b8..433342efc63f 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1456,6 +1456,7 @@  static void uvc_ctrl_send_events(struct uvc_fh *handle,
 	}
 }
 
+static const u8 uvc_ctrl_class_guid[16] = UVC_GUID_CTRL_CLASS;
 static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)
 {
 	struct uvc_fh *handle = container_of(sev->fh, struct uvc_fh, vfh);
@@ -1474,7 +1475,8 @@  static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)
 	}
 
 	list_add_tail(&sev->node, &mapping->ev_subs);
-	if (sev->flags & V4L2_EVENT_SUB_FL_SEND_INITIAL) {
+	if ((sev->flags & V4L2_EVENT_SUB_FL_SEND_INITIAL) &&
+	    memcmp(ctrl->info.entity, uvc_ctrl_class_guid, 16)) {
 		struct v4l2_event ev;
 		u32 changes = V4L2_EVENT_CTRL_CH_FLAGS;
 		s32 val = 0;