[RFCv1 PATCH 8/9] vivi: add support for CTRL_CH_STATE events.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
---
 drivers/media/video/v4l2-event.c |    6 ++++--
 drivers/media/video/vivi.c       |    8 ++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/v4l2-event.c b/drivers/media/video/v4l2-event.c
index c9251a5..9b503aa 100644
--- a/drivers/media/video/v4l2-event.c
+++ b/drivers/media/video/v4l2-event.c
@@ -258,7 +258,8 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
 		return -ENOMEM;
 	}
 
-	if (sub->type == V4L2_EVENT_CTRL_CH_VALUE) {
+	if (sub->type == V4L2_EVENT_CTRL_CH_VALUE ||
+			sub->type == V4L2_EVENT_CTRL_CH_STATE) {
 		ctrl = v4l2_ctrl_find(fh->ctrl_handler, sub->id);
 		if (ctrl == NULL)
 			return -EINVAL;
@@ -341,7 +342,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
 		list_del(&sev->list);
 
 	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
-	if (sev->type == V4L2_EVENT_CTRL_CH_VALUE) {
+	if (sev->type == V4L2_EVENT_CTRL_CH_VALUE ||
+			sev->type == V4L2_EVENT_CTRL_CH_STATE) {
 		struct v4l2_ctrl *ctrl = v4l2_ctrl_find(fh->ctrl_handler, sev->id);
 
 		if (ctrl)
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 8790e03..a8d91ce 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -987,9 +987,13 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
 static int vidioc_subscribe_event(struct v4l2_fh *fh,
 				struct v4l2_event_subscription *sub)
 {
-	if (sub->type != V4L2_EVENT_CTRL_CH_VALUE)
+	switch (sub->type) {
+	case V4L2_EVENT_CTRL_CH_VALUE:
+	case V4L2_EVENT_CTRL_CH_STATE:
+		return v4l2_event_subscribe(fh, sub);
+	default:
 		return -EINVAL;
-	return v4l2_event_subscribe(fh, sub);
+	}
 }
 
 /* --- controls ---------------------------------------------- */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux