From patchwork Mon Nov 20 18:47:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gergo Koteles X-Patchwork-Id: 167364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp146015vqb; Mon, 20 Nov 2023 10:53:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHU5scNjDjNXzqFsCDmNuj7z0yJY1KhL4YRFHQ6w8cNAlePhGw8UiNKK1Aj2uEjw7GmEDXX X-Received: by 2002:a05:6a00:1d97:b0:6cb:bb61:5686 with SMTP id z23-20020a056a001d9700b006cbbb615686mr287228pfw.31.1700506428242; Mon, 20 Nov 2023 10:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700506428; cv=none; d=google.com; s=arc-20160816; b=j4ApNOSjWGE0h0ZaXt9wvVZdFcEfLPO5xi7NIYrNqucaWk7zqW1QHT8dhLI9h/110f L46Iz+HFcwcBSLFnV8X69RPV4Exyh2J03O58ja+ttQKKeknHLDd7GcwqHCS7Qj83n45K pO5v/xidI1NS7yW0CehhAwY2ofg2fLxDDSs/PAIvQYu4KeMIxR8Yh0fqIFoSS2jefHBk jtJqli4uKWxonaRvw0kO4wC8wrsfyM3xlnyKs0aBd5xU2zIAs/wfC6u2wYdAqE+XcIVV gNRu40vFSFiNhhpWYxzfCvxBhtVxzgFvBa883ie+SQVNhIaylTm6dTANV/AnjHjl9Bam ZOPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lnVgsySHqFQrPk3K4bzmr+4Hwln/Vm41LciW395a4ck=; fh=RGYT3IZ0p6xeKJHkwO8wH/pYOAzlb9xH3nZH3kulVBs=; b=hxHOXiuDH2mcPJOmZR/a39lRZOE7fA+UkTjPgGrQMu/TS6VIZZr68nLvrUtKZa6VLL hIrtdtDZwFWyxG/2p9s4MjZyYszbYC9i7Pb3yBzy/bJMFzkjnYbK8sQ2Y6vPAR8QLqPN iSBwLW015Dq/k7Jsexrhj1wy60bsgS311FCACS0AIMTqpo1WxiGS5oO4gf4ZHRaUS5f+ yIQmIKTvYITFarxbxh2j0t54uhu2KNmaKwPBrgB7rsFV99Bj9peO9yHVWC/5EOAM1014 JM84bYWyATquZmZIBZ827Xj0zzcwSmwx0LPqNtTJPQKVhsdn30jnlZ5xk2jaHiMAyrOq VqFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g14-20020a056a0023ce00b006b0cfed2c77si8648422pfc.135.2023.11.20.10.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 10:53:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B9FD980FC709; Mon, 20 Nov 2023 10:53:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232297AbjKTSxd (ORCPT + 27 others); Mon, 20 Nov 2023 13:53:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbjKTSxb (ORCPT ); Mon, 20 Nov 2023 13:53:31 -0500 X-Greylist: delayed 306 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 20 Nov 2023 10:53:27 PST Received: from irl.hu (irl.hu [95.85.9.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB1A210E; Mon, 20 Nov 2023 10:53:27 -0800 (PST) Received: from fedori.lan (51b689b3.dsl.pool.telekom.hu [::ffff:81.182.137.179]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 000000000006FE64.00000000655BA9F1.000F4952; Mon, 20 Nov 2023 19:48:17 +0100 From: Gergo Koteles To: Laurent Pinchart , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Gergo Koteles Subject: [PATCH v2 RESEND] media: uvcvideo: uvc_ctrl_get_rel_speed: use 0 as default Date: Mon, 20 Nov 2023 19:47:51 +0100 Message-ID: <088902f67634fb0931da7b045e05afe5c8197cdc.1700505816.git.soyer@irl.hu> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Mime-Version: 1.0 X-Mime-Autoconverted: from 8bit to 7bit by courier 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 10:53:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783110228311460612 X-GMAIL-MSGID: 1783110228311460612 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 --- drivers/media/usb/uvc/uvc_ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) base-commit: be9aac187433af6abba5fcc2e73d91d0794ba360 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; } }