On Thu, Jan 03, 2008, Antoine Cellerier wrote:
> Since I don't know the uvcvideo control code really well I haven't
> started patching it yet and would like a confirmation from the gurus
> that I'm reading the spec correctly.
Ok, so here is a patch that "fixes" the problem as far as i can tell.
It involved:
1/ filling in the gaps in uvc_control_mappings so all the controls up to
V4L2_CID_PRIVATE_LAST are present. I looked up the controls in the
USB_Video_Class_1.1.pdf file. The only one which I can't figure out is
V4L2_CID_PANTILT_RESET, I don't understand why it even has a CID.
Of course I don't own a device implementing any of those new controls so
I haven't been able to try them out yet.
2/ adding code to return the control with V4L2_CTRL_FLAG_DISABLED set in
uvc_query_v4l2_ctrl() when uvc_find_control() failed.
Sorry if I got some of the code conventions wrong or something.
--
Antoine Cellerier
dionoea
Index: uvc_ctrl.c
===================================================================
--- uvc_ctrl.c (revision 159)
+++ uvc_ctrl.c (working copy)
@@ -142,6 +142,14 @@
},
{
.entity = UVC_GUID_UVC_CAMERA,
+ .selector = CT_FOCUS_RELATIVE_CONTROL,
+ .index = 6,
+ .size = 2,
+ .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
+ | UVC_CONTROL_RESTORE,
+ },
+ {
+ .entity = UVC_GUID_UVC_CAMERA,
.selector = CT_FOCUS_AUTO_CONTROL,
.index = 17,
.size = 1,
@@ -164,6 +172,14 @@
.flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
| UVC_CONTROL_RESTORE,
},
+ {
+ .entity = UVC_GUID_UVC_PROCESSING,
+ .selector = CT_PANTILT_RELATIVE_CONTROL,
+ .index = 14,
+ .size = 4,
+ .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
+ | UVC_CONTROL_GET_DEF | UVC_CONTROL_RESTORE,
+ },
};
static struct uvc_menu_info power_line_frequency_controls[] = {
@@ -326,6 +342,16 @@
.data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
},
{
+ .id = V4L2_CID_FOCUS_RELATIVE,
+ .name = "Focus (relative)",
+ .entity = UVC_GUID_UVC_CAMERA,
+ .selector = CT_FOCUS_RELATIVE_CONTROL,
+ .size = 8,
+ .offset = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
+ .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
+ },
+ {
.id = V4L2_CID_FOCUS_AUTO,
.name = "Focus, Auto",
.entity = UVC_GUID_UVC_CAMERA,
@@ -335,6 +361,36 @@
.v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
.data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
},
+ {
+ .id = V4L2_CID_PAN_RELATIVE,
+ .name = "Pan Relative",
+ .entity = UVC_GUID_UVC_CAMERA,
+ .selector = CT_PANTILT_RELATIVE_CONTROL,
+ .size = 8,
+ .offset = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
+ .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
+ },
+ {
+ .id = V4L2_CID_TILT_RELATIVE,
+ .name = "Tilt Relative",
+ .entity = UVC_GUID_UVC_CAMERA,
+ .selector = CT_PANTILT_RELATIVE_CONTROL,
+ .size = 8,
+ .offset = 2,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
+ .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
+ },
+ {
+ .id = V4L2_CID_PANTILT_RESET,
+ .name = "",//"Pan Tilt Reset",
+ .entity = UVC_GUID_UVC_CAMERA,
+ .selector = 0,//CT_PANTILT_RESET_CONTROL,
+ .size = 0,//16,
+ .offset = 0,
+ .v4l2_type = 0,//V4L2_CTRL_TYPE_INTEGER,
+ .data_type = 0,//UVC_CTRL_DATA_TYPE_UNSIGNED,
+ },
};
/* ------------------------------------------------------------------------
@@ -513,8 +569,18 @@
int ret;
ctrl = uvc_find_control(video, v4l2_ctrl->id, &mapping);
- if (ctrl == NULL)
+ if (ctrl == NULL) {
+ for( mapping = uvc_ctrl_mappings; mapping < uvc_ctrl_mappings+sizeof(uvc_ctrl_mappings)/sizeof(struct uvc_control_mapping); mapping++ ) {
+ if (mapping->id == v4l2_ctrl->id) {
+ v4l2_ctrl->id = mapping->id;
+ v4l2_ctrl->type = mapping->v4l2_type;
+ strncpy(v4l2_ctrl->name, mapping->name, sizeof v4l2_ctrl->name);
+ v4l2_ctrl->flags = V4L2_CTRL_FLAG_DISABLED;
+ return 0;
+ }
+ }
return -EINVAL;
+ }
v4l2_ctrl->id = mapping->id;
v4l2_ctrl->type = mapping->v4l2_type;
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel