[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240612203124.GU28989@pendragon.ideasonboard.com>
Date: Wed, 12 Jun 2024 23:31:24 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Gergo Koteles <soyer@....hu>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] media: v4l2: map UVC_CT_ROLL_ABSOLUTE_CONTROL
On Wed, Jun 12, 2024 at 08:31:14PM +0200, Gergo Koteles wrote:
> Some new UVC cameras can report whether they are mounted in 'portrait
> mode'.
>
> Current roll degrees (-90, 0, 90, 180) are reported with
> UVC_CT_ROLL_ABSOLUTE_CONTROL.
UVC_CT_ROLL_ABSOLUTE_CONTROL is about controlling the motion of the
camera along the roll axis, while this patch series sounds like you want
to support reporting the mounting orientation of the device, not cause
the device to rotate. Is that right ?
If that's the case, the right V4L2 control to use would be
V4L2_CID_CAMERA_SENSOR_ROTATION. Mapping it to
UVC_CT_ROLL_ABSOLUTE_CONTROL is problematic though, as
UVC_CT_ROLL_ABSOLUTE_CONTROL is not meant for this in the UVC spec. We
would likely need a quirk to control how it gets used.
> Map UVC_CT_ROLL_ABSOLUTE_CONTROL to V4L2_CID_ROLL_ABSOLUTE to
> make it available to userspace.
>
> Signed-off-by: Gergo Koteles <soyer@....hu>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 4b685f883e4d..bc3272b6ceb1 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -748,6 +748,15 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
> .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
> .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
> },
> + {
> + .id = V4L2_CID_ROLL_ABSOLUTE,
> + .entity = UVC_GUID_UVC_CAMERA,
> + .selector = UVC_CT_ROLL_ABSOLUTE_CONTROL,
> + .size = 16,
> + .offset = 0,
> + .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
> + .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
> + },
> };
>
> const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists