diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-05-07 23:53:20 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-15 15:43:06 +0400 |
commit | 6e6d76cdc541e28bf4f609141d76c488c6c0d263 (patch) | |
tree | 479d1c19b79849098e35b6e2f604794541f0fe0b /drivers/media/video/uvc | |
parent | 69ecdbac144147a80747914d9b6ea3472e2d93e7 (diff) | |
download | linux-6e6d76cdc541e28bf4f609141d76c488c6c0d263.tar.xz |
[media] v4l2-event: fix regression with initial event handling
If the V4L2_EVENT_SUB_FL_SEND_INITIAL was set, then the application expects
to receive an initial event of the initial value of the control.
However, commit c53c2549333b340e2662dc64ec81323476b69a97 that added the new
v4l2_subscribed_event_ops introduced a regression: while the code still queued
that initial event the __v4l2_event_queue_fh() function was modified to ignore
such requests if sev->elems was 0 (meaning that the event subscription wasn't
finished yet).
And sev->elems was only set to a non-zero value after the add operation
returned.
This patch fixes this by passing the elems value to the add function. Then the
add function can set it before queuing the initial event.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc')
-rw-r--r-- | drivers/media/video/uvc/uvc_ctrl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index 28363b72ff8a..f3bd66c500b6 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c @@ -1250,7 +1250,7 @@ static void uvc_ctrl_send_events(struct uvc_fh *handle, } } -static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev) +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); struct uvc_control_mapping *mapping; @@ -1278,6 +1278,9 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev) uvc_ctrl_fill_event(handle->chain, &ev, ctrl, mapping, val, changes); + /* Mark the queue as active, allowing this initial + event to be accepted. */ + sev->elems = elems; v4l2_event_queue_fh(sev->fh, &ev); } |