]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/media/video/uvc/uvc_ctrl.c
V4L/DVB: uvcvideo: Make button controls work properly
[mv-sheeva.git] / drivers / media / video / uvc / uvc_ctrl.c
index aa0720af07a0e78abadd83a2eb8d79ba55b3560e..4e6d484911fe30eb1319a157d284d8b056c20d46 100644 (file)
@@ -122,8 +122,8 @@ static struct uvc_control_info uvc_ctrls[] = {
                .selector       = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
                .index          = 10,
                .size           = 1,
-               .flags          = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
-                               | UVC_CONTROL_RESTORE,
+               .flags          = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
+                               | UVC_CONTROL_GET_DEF | UVC_CONTROL_RESTORE,
        },
        {
                .entity         = UVC_GUID_UVC_PROCESSING,
@@ -605,6 +605,26 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
                .get            = uvc_ctrl_get_zoom,
                .set            = uvc_ctrl_set_zoom,
        },
+       {
+               .id             = V4L2_CID_PAN_ABSOLUTE,
+               .name           = "Pan (Absolute)",
+               .entity         = UVC_GUID_UVC_CAMERA,
+               .selector       = UVC_CT_PANTILT_ABSOLUTE_CONTROL,
+               .size           = 32,
+               .offset         = 0,
+               .v4l2_type      = V4L2_CTRL_TYPE_INTEGER,
+               .data_type      = UVC_CTRL_DATA_TYPE_UNSIGNED,
+       },
+       {
+               .id             = V4L2_CID_TILT_ABSOLUTE,
+               .name           = "Tilt (Absolute)",
+               .entity         = UVC_GUID_UVC_CAMERA,
+               .selector       = UVC_CT_PANTILT_ABSOLUTE_CONTROL,
+               .size           = 32,
+               .offset         = 32,
+               .v4l2_type      = V4L2_CTRL_TYPE_INTEGER,
+               .data_type      = UVC_CTRL_DATA_TYPE_UNSIGNED,
+       },
        {
                .id             = V4L2_CID_PRIVACY,
                .name           = "Privacy",
@@ -678,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;