linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gergo Koteles <soyer@irl.hu>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Ricardo Ribalda <ribalda@chromium.org>
Cc: linux-media@vger.kernel.org, Gergo Koteles <soyer@irl.hu>
Subject: [PATCH v2] media: uvcvideo: uvc_ctrl_get_rel_speed: use 0 as default
Date: Thu, 15 Jun 2023 00:19:53 +0200	[thread overview]
Message-ID: <088902f67634fb0931da7b045e05afe5c8197cdc.1686780782.git.soyer@irl.hu> (raw)
In-Reply-To: <8e2956b31fb0bab802b1a5cbcfae2c0fd2aca4b8.camel@irl.hu>

Devices with pan/tilt controls but without pan/tilt speed controls
return 1 for the default value of V4L2_CID_PAN_SPEED or
V4L2_CID_TILT_SPEED. For these controls, the value of 1 means a
move and that's not a good default.

Currently, for these controls the UVC_GET_DEF query returns
bPanSpeed or bTiltSpeed of CT_PANTILT_RELATIVE_CONTROL.

According to the UVC 1.5 specification, the default value of bPanSpeed
or bTiltSpeed should be 1 if the pan/tilt control doesn't support
speed control.

"If the control does not support speed control for the Tilt control,
it will return the value 1 in this field for all these requests."

This patch modifies the uvc_ctrl_get_rel_speed to return hardcoded 0
for UVC_GET_DEF query, because that's the stop or don't move value
for these V4L2 controls.

Previous discussion
Link: https://lore.kernel.org/all/CAP_ceTy6XVmvTTAmvCp1YU2wxHwXqnarm69Yaz8K4FmpJqYxAg@mail.gmail.com/

Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 5e9d3da862dd..e131958c0930 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -444,9 +444,10 @@ static s32 uvc_ctrl_get_rel_speed(struct uvc_control_mapping *mapping,
 		return -data[first+1];
 	case UVC_GET_MAX:
 	case UVC_GET_RES:
+		return data[first+1];
 	case UVC_GET_DEF:
 	default:
-		return data[first+1];
+		return 0;
 	}
 }
 

base-commit: be9aac187433af6abba5fcc2e73d91d0794ba360
-- 
2.40.1


  reply	other threads:[~2023-06-14 22:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 12:47 [PATCH] media: uvcvideo: uvc_ctrl_get_rel_speed: use 0 as default Gergo Koteles
2023-06-14 14:19 ` Ricardo Ribalda
2023-06-14 14:59   ` soyer
2023-06-14 15:07     ` Ricardo Ribalda
2023-06-14 15:08       ` Ricardo Ribalda
2023-06-14 15:21         ` Gergo Koteles
2023-06-14 15:25           ` Ricardo Ribalda
2023-06-14 15:46             ` Gergo Koteles
2023-06-14 16:29               ` Ricardo Ribalda
2023-06-14 16:56                 ` Gergo Koteles
2023-06-14 20:15                   ` Ricardo Ribalda
2023-06-14 20:53                     ` Laurent Pinchart
2023-06-14 21:10                       ` Ricardo Ribalda
2023-06-14 21:23                       ` Gergo Koteles
2023-06-14 22:19                         ` Gergo Koteles [this message]
2023-11-20 18:47 ` [PATCH v2 RESEND] " Gergo Koteles
2024-03-19  9:43   ` Ricardo Ribalda
2024-03-20 15:21     ` Gergo Koteles

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=088902f67634fb0931da7b045e05afe5c8197cdc.1686780782.git.soyer@irl.hu \
    --to=soyer@irl.hu \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=ribalda@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).