Skip to contentSkip to conversation

v4l2-ctrls: modify uvc driver to use new menu type of V4L2_CID_FOCUS_AUTO

RFC PATCH In review Kim, HeungJun 3 participants 4 messages Mar 3, 2011 – Mar 22, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 2/3 v4l2-ctrls: modify uvc driver to use new menu type of V4L2_CID_FOCUS_AUTO

As following to change the boolean type of V4L2_CID_FOCUS_AUTO to menu type, this uvc is modified the usage of V4L2_CID_FOCUS_AUTO, maintaining v4l2 menu index.

---
 drivers/media/video/uvc/uvc_ctrl.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/media/video/uvc/uvc_ctrl.c +8 -1
index 59f8a9a..064827f 100644
@@ -333,6 +333,11 @@ static struct uvc_menu_info exposure_auto_controls[] = {
 	{ 8, "Aperture Priority Mode" },
 };
 
+static struct uvc_menu_info focus_auto_controls[] = {
+	{ 0, "Manual Mode" },
+	{ 1, "Auto Mode" },
+};
+
 static __s32 uvc_ctrl_get_zoom(struct uvc_control_mapping *mapping,
 	__u8 query, const __u8 *data)
 {
@@ -560,8 +565,10 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
 		.selector	= UVC_CT_FOCUS_AUTO_CONTROL,
 		.size		= 1,
 		.offset		= 0,
-		.v4l2_type	= V4L2_CTRL_TYPE_BOOLEAN,
+		.v4l2_type	= V4L2_CTRL_TYPE_MENU,
 		.data_type	= UVC_CTRL_DATA_TYPE_BOOLEAN,
+		.menu_info	= focus_auto_controls,
+		.menu_count	= ARRAY_SIZE(focus_auto_controls),
 	},
 	{
 		.id		= V4L2_CID_IRIS_ABSOLUTE,
Signature · 1 line
1.7.0.4
Acked-by on v2 2/3
#1 lore raw
Quoted 6 lines · HeungJun

As following to change the boolean type of V4L2_CID_FOCUS_AUTO to menu type, this uvc is modified the usage of V4L2_CID_FOCUS_AUTO, maintaining v4l2 menu index.

Quoted 32 lines
---
 drivers/media/video/uvc/uvc_ctrl.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/media/video/uvc/uvc_ctrl.c index 59f8a9a..064827f 100644

drivers/media/video/uvc/uvc_ctrl.c +8 -1
@@ -333,6 +333,11 @@ static struct uvc_menu_info exposure_auto_controls[] =
 { { 8, "Aperture Priority Mode" },
 };
 
+static struct uvc_menu_info focus_auto_controls[] = {
+	{ 0, "Manual Mode" },
+	{ 1, "Auto Mode" },
+};
+
 static __s32 uvc_ctrl_get_zoom(struct uvc_control_mapping *mapping,
 	__u8 query, const __u8 *data)
 {
@@ -560,8 +565,10 @@ static struct uvc_control_mapping uvc_ctrl_mappings[]
 = { .selector	= UVC_CT_FOCUS_AUTO_CONTROL,
 		.size		= 1,
 		.offset		= 0,
-		.v4l2_type	= V4L2_CTRL_TYPE_BOOLEAN,
+		.v4l2_type	= V4L2_CTRL_TYPE_MENU,
 		.data_type	= UVC_CTRL_DATA_TYPE_BOOLEAN,
+		.menu_info	= focus_auto_controls,
+		.menu_count	= ARRAY_SIZE(focus_auto_controls),
 	},
 	{
 		.id		= V4L2_CID_IRIS_ABSOLUTE,
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi Laurent,

Em 03-03-2011 07:10, Laurent Pinchart escreveu:

Quoted 9 lines · HeungJun
Quoted 6 lines

As following to change the boolean type of V4L2_CID_FOCUS_AUTO to menu type, this uvc is modified the usage of V4L2_CID_FOCUS_AUTO, maintaining v4l2 menu index.

I'm assuming that you'll be applying those patches on your tree and sending me a pull request, right?

Thanks!
Mauro

Quoted 34 lines
Quoted 33 lines
---
 drivers/media/video/uvc/uvc_ctrl.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/media/video/uvc/uvc_ctrl.c index 59f8a9a..064827f 100644

drivers/media/video/uvc/uvc_ctrl.c +8 -1
@@ -333,6 +333,11 @@ static struct uvc_menu_info exposure_auto_controls[] =
 { { 8, "Aperture Priority Mode" },
 };
 
+static struct uvc_menu_info focus_auto_controls[] = {
+	{ 0, "Manual Mode" },
+	{ 1, "Auto Mode" },
+};
+
 static __s32 uvc_ctrl_get_zoom(struct uvc_control_mapping *mapping,
 	__u8 query, const __u8 *data)
 {
@@ -560,8 +565,10 @@ static struct uvc_control_mapping uvc_ctrl_mappings[]
 = { .selector	= UVC_CT_FOCUS_AUTO_CONTROL,
 		.size		= 1,
 		.offset		= 0,
-		.v4l2_type	= V4L2_CTRL_TYPE_BOOLEAN,
+		.v4l2_type	= V4L2_CTRL_TYPE_MENU,
 		.data_type	= UVC_CTRL_DATA_TYPE_BOOLEAN,
+		.menu_info	= focus_auto_controls,
+		.menu_count	= ARRAY_SIZE(focus_auto_controls),
 	},
 	{
 		.id		= V4L2_CID_IRIS_ABSOLUTE,
#3 lore raw

Hi Mauro,

Quoted 6 lines · On Tuesday 22 March 2011 01:27:44 Mauro Carvalho Chehab wrote:

Em 03-03-2011 07:10, Laurent Pinchart escreveu:

Quoted 5 lines · HeungJun
Quoted 4 lines

As following to change the boolean type of V4L2_CID_FOCUS_AUTO to menu type, this uvc is modified the usage of V4L2_CID_FOCUS_AUTO, maintaining v4l2 menu index.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I'm assuming that you'll be applying those patches on your tree and sending me a pull request, right?

The patch depends on other V4L2 core patches in the same series, so I wasn't planning to push it through my tree, but it can be done. There are still issues with this series though, as we haven't reached an agreement on the auto-focus ABI yet.

Signature · 3 lines
Regards,

Laurent Pinchart