V4L/DVB: uvcvideo: Make button controls work properly
authorHans de Goede <hdegoede@redhat.com>
Wed, 19 May 2010 23:15:00 +0000 (20:15 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 2 Aug 2010 18:33:25 +0000 (15:33 -0300)
According to the v4l2 spec, writing any value to a button control should
result in the action belonging to the button control being triggered.
UVC cams however want to see a 1 written, this patch fixes this by
overriding whatever value user space passed in with -1 (0xffffffff) when
the control is a button control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_ctrl.c

index fcfcfbce0a2d199bdfb846298086f0ed931948df..4e6d484911fe30eb1319a157d284d8b056c20d46 100644 (file)
@@ -698,6 +698,14 @@ static void uvc_set_le_value(struct uvc_control_mapping *mapping,
        int offset = mapping->offset;
        __u8 mask;
 
+       /* According to the v4l2 spec, writing any value to a button control
+        * should result in the action belonging to the button control being
+        * triggered. UVC devices however want to see a 1 written -> override
+        * value.
+        */
+       if (mapping->v4l2_type == V4L2_CTRL_TYPE_BUTTON)
+               value = -1;
+
        data += offset / 8;
        offset &= 7;