[media] v4l2-ctrls: don't initially set CH_VALUE for write-only controls
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 14 Jun 2011 05:42:45 +0000 (02:42 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:53:31 +0000 (17:53 -0300)
When sending the SEND_INITIAL event for write-only controls the
V4L2_EVENT_CTRL_CH_VALUE flag should not be set. It's meaningless.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-ctrls.c

index a37e5bff4342b0bf0f3ea158e3e380ae7346f4c9..8fb020dd567bab11f7a258e3337de5e1585bc3a5 100644 (file)
@@ -2033,9 +2033,11 @@ void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
        if (ctrl->type != V4L2_CTRL_TYPE_CTRL_CLASS &&
            (sev->flags & V4L2_EVENT_SUB_FL_SEND_INITIAL)) {
                struct v4l2_event ev;
+               u32 changes = V4L2_EVENT_CTRL_CH_FLAGS;
 
-               fill_event(&ev, ctrl, V4L2_EVENT_CTRL_CH_VALUE |
-                       V4L2_EVENT_CTRL_CH_FLAGS);
+               if (!(ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY))
+                       changes |= V4L2_EVENT_CTRL_CH_VALUE;
+               fill_event(&ev, ctrl, changes);
                v4l2_event_queue_fh(sev->fh, &ev);
        }
        v4l2_ctrl_unlock(ctrl);