Message ID | 1323011776-15967-3-git-send-email-snjw23@gmail.com (mailing list archive) |
---|---|
State | RFC, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1RXDo7-0005O7-Ch; Sun, 04 Dec 2011 16:17:11 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp id 1RXDo6-0001eq-IJ; Sun, 04 Dec 2011 16:16:47 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754173Ab1LDPQn (ORCPT <rfc822;hunold@linuxtv.org> + 4 others); Sun, 4 Dec 2011 10:16:43 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:35399 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754073Ab1LDPQm (ORCPT <rfc822; linux-media@vger.kernel.org>); Sun, 4 Dec 2011 10:16:42 -0500 Received: by mail-ww0-f44.google.com with SMTP id dr13so5379144wgb.1 for <linux-media@vger.kernel.org>; Sun, 04 Dec 2011 07:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=W+IN3h6F4PPaZdo37qIxtGme30rpje6XoB6/NlhLLrY=; b=FUJtUcaCSFYa2ZzSit+JBan2Yfts6/H1MkxZtkdQf06BbUlrVWnCrY38JJmIfVTYOH 2R+VtW49IASRx4kOqkrBsAoHEKK7WhDdJyDbzuE/4gxWh/MNMSamttwAan0jQj50H8yP rWVCppHvQuv64SJU92xTuy73+xEMac6lmkvIc= Received: by 10.180.102.233 with SMTP id fr9mr8507714wib.40.1323011802037; Sun, 04 Dec 2011 07:16:42 -0800 (PST) Received: from localhost.localdomain (84-dzi-26.acn.waw.pl. [85.222.29.84]) by mx.google.com with ESMTPS id 28sm19857228wby.3.2011.12.04.07.16.40 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 04 Dec 2011 07:16:41 -0800 (PST) From: Sylwester Nawrocki <snjw23@gmail.com> To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, sakari.ailus@iki.fi, hverkuil@xs4all.nl, riverful.kim@samsung.com, s.nawrocki@samsung.com, Kyungmin Park <kyungmin.park@samsung.com> Subject: [RFC/PATCH 2/5] uvc: Adapt the driver to new type of V4L2_CID_FOCUS_AUTO control Date: Sun, 4 Dec 2011 16:16:13 +0100 Message-Id: <1323011776-15967-3-git-send-email-snjw23@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1323011776-15967-1-git-send-email-snjw23@gmail.com> References: <1323011776-15967-1-git-send-email-snjw23@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.12.4.150315 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' X-LSpam-Score: -4.2 (----) X-LSpam-Report: No, score=-4.2 required=5.0 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_MED=-2.3, T_DKIM_INVALID=0.01 autolearn=ham |
Commit Message
Sylwester Nawrocki
Dec. 4, 2011, 3:16 p.m. UTC
From: Heungjun Kim <riverful.kim@samsung.com> The V4L2_CID_FOCUS_AUTO control has been converted from boolean type, where control's value 0 and 1 were corresponding to manual and automatic focus respectively, to menu type with following menu items: 0 - V4L2_FOCUS_MANUAL, 1 - V4L2_FOCUS_AUTO, 2 - V4L2_FOCUS_AUTO_MACRO, 3 - V4L2_FOCUS_AUTO_CONTINUOUS. According to this change the uvc control mappings are modified to retain original sematics, where 0 corresponds to manual and 1 to auto focus. Signed-off-by: Heungjun Kim <riverful.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> --- The V4L2_CID_FOCUS_AUTO control in V4L2_FOCUS_AUTO mode does only a one-shot auto focus, when switched from V4L2_FOCUS_MANUAL. It might be worth to implement also the V4L2_CID_DO_AUTO_FOCUS button control in uvc, however I didn't take time yet to better understand the driver and add this. I also don't have any uvc hardware to test this patch so it's just compile tested. --- drivers/media/video/uvc/uvc_ctrl.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
Comments
Hi Sylwester and Heungjun, On Sunday 04 December 2011 16:16:13 Sylwester Nawrocki wrote: > From: Heungjun Kim <riverful.kim@samsung.com> > > The V4L2_CID_FOCUS_AUTO control has been converted from boolean type, > where control's value 0 and 1 were corresponding to manual and automatic > focus respectively, to menu type with following menu items: > 0 - V4L2_FOCUS_MANUAL, > 1 - V4L2_FOCUS_AUTO, > 2 - V4L2_FOCUS_AUTO_MACRO, > 3 - V4L2_FOCUS_AUTO_CONTINUOUS. > > According to this change the uvc control mappings are modified to retain > original sematics, where 0 corresponds to manual and 1 to auto focus. UVC auto-focus works in continuous mode, not single-shot mode. As the existing V4L2_CID_FOCUS_AUTO uses 0 to mean manual focus and 1 to mean continuous auto- focus, shouldn't this patch set define the following values instead ? 0 - V4L2_FOCUS_MANUAL 1 - V4L2_FOCUS_AUTO 2 - V4L2_FOCUS_AUTO_MACRO 3 - V4L2_FOCUS_AUTO_SINGLE_SHOT V4L2_FOCUS_AUTO_SINGLE_SHOT could also be named V4L2_FOCUS_SINGLE_SHOT. > Signed-off-by: Heungjun Kim <riverful.kim@samsung.com> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> > Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> > > --- > The V4L2_CID_FOCUS_AUTO control in V4L2_FOCUS_AUTO mode does only > a one-shot auto focus, when switched from V4L2_FOCUS_MANUAL. > It might be worth to implement also the V4L2_CID_DO_AUTO_FOCUS button > control in uvc, however I didn't take time yet to better understand > the driver and add this. I also don't have any uvc hardware to test > this patch so it's just compile tested. > --- > drivers/media/video/uvc/uvc_ctrl.c | 9 ++++++++- > 1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/drivers/media/video/uvc/uvc_ctrl.c > b/drivers/media/video/uvc/uvc_ctrl.c index 254d326..6860ca1 100644 > --- a/drivers/media/video/uvc/uvc_ctrl.c > +++ b/drivers/media/video/uvc/uvc_ctrl.c > @@ -365,6 +365,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) > { > @@ -592,8 +597,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,
Hi Laurent, On 12/06/2011 01:26 PM, Laurent Pinchart wrote: > On Sunday 04 December 2011 16:16:13 Sylwester Nawrocki wrote: >> From: Heungjun Kim <riverful.kim@samsung.com> >> >> The V4L2_CID_FOCUS_AUTO control has been converted from boolean type, >> where control's value 0 and 1 were corresponding to manual and automatic >> focus respectively, to menu type with following menu items: >> 0 - V4L2_FOCUS_MANUAL, >> 1 - V4L2_FOCUS_AUTO, >> 2 - V4L2_FOCUS_AUTO_MACRO, >> 3 - V4L2_FOCUS_AUTO_CONTINUOUS. >> >> According to this change the uvc control mappings are modified to retain >> original sematics, where 0 corresponds to manual and 1 to auto focus. > > UVC auto-focus works in continuous mode, not single-shot mode. As the existing Hmm, I suspected that. > V4L2_CID_FOCUS_AUTO uses 0 to mean manual focus and 1 to mean continuous auto- > focus, shouldn't this patch set define the following values instead ? > > 0 - V4L2_FOCUS_MANUAL > 1 - V4L2_FOCUS_AUTO > 2 - V4L2_FOCUS_AUTO_MACRO > 3 - V4L2_FOCUS_AUTO_SINGLE_SHOT It's not that bad, at least we would not have changed the existing ABI. It depends how other focus modes are defined, e.g. V4L2_FOCUS_AUTO_MACRO. There is also an auto focus driven by face detection module output. The question would be whether we want to append _SINGLE_SHOT or _CONTINUOUS to the names. And if most of the focus modes are single-shot we will probably need a common "do auto-focus" control for them. What do you think about such assignment: 0 - V4L2_FOCUS_MANUAL, 1 - V4L2_FOCUS_AUTO_CONTINUOUS, 2 - V4L2_FOCUS_AUTO, 3 - V4L2_FOCUS_AUTO_MACRO, ? I'm not 100% sure right now, but the macro and "face detection" are rather "single-shot". Single-shot focus might be more common. Perhaps someone else can put more light on that :-) Using a "single-shot notation" we might have something like: 0 - V4L2_FOCUS_MANUAL, 1 - V4L2_FOCUS_AUTO, 2 - V4L2_FOCUS_AUTO_SINGLE_SHOT, 3 - V4L2_FOCUS_AUTO_MACRO_SINGLE_SHOT, 3 - V4L2_FOCUS_AUTO_FACE_DETECTION_SINGLE_SHOT, I'm not sure if this convention is the best one. Alternatively we could define a "do-focus" control for each mode, but then these controls have to be properly coordinated, for exclusive operation. > > V4L2_FOCUS_AUTO_SINGLE_SHOT could also be named V4L2_FOCUS_SINGLE_SHOT. > >> Signed-off-by: Heungjun Kim <riverful.kim@samsung.com> >> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> >> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> >> >> --- >> The V4L2_CID_FOCUS_AUTO control in V4L2_FOCUS_AUTO mode does only >> a one-shot auto focus, when switched from V4L2_FOCUS_MANUAL. >> It might be worth to implement also the V4L2_CID_DO_AUTO_FOCUS button >> control in uvc, however I didn't take time yet to better understand >> the driver and add this. I also don't have any uvc hardware to test >> this patch so it's just compile tested. >> --- >> drivers/media/video/uvc/uvc_ctrl.c | 9 ++++++++- >> 1 files changed, 8 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/media/video/uvc/uvc_ctrl.c >> b/drivers/media/video/uvc/uvc_ctrl.c index 254d326..6860ca1 100644 >> --- a/drivers/media/video/uvc/uvc_ctrl.c >> +++ b/drivers/media/video/uvc/uvc_ctrl.c >> @@ -365,6 +365,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" }, Do you think it could be better to change this to: + { 0, "Manual Focus" }, + { 1, "Continuous Auto Focus" }, ? -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index 254d326..6860ca1 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c @@ -365,6 +365,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) { @@ -592,8 +597,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,