Message ID | 1440163169-18047-7-git-send-email-ricardo.ribalda@gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Laurent Pinchart |
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 1ZSmFl-0003Zs-CQ; Fri, 21 Aug 2015 15:21:05 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtp id 1ZSmFj-0007Gz-87; Fri, 21 Aug 2015 15:21:05 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753684AbbHUNTp (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Fri, 21 Aug 2015 09:19:45 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:33710 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753653AbbHUNTn (ORCPT <rfc822;linux-media@vger.kernel.org>); Fri, 21 Aug 2015 09:19:43 -0400 Received: by lbbsx3 with SMTP id sx3so43477494lbb.0; Fri, 21 Aug 2015 06:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TMLo3fwmbTWSChlJZJgP7zALZxJvePCAZeitYIZQRGQ=; b=YuGiD56O1t+P5xzVzyUu88dUMkUglmn/goFGff0goiUbqyN/oz+4vohzRwNn1MqlGx N44/BNYDvH7HK+OzxZTFgbECUjTDbLZjaU6uDzPhBaYwscyLR93fzt5pDSLZ9j8WdWhB bP0OfVmMT+YJUV6hk2lm1m9OUvUKS96wPO+Vsrm3J3DLTQp4PqDwTZSOqyJ+8LOfts3Y 7HwO/Xz0fZrjsfJNqD2D9C89GFTU0J2x/b5l0abj6H5B6ihCzw8POUpkZC1OP4UhBo8H kNCJjJb7S71F3kir5vFVHqKy/u8rnRRiUTVVT/iZ/hHaxIADgLmQX5pc+AzRgZwRFL0J 2+0Q== X-Received: by 10.152.5.228 with SMTP id v4mr7902463lav.36.1440163182000; Fri, 21 Aug 2015 06:19:42 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id ph4sm2293746lbb.3.2015.08.21.06.19.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 06:19:40 -0700 (PDT) From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>, Mike Isely <isely@pobox.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Hans Verkuil <hans.verkuil@cisco.com>, Steven Toth <stoth@kernellabs.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Vincent Palatin <vpalatin@chromium.org>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Subject: [PATCH v2 06/10] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL Date: Fri, 21 Aug 2015 15:19:25 +0200 Message-Id: <1440163169-18047-7-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1440163169-18047-1-git-send-email-ricardo.ribalda@gmail.com> References: <1440163169-18047-1-git-send-email-ricardo.ribalda@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: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.8.21.131817 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1700_1799 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, FROM_NAME_PHRASE 0, NO_URI_HTTPS 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_TO_X5 0, __PHISH_SPEAR_STRUCTURE_1 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __TO_MALFORMED_2 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' |
Commit Message
Ricardo Ribalda Delgado
Aug. 21, 2015, 1:19 p.m. UTC
This driver does not use the control infrastructure.
Add support for the new field which on structure
v4l2_ext_controls
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/media/usb/uvc/uvc_v4l2.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
Comments
Laurent, can you review this? Regards, Hans On 08/21/2015 03:19 PM, Ricardo Ribalda Delgado wrote: > This driver does not use the control infrastructure. > Add support for the new field which on structure > v4l2_ext_controls > > Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> > --- > drivers/media/usb/uvc/uvc_v4l2.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c > index 2764f43607c1..e6d3a1bcfa2f 100644 > --- a/drivers/media/usb/uvc/uvc_v4l2.c > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > @@ -980,6 +980,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, > struct uvc_fh *handle = fh; > struct uvc_video_chain *chain = handle->chain; > struct v4l2_ext_control *ctrl = ctrls->controls; > + struct v4l2_queryctrl qc; > unsigned int i; > int ret; > > @@ -988,7 +989,14 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, > return ret; > > for (i = 0; i < ctrls->count; ++ctrl, ++i) { > - ret = uvc_ctrl_get(chain, ctrl); > + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { > + qc.id = ctrl->id; > + ret = uvc_query_v4l2_ctrl(chain, &qc); > + if (!ret) > + ctrl->value = qc.default_value; > + } else > + ret = uvc_ctrl_get(chain, ctrl); > + > if (ret < 0) { > uvc_ctrl_rollback(handle); > ctrls->error_idx = i; > @@ -1010,6 +1018,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, > unsigned int i; > int ret; > > + /* Default value cannot be changed */ > + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) > + return -EINVAL; > + > ret = uvc_ctrl_begin(chain); > if (ret < 0) > return ret; > -- 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
On 09/04/15 12:56, Hans Verkuil wrote: > Laurent, can you review this? Ping! If I have an Ack on Monday at the latest, then I can make a pull request for this series before I leave for 2 1/2 weeks. Regards, Hans > > Regards, > > Hans > > On 08/21/2015 03:19 PM, Ricardo Ribalda Delgado wrote: >> This driver does not use the control infrastructure. >> Add support for the new field which on structure >> v4l2_ext_controls >> >> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> >> --- >> drivers/media/usb/uvc/uvc_v4l2.c | 14 +++++++++++++- >> 1 file changed, 13 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c >> index 2764f43607c1..e6d3a1bcfa2f 100644 >> --- a/drivers/media/usb/uvc/uvc_v4l2.c >> +++ b/drivers/media/usb/uvc/uvc_v4l2.c >> @@ -980,6 +980,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, >> struct uvc_fh *handle = fh; >> struct uvc_video_chain *chain = handle->chain; >> struct v4l2_ext_control *ctrl = ctrls->controls; >> + struct v4l2_queryctrl qc; >> unsigned int i; >> int ret; >> >> @@ -988,7 +989,14 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, >> return ret; >> >> for (i = 0; i < ctrls->count; ++ctrl, ++i) { >> - ret = uvc_ctrl_get(chain, ctrl); >> + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { >> + qc.id = ctrl->id; >> + ret = uvc_query_v4l2_ctrl(chain, &qc); >> + if (!ret) >> + ctrl->value = qc.default_value; >> + } else >> + ret = uvc_ctrl_get(chain, ctrl); >> + >> if (ret < 0) { >> uvc_ctrl_rollback(handle); >> ctrls->error_idx = i; >> @@ -1010,6 +1018,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, >> unsigned int i; >> int ret; >> >> + /* Default value cannot be changed */ >> + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) >> + return -EINVAL; >> + >> ret = uvc_ctrl_begin(chain); >> if (ret < 0) >> return ret; >> > -- 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
Hello Laurent Could you take a look to this patch. Thanks! On Thu, Sep 17, 2015 at 3:17 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote: > On 09/04/15 12:56, Hans Verkuil wrote: >> Laurent, can you review this? > > Ping! If I have an Ack on Monday at the latest, then I can make a pull request > for this series before I leave for 2 1/2 weeks. > > Regards, > > Hans > >> >> Regards, >> >> Hans >> >> On 08/21/2015 03:19 PM, Ricardo Ribalda Delgado wrote: >>> This driver does not use the control infrastructure. >>> Add support for the new field which on structure >>> v4l2_ext_controls >>> >>> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> >>> --- >>> drivers/media/usb/uvc/uvc_v4l2.c | 14 +++++++++++++- >>> 1 file changed, 13 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c >>> index 2764f43607c1..e6d3a1bcfa2f 100644 >>> --- a/drivers/media/usb/uvc/uvc_v4l2.c >>> +++ b/drivers/media/usb/uvc/uvc_v4l2.c >>> @@ -980,6 +980,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, >>> struct uvc_fh *handle = fh; >>> struct uvc_video_chain *chain = handle->chain; >>> struct v4l2_ext_control *ctrl = ctrls->controls; >>> + struct v4l2_queryctrl qc; >>> unsigned int i; >>> int ret; >>> >>> @@ -988,7 +989,14 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, >>> return ret; >>> >>> for (i = 0; i < ctrls->count; ++ctrl, ++i) { >>> - ret = uvc_ctrl_get(chain, ctrl); >>> + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { >>> + qc.id = ctrl->id; >>> + ret = uvc_query_v4l2_ctrl(chain, &qc); >>> + if (!ret) >>> + ctrl->value = qc.default_value; >>> + } else >>> + ret = uvc_ctrl_get(chain, ctrl); >>> + >>> if (ret < 0) { >>> uvc_ctrl_rollback(handle); >>> ctrls->error_idx = i; >>> @@ -1010,6 +1018,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, >>> unsigned int i; >>> int ret; >>> >>> + /* Default value cannot be changed */ >>> + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) >>> + return -EINVAL; >>> + >>> ret = uvc_ctrl_begin(chain); >>> if (ret < 0) >>> return ret; >>> >>
Hi Ricardo, Thank you for the patch. On Friday 21 August 2015 15:19:25 Ricardo Ribalda Delgado wrote: > This driver does not use the control infrastructure. > Add support for the new field which on structure > v4l2_ext_controls > > Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> > --- > drivers/media/usb/uvc/uvc_v4l2.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c > b/drivers/media/usb/uvc/uvc_v4l2.c index 2764f43607c1..e6d3a1bcfa2f 100644 > --- a/drivers/media/usb/uvc/uvc_v4l2.c > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > @@ -980,6 +980,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void > *fh, struct uvc_fh *handle = fh; > struct uvc_video_chain *chain = handle->chain; > struct v4l2_ext_control *ctrl = ctrls->controls; > + struct v4l2_queryctrl qc; > unsigned int i; > int ret; > > @@ -988,7 +989,14 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, > void *fh, return ret; > > for (i = 0; i < ctrls->count; ++ctrl, ++i) { > - ret = uvc_ctrl_get(chain, ctrl); > + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { > + qc.id = ctrl->id; > + ret = uvc_query_v4l2_ctrl(chain, &qc); The uvc_ctrl_begin() call above locks chain->ctrl_mutex, and uvc_query_v4l2_ctrl() will then try to acquire the same lock. That's not a good idea :-) I propose moving the ctrls->which check before the uvc_ctrl_begin() call and implement it as if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { for (i = 0; i < ctrls->count; ++ctrl, ++i) { struct v4l2_queryctrl qc = { .id = ctrl->id }; ret = uvc_query_v4l2_ctrl(chain, &qc); if (ret < 0) { ctrls->error_idx = i; return ret; } ctrl->value = qc.default_value; } return 0; } > + if (!ret) > + ctrl->value = qc.default_value; > + } else > + ret = uvc_ctrl_get(chain, ctrl); > + > if (ret < 0) { > uvc_ctrl_rollback(handle); > ctrls->error_idx = i; > @@ -1010,6 +1018,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh > *handle, unsigned int i; > int ret; > > + /* Default value cannot be changed */ > + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) > + return -EINVAL; > + > ret = uvc_ctrl_begin(chain); > if (ret < 0) > return ret;
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 2764f43607c1..e6d3a1bcfa2f 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -980,6 +980,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, struct uvc_fh *handle = fh; struct uvc_video_chain *chain = handle->chain; struct v4l2_ext_control *ctrl = ctrls->controls; + struct v4l2_queryctrl qc; unsigned int i; int ret; @@ -988,7 +989,14 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, return ret; for (i = 0; i < ctrls->count; ++ctrl, ++i) { - ret = uvc_ctrl_get(chain, ctrl); + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { + qc.id = ctrl->id; + ret = uvc_query_v4l2_ctrl(chain, &qc); + if (!ret) + ctrl->value = qc.default_value; + } else + ret = uvc_ctrl_get(chain, ctrl); + if (ret < 0) { uvc_ctrl_rollback(handle); ctrls->error_idx = i; @@ -1010,6 +1018,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, unsigned int i; int ret; + /* Default value cannot be changed */ + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) + return -EINVAL; + ret = uvc_ctrl_begin(chain); if (ret < 0) return ret;