Skip to contentSkip to conversation

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

RFC PATCH Superseded Kim, HeungJun 2 participants 4 messages Feb 25, 2011 – Feb 28, 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.

---
 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..b98b9f1 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[] = {
+	{ 1, "Auto Mode" },
+	{ 0, "Manual 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
#1 lore raw

Hi,

Quoted 14 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.

---
 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..b98b9f1 100644

drivers/media/video/uvc/uvc_ctrl.c static struct uvc_menu_info exposure_auto_controls[] = · line 338

Quoted 6 lines
drivers/media/video/uvc/uvc_ctrl.c +3 -0
@@ -333,6 +333,11 @@ static struct uvc_menu_info exposure_auto_controls[] =
 { { 8, "Aperture Priority Mode" },
 };
 
+static struct uvc_menu_info focus_auto_controls[] = {
+	{ 1, "Auto Mode" },
+	{ 0, "Manual Mode" },

Now that manual focus has value 0 and auto focus value 1, the menu entries need to be the other way around.

Quoted 17 lines
drivers/media/video/uvc/uvc_ctrl.c +5 -1
+};
+
 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,

2011-02-25 오후 9:58, Laurent Pinchart 쓴 글:

Quoted 20 lines

Hi,

Quoted 17 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.

---
 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..b98b9f1 100644

drivers/media/video/uvc/uvc_ctrl.c +0 -0
@@ -333,6 +333,11 @@ static struct uvc_menu_info exposure_auto_controls[] =
 { { 8, "Aperture Priority Mode" },
 };
 
Quoted 6 lines

drivers/media/video/uvc/uvc_ctrl.c static struct uvc_menu_info exposure_auto_controls[] = { · line 338

Quoted 3 lines
drivers/media/video/uvc/uvc_ctrl.c +3 -0
+static struct uvc_menu_info focus_auto_controls[] = {
+	{ 1, "Auto Mode" },
+	{ 0, "Manual Mode" },

Now that manual focus has value 0 and auto focus value 1, the menu entries need to be the other way around.

I don't really get it. My understanding is that your words are structure uvc_menu_info should be changed as fitted to focus menu type. right? But, I thinks they don't need to be changed, and I don't find wrong, I don't know how to fix what you telling me exactly.

So, could you explain more details? Some examples helps to me.

Sorry to bother if you are busy, but it's good for me your advice. I'll waiting.

Thanks and Regards,
Heungjun Kim

#3 lore raw

Hi,

Quoted 28 lines · HeungJun

2011-02-25 오후 9:58, Laurent Pinchart 쓴 글:

Quoted 18 lines · HeungJun
Quoted 17 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.

---

 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..b98b9f1 100644

drivers/media/video/uvc/uvc_ctrl.c +0 -0
@@ -333,6 +333,11 @@ static struct uvc_menu_info
 exposure_auto_controls[] = { { 8, "Aperture Priority Mode" },
 
Quoted 8 lines

drivers/media/video/uvc/uvc_ctrl.c static struct uvc_menu_info exposure_auto_controls[] = { · line 338

Quoted 5 lines
drivers/media/video/uvc/uvc_ctrl.c +3 -0
 };
 
+static struct uvc_menu_info focus_auto_controls[] = {
+	{ 1, "Auto Mode" },
+	{ 0, "Manual Mode" },

Now that manual focus has value 0 and auto focus value 1, the menu entries need to be the other way around.

Quoted 6 lines

I don't really get it. My understanding is that your words are structure uvc_menu_info should be changed as fitted to focus menu type. right? But, I thinks they don't need to be changed, and I don't find wrong, I don't know how to fix what you telling me exactly.

So, could you explain more details? Some examples helps to me.

The menu entries are indexed by the V4L2 menu value. The first field is the UVC menu entry value, and the second field its name. As the V4L2 manual focus control has a value of 0, it must be the first entry.

Quoted 2 lines

Sorry to bother if you are busy, but it's good for me your advice. I'll waiting.

No worries.

Signature · 3 lines
Regards,

Laurent Pinchart