Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3159719lqp; Tue, 26 Mar 2024 00:48:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCWmsbpYvoMJFc7ElOKbzJbRTq8HXB96c11bVyhUNfi7ZntI2ieOS+1TR4Yg4WLev+Ql7jwUn0OgpAa7ajf4ygWo29DBMoc1OYUNdzdg== X-Google-Smtp-Source: AGHT+IEyOFUKxYYNfeXAmrUyQZLBE6vlF2YZAh82r+GmLF57mm7XAnyG1Y9MFZIEmB/uOjOTHzp9 X-Received: by 2002:a25:1854:0:b0:dc6:c510:df6b with SMTP id 81-20020a251854000000b00dc6c510df6bmr7219648yby.55.1711439283200; Tue, 26 Mar 2024 00:48:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711439283; cv=pass; d=google.com; s=arc-20160816; b=SUDpx00Q9UqzUYkfruCxZJWlV9a//DLunv6OWk32YjjAdr9YeWPFqbkRE/AO14UV/0 bwXgSwEybckjmGOaKHSW2V7bPUZMuJKBT/zYryNxC52U2nfwVybApMKwU38j+DFH502B z1EYyB2BEvl5qwO7CfoIZlNiO6cGYme/DLt2TCBJkmkWgKwo4N6VMaKoybJApxDHCaGk FnqNgPxlRJyGdxAlKEEt2A7NVAHftct0upkFcPw3/mYxSU5QziMhmSdsG7FcdjUDYZt0 2EziR6RwkzRNUYbX0nRJj/O7eiZ64iPPBfRSCIYrLoCoDTR3JbGKoHdbA0yTyCWHaK5Y +0Xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=OoYfD001kdpXjiLqs9NHakNGRTiNLPtr7VRvnmAbU/c=; fh=zrmkHdvn0U6xvnxFKXarnHwWsSCyTqiCZnouLuhH0Hk=; b=NExF785NhZ+HmVjtWCP8dUmD5LrnN350GeG1q72FzuwVAnzhBxw3PeX+UTEOd2SnMz /9PBWmEDZEfISOeN2Y62lz8ZJKIdXT+IoAoGlL6q1HzlmnZTgXeo1hWdTMzbgVA0+m0P DCWSVqiUm32XRgIOKA9T5eTwC68/WDuPDmQJomYE9pC489s0uuyA8V086a2AYylOS1TJ YdgdoeLLItheR/SH1uQB2bOE/4pAIOfQj0wNaazVqtER0+b1OWiE/TQ5sAGzcE7Y4IuG t6BHhLSNRdYIMSHs48F5QlebhR8DXBPUzySUmxDYccYbae2heLwkhz1OZFj6QoaeTYeK 6UqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TrgZN1iz; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-118484-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118484-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p31-20020a056a000a1f00b006e6500001e9si6773409pfh.356.2024.03.26.00.48.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 00:48:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118484-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TrgZN1iz; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-118484-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118484-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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 CCDB9B21A5B for ; Tue, 26 Mar 2024 07:47:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCF651804F; Tue, 26 Mar 2024 07:47:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TrgZN1iz" Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42E3F132C15 for ; Tue, 26 Mar 2024 07:47:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711439261; cv=none; b=lGNJz/sMS17uQYNnaYSPAq+wjryIlfZwqHIthSoSU2Nvezp7ZQ35hRM6Rwh2pbdkuCXmFvvrJCXH/8NGMqdpzmpUC6s+trviHOWVYMbDWvuBj1F8948oKDJKI3BMdO4e3q9tvWCcHUIXVqIH9Bj4eXMeh0STljJ4c289y5obZb4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711439261; c=relaxed/simple; bh=jRKrW7gIfooZmJQAM1k+SkR+AHaPaDOhsPpbqUrFEXc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=sPyJkAFec+ATPodTOXm971+0ab5Gj3vv1auLWKcv6i1TqZgngFINdBYoJNMRTuDh4Enr7wz+X44+B/ElWVrsS7DZAd7BfTX11QQMWAN6lbKzKmgdoh6uWtnHUJue0+kuZ7PZaxQtwcnerY+lRzGiK+H5qtfCKjeFc//r7SPERT0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=TrgZN1iz; arc=none smtp.client-ip=209.85.222.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ua1-f54.google.com with SMTP id a1e0cc1a2514c-7e096ab9287so2087623241.2 for ; Tue, 26 Mar 2024 00:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1711439258; x=1712044058; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OoYfD001kdpXjiLqs9NHakNGRTiNLPtr7VRvnmAbU/c=; b=TrgZN1izB9Y0IHWR2PZT/AKnfgm432qENFOw38K1hF+4rj0x8fp1Xz+LJBCfmqV+0e /SiCBhKBoNzbBT5T1u7XwOi488gB1A90DXjsF2jEWod8WqhVqvtRpvxjHK7eSYlaVDLX JDpPtRhXmvOc0nRoUMxOA/3TD6j+8WhTJXceU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711439258; x=1712044058; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OoYfD001kdpXjiLqs9NHakNGRTiNLPtr7VRvnmAbU/c=; b=Tnxr8cgl5/Hz0dlkjk1cjnsulSUW9ldcf+XXvpBoHSQzHlqU9GVCRl59aV5FhPyx45 Q1aBjh5GXP+iX4lWVmVVVhydsMy4bPS7XOWKvM0kPUqV2WOKHqSgw/LK0L6LZwm0qlim 5W4Njh3m1KUK8RkIkBMmG5+dJYUIeH1HJlASODx7klslO6t9N+5xHZx+0O3TIy+HubL8 3b7QyJINjBYSU3K8Qdhg4NjGwNyLpyQEiRyRl1eJWAdJLaP2PsMvcQ2XM7A3qKzwrtng BG4zjHmtodX9a1mXULq6Rz6np55hAAgyDewzBykW5Z1cdU/LdzyGcsErRVJ/jYdoZFt0 IJDg== X-Forwarded-Encrypted: i=1; AJvYcCU462hTv5jd2nxTGPuBymREG038ROXY1cyQzctza1VbWU8MQR8kL4l6xZkb3jgqMIzYQLelj9QhZ9Pmclvb4A9dFj9etQjiDGVtq83j X-Gm-Message-State: AOJu0Ywg8Ka5a1Vol4DlGQEdrkX3MQ1RkSaUtzUgAoQK3BH/g05hQYQk 3EBxUoHzNohPF/YfEFxxrXMEcUbDZu/qHROn1Hdu8GBVD/rUOig5wcSTdPaD4l+kJfE32T8evKB MKA== X-Received: by 2002:a05:6102:3113:b0:476:db9d:6594 with SMTP id e19-20020a056102311300b00476db9d6594mr7093171vsh.24.1711439258596; Tue, 26 Mar 2024 00:47:38 -0700 (PDT) Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com. [209.85.221.181]) by smtp.gmail.com with ESMTPSA id ij10-20020a0561025e8a00b00476d7de1055sm1209656vsb.25.2024.03.26.00.47.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Mar 2024 00:47:37 -0700 (PDT) Received: by mail-vk1-f181.google.com with SMTP id 71dfb90a1353d-4d89515ec9aso647788e0c.1 for ; Tue, 26 Mar 2024 00:47:37 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWow1rPbTS50tR1MmGBVU2GJ1UPnY7J8nbSNTGHyRZNw3mGpemRsSqHcWrxYKflA3BHFX92Gh/7yJk6QIbpU5obKA4raiQP6XCFrya7 X-Received: by 2002:a05:6122:251e:b0:4d8:787c:4a6c with SMTP id cl30-20020a056122251e00b004d8787c4a6cmr7419250vkb.5.1711439257115; Tue, 26 Mar 2024 00:47:37 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240325-obsbot-quirk-fix-relative-ptz-speed-v1-1-0eb1387d98c7@securitylive.com> <6e6b75a15cdc6a1239edc4d49b927b187ed20054.camel@irl.hu> In-Reply-To: From: Ricardo Ribalda Date: Tue, 26 Mar 2024 08:47:19 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] uvcvideo: Remo OBSBOT quirk fix for incorrect relative min pan/tilt/zoom speeds To: John Bauer Cc: Gergo Koteles , johnebgood@securitylive.com, Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linh.tp.vu@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Jon, Hi Gergo On Tue, 26 Mar 2024 at 07:23, John Bauer wrote: > > After looking through the current implementation all of the proper checks= are done in the getter and setter for the pan/tilt/zoom controls so the on= ly change needed is the 2 locations to get/check/set the minimum when neede= d. Thankfully all the code that does the hard work is already implemented. = I'll be submitting another patch that summarizes our findings. My issue with the spec is that it is not clear about what GET_MIN should return. Is it the minimum absolute value for that control, or the minimum value in that direction? In other words, can we have a device with a range (-10,20) (-A,B), or only (-20,20) (-A,A) is allowed. If there is no device that supports (-A,B), then we do not need a quirk. Regards! > > Thanks, > John > > > > On Mon, Mar 25, 2024 at 10:42=E2=80=AFPM John Bauer wrote: >> >> Ok, I get you now Gergo, I think I got lucky and I think you're right! D= igging into the UVC 1.5 spec I can see why this works, the first byte in ea= ch 2 byte pair signifying the direction is just getting the signed bit set = when a negative value is applied to both bytes so there should probably be = some checks. >> >> Here from the UVC 1.5 spec: CT_PANTILT_RELATIVE_CONTROL >> +--------+---------------+------+---------------+-----------------------= -------------------------+ >> | Offset | Field | Size | Value | Descr= iption | >> +--------+---------------+------+---------------+-----------------------= -------------------------+ >> | 0 | bPanRelative | 1 | Signed Number | 0: Stop, 1: clockwise,= 0xFF: counter-clockwise | >> | 1 | bPanSpeed | 1 | Number | Speed of the Pan movem= ent | >> | 2 | bTiltRelative | 1 | Signed Number | 0: Stop, 1: tilt up, 0= xFF: tilt down | >> | 3 | bTiltSpeed | 1 | Number | Speed for the Tilt mov= ement | >> +--------+---------------+------+---------------+-----------------------= -------------------------+ >> >> I think it is the direction of the original implementation which is way = easier to use than having 2 controls anyway, I would say it's preferred, it= 's how I have all my analog stick controls mappings. >> >> While the OBSBOT firmware implementation may handle any signed negative = value in the direction byte we should probably check and make sure it confo= rms to spec with 0xFF for counter clockwise and down. >> >> In the current implementation both pan and tilt each use 2 bytes: >> >> { >> .id =3D V4L2_CID_PAN_SPEED, >> .entity =3D UVC_GUID_UVC_CAMERA, >> .selector =3D UVC_CT_PANTILT_RELATIVE_CONTROL, >> .size =3D 16, >> .offset =3D 0, >> .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, >> .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, >> .get =3D uvc_ctrl_get_rel_speed, >> .set =3D uvc_ctrl_set_rel_speed, >> }, >> { >> .id =3D V4L2_CID_TILT_SPEED, >> .entity =3D UVC_GUID_UVC_CAMERA, >> .selector =3D UVC_CT_PANTILT_RELATIVE_CONTROL, >> .size =3D 16, >> .offset =3D 16, >> .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, >> .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, >> .get =3D uvc_ctrl_get_rel_speed, >> .set =3D uvc_ctrl_set_rel_speed, >> }, >> >> Going to do some testing and report back. >> >> Thanks, >> John >> >> >> >> On Mon, Mar 25, 2024 at 9:23=E2=80=AFPM Gergo Koteles wro= te: >>> >>> Hi John, >>> >>> On Mon, 2024-03-25 at 20:51 -0500, John Bauer wrote: >>> >>> I understand this patch might not be the ideal or proper solution; but = it works. I don't think the UVC >>> implementation can be trusted on these cameras, just like the Windows D= irectShow implementation is off. >>> I put this patch out there as I have encountered many Linux users who a= re struggling to get proper >>> control of these awesome cameras. If the patch dies here for now, that'= s OK, at least there's a possible >>> patch for those in need. >>> >>> >>> Sorry, maybe I didn't phrase it well. Based on the UVC specs, I think y= our patch is good for all UVC PTZ cameras, so you don't need to use UVC_QUI= RK_OBSBOT_MIN_SETTINGS quirk entry, just apply the quirk changes to all cam= eras. >>> >>> Thanks for doing this! >>> >>> Regards, >>> Gergo >>> -- Ricardo Ribalda