Message ID | 163b1aee53fa78fe1a8d0b8bb7b0f7be1f1975c9.1718216718.git.soyer@irl.hu (mailing list archive) |
---|---|
State | New |
Delegated to: | Laurent Pinchart |
Headers |
Received: from sy.mirrors.kernel.org ([147.75.48.161]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <linux-media+bounces-13084-patchwork=linuxtv.org@vger.kernel.org>) id 1sHSmx-0002KT-2s for patchwork@linuxtv.org; Wed, 12 Jun 2024 18:33:40 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5D640B2674C for <patchwork@linuxtv.org>; Wed, 12 Jun 2024 18:33:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CDEC182482; Wed, 12 Jun 2024 18:31:34 +0000 (UTC) X-Original-To: linux-media@vger.kernel.org Received: from irl.hu (irl.hu [95.85.9.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEF6257C8A; Wed, 12 Jun 2024 18:31:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.85.9.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718217094; cv=none; b=hOOzmAK2PcG5O6cdsqg2X/6BE7j/QBsnwuBUDSDVj3Qsm1HzEejU9w4Hb04BL2iuZ5Nqm4ai9TcPsHKx5DimnxCH/uEC0IESZ6rjrIGVU7hfLv88lUL9EaVVg6AiM4hnyuChpojF/dyLNFi0QcbKogzfJGpPmD7efwDj5VGiFlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718217094; c=relaxed/simple; bh=ESjmU9gJ2L1QxdyTF1ckdrrFop0h+nJAejCPZh5QRfI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Mime-Version:Content-Type; b=ixbUW1qv+mDrPNb6abNkutnJ0kuL7NrKMcmdCpWsDz0WIs6/LfHkU884UDBoCKFQzoSA6Em2XcmqD9CyjRwf6BVWWwkeIK1JKKsj80BbCq1fZf0pEkDZHwTFvaUBGRyavqDtQEt2yD9pLiwX8nHoh1F93meCk1zTbpGZXXZsbqU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=irl.hu; spf=pass smtp.mailfrom=irl.hu; arc=none smtp.client-ip=95.85.9.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=irl.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=irl.hu Received: from fedori.lan (c3e47615.dsl.pool.telekom.hu [::ffff:195.228.118.21]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 0000000000070666.000000006669E982.0016B24C; Wed, 12 Jun 2024 20:31:29 +0200 From: Gergo Koteles <soyer@irl.hu> To: Mauro Carvalho Chehab <mchehab@kernel.org>, Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Gergo Koteles <soyer@irl.hu> Subject: [PATCH 2/2] media: v4l2: map UVC_CT_ROLL_ABSOLUTE_CONTROL Date: Wed, 12 Jun 2024 20:31:14 +0200 Message-ID: <163b1aee53fa78fe1a8d0b8bb7b0f7be1f1975c9.1718216718.git.soyer@irl.hu> X-Mailer: git-send-email 2.45.2 In-Reply-To: <cover.1718216718.git.soyer@irl.hu> References: <cover.1718216718.git.soyer@irl.hu> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Mime-Autoconverted: from 8bit to 7bit by courier 1.0 X-LSpam-Score: -1.6 (-) X-LSpam-Report: No, score=-1.6 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DMARC_NONE=0.898,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=no autolearn_force=no |
Series |
media: v4l2: map UVC_CT_ROLL_ABSOLUTE_CONTROL
|
|
Commit Message
Gergo Koteles
June 12, 2024, 6:31 p.m. UTC
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.
Map UVC_CT_ROLL_ABSOLUTE_CONTROL to V4L2_CID_ROLL_ABSOLUTE to
make it available to userspace.
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
drivers/media/usb/uvc/uvc_ctrl.c | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
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@irl.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 = {
Hi Laurent, On Wed, 2024-06-12 at 23:31 +0300, Laurent Pinchart wrote: > 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 ? The SET_CUR of UVC_CT_ROLL_ABSOLUTE_CONTROL is optional, so I think it's for reporting also. The cameras I've tested before can't roll the sensor, they only report the angle/orientation. Yes, I was thinking to support the mounting orientation report, however I tried a friend's DJI Osmo Pocket 3, which can roll the sensor in +- 30˚ with ROLL_ABSOLUTE UVC control. It can also be Panned/Tilted/Zoomed, very cool. I think mapping UVC_CT_ROLL_ABSOLUTE_CONTROL to V4L2_CID_ROLL_ABSOLUTE would be useful. I can reword the commit message a bit if you'd like. > > 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. > I can also create a quirk for the other two cameras to map UVC_CT_ROLL_ABSOLUTE_CONTROL to V4L2_CID_CAMERA_SENSOR_ROTATION. Maybe it can be detected if CT_ROLL_ABSOLUTE_CONTROL doesn't have SET_CUR, default 0, step 90. > Best regards, Gergo
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 = {