From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
tfiga@chromium.org, senozhatsky@chromium.org, yunkec@google.com
Subject: Re: [PATCH v7 3/8] media: uvcvideo: Support minimum for V4L2_CTRL_TYPE_MENU
Date: Fri, 17 Jun 2022 16:49:48 +0300 [thread overview]
Message-ID: <YqyGfFK3UXhrBLwK@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220617103645.71560-4-ribalda@chromium.org>
Hi Ricardo,
Thank you for the patch.
On Fri, Jun 17, 2022 at 12:36:40PM +0200, Ricardo Ribalda wrote:
> Currently all mappings of type V4L2_CTRL_TYPE_MENU, have a minimum of 0,
> but there are some controls (limited powerline), that start with a value
> different than 0.
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 5 +++--
> drivers/media/usb/uvc/uvcvideo.h | 1 +
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 092decfdaa62..3b20b23abd1e 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -1144,7 +1144,7 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
>
> switch (mapping->v4l2_type) {
> case V4L2_CTRL_TYPE_MENU:
> - v4l2_ctrl->minimum = 0;
> + v4l2_ctrl->minimum = mapping->menu_min;
> v4l2_ctrl->maximum = mapping->menu_count - 1;
> v4l2_ctrl->step = 1;
>
> @@ -1264,7 +1264,8 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
> goto done;
> }
>
> - if (query_menu->index >= mapping->menu_count) {
> + if (query_menu->index < mapping->menu_min ||
> + query_menu->index >= mapping->menu_count) {
> ret = -EINVAL;
> goto done;
> }
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index fff5c5c99a3d..6ceb7f7b964d 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -254,6 +254,7 @@ struct uvc_control_mapping {
> u32 data_type;
>
> const struct uvc_menu_info *menu_info;
> + u32 menu_min;
> u32 menu_count;
That's a bit of a stop-gap measure, could we turn it into a bitmask
instead ?
>
> u32 master_id;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2022-06-17 13:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 10:36 [PATCH v7 0/8] uvcvideo: Fix handling of power_line_frequency Ricardo Ribalda
2022-06-17 10:36 ` [PATCH v7 1/8] media: uvcvideo: Add missing value for power_line_frequency Ricardo Ribalda
2022-06-17 10:36 ` [PATCH v7 2/8] media: uvcvideo: Add support for per-device control mapping overrides Ricardo Ribalda
2022-06-17 13:44 ` Laurent Pinchart
2022-06-17 14:07 ` Ricardo Ribalda
2022-06-17 14:40 ` kernel test robot
2022-06-30 11:07 ` Dan Carpenter
2022-06-30 23:16 ` Ricardo Ribalda
2022-07-01 2:31 ` [kbuild-all] " Philip Li
2022-07-01 7:26 ` Dan Carpenter
2022-06-17 10:36 ` [PATCH v7 3/8] media: uvcvideo: Support minimum for V4L2_CTRL_TYPE_MENU Ricardo Ribalda
2022-06-17 13:49 ` Laurent Pinchart [this message]
2022-06-17 13:55 ` Ricardo Ribalda
2022-06-17 14:11 ` Laurent Pinchart
2022-06-17 14:15 ` Ricardo Ribalda
2022-06-17 10:36 ` [PATCH v7 4/8] media: uvcvideo: Limit power line control for Quanta UVC Webcam Ricardo Ribalda
2022-06-17 14:01 ` Laurent Pinchart
2022-06-17 14:18 ` Ricardo Ribalda
2022-06-17 10:36 ` [PATCH v7 5/8] media: uvcvideo: Limit power line control for Chicony Easycamera Ricardo Ribalda
2022-06-17 10:36 ` [PATCH v7 6/8] " Ricardo Ribalda
2022-06-17 10:36 ` [PATCH v7 7/8] media: uvcvideo: Limit power line control for Quanta cameras Ricardo Ribalda
2022-06-17 10:36 ` [PATCH v7 8/8] media: uvcvideo: Limit power line control for Acer EasyCamera Ricardo Ribalda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YqyGfFK3UXhrBLwK@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
--cc=senozhatsky@chromium.org \
--cc=tfiga@chromium.org \
--cc=yunkec@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox