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 <[email protected]>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
-- 
2.31.0.rc2.261.g7f71774620-goog

Reply via email to