From nobody Sat Sep 26 11:47:01 2026 Received: from mail-yx1-f49.google.com (mail-yx1-f49.google.com [74.125.224.49]) (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 DEB9C2F5324 for ; Wed, 2 Sep 2026 00:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788308758; cv=none; b=d9ajH8Lzx8ISraKGwgRVaANuORv0iFBB0dL3N3iqvrfBew//obouWEqBPfm855lHqT5zgTOIlLOkKG0dGSKd8Sjy0cTEFSHVIdaQQQzh1DWU4O5DSja9DMmPGEL3BlT/OiH8alUc/biFY630qZHC25D/XMeLf1E6tP3r8ER+W4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788308758; c=relaxed/simple; bh=OrguBF0469JG2pK3364edLr8OvZI7wEyhEIZ6DU16ro=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OiULu57rDht2K+rqeQ8DhsE5rvclcrZsh5qHcajB6qNQn/Mlu3KoxE1EMuGJKEZX/Z8XDeWEz1rCBWOV+7kFoES7oj0ODCmuxulQWJqbkfud5a4rGnqnqVk1XDBBr2lfVViZJ8YllASUHXh5vs77yatHe7fLd/CSdS0tXa8ck2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D4+w/NoC; arc=none smtp.client-ip=74.125.224.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D4+w/NoC" Received: by mail-yx1-f49.google.com with SMTP id 956f58d0204a3-66c711b7f2aso462058d50.3 for ; Tue, 01 Sep 2026 17:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788308756; x=1788913556; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rR4HvvkSZSXWGaiSoIrlDM6ioSrlrhDFTfgpP1XiDW4=; b=D4+w/NoC9YDabStQYjJs4p8C9yrAj0GTSwxhsVm4E8NmujepH7Av5xGah+AsWpYuZt 9w5zJGB9QBEzjSjnUq4Hr63Yfiw3WxoKlKvfPnJjYVHc68Q2c5cZZ3ALt6uHXDGdTpgP Go1wTqvIqCn7FBVSY0Pn+lBdwuKtPn33Q2OT0VkHCRnilGibqLfQ5PWUKjYhKCHN1GE2 oS33yadYkxNv/WoYqbMDjumUY5O9lczVH0L7n2Jhe8UACz/j5QLGlOdYEMtuAelh9k5o fCm0JBpCatLneXYW3Hmf0bs933OeIaYdpr0iW8Daedt8DLt+vVdIQBlTx1EPFx623pBj WZIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788308756; x=1788913556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=rR4HvvkSZSXWGaiSoIrlDM6ioSrlrhDFTfgpP1XiDW4=; b=dgVb1iZSveCnuLy14fnqkiXIQabNiTuQT7mR44PU89q1tR/ZRJMkFafFxcr4vpleSA 4ZdJKPN00VP2UL0iqgaEj3s/Rr3pr8/p3PhU/heRvQ++g6GayWifN5HrIux1ei0EkfUJ 4Z3/7knVUwR/aE6PgwQHxsf6ivRoJ3vjNV6/oS2UilSVgRiBx21RUMyDGSmKbNgacOgN 9rhljkZln2AioUvXUs4ZoCPf9t4Ajf8V+Az6ngHaiCJ8Y6KVnsepYP4tIHMPAqQmR+W8 3DV0VYpuB6l8iAFDXOspsTpQTOk3sRvpAdjQiL1SdEc9Gc6HlSyDUgKASe3MioTbxYf5 TpzA== X-Forwarded-Encrypted: i=1; AKwUvByWkgqQXzKb2l9/ggbvqfKqI+n+InnqdnenKmce89Vb55wVkO38VzMwqAQUBJry/Yzl9wv1Dadcl9FmuKs=@vger.kernel.org X-Gm-Message-State: AFuF++nwp2xkZ2GqgEZV9OOVHzl9ql+/jl/7vFNKkCKOTVmxAyGKDKNm NiR/j6aXdNBX85oudwNSFzUXKar3gb83zxzB7lISt08k7ejbWcyo9+sc X-Gm-Gg: AYBFou1f3BfBmo9qLnm1r0qAwXmURycCwRaavaazRHsH4zYjC9ex9kN/ToR/7BFEzUj oRHGYH/8iSpc8dPulgz5NKIGQzGDJ9Vyl+Rk9ihPqD6B+CDAJLnwTiE931vFnBsTCS/O+oswkQh EvJ+FZ/mxPEkqoNGv+zDGiXSCh+Hxf+UW7Pmj9NToptRl4AOVZpFCURi/TyZkIMKik9uu88sWwD C1+5UFSRUWbzZ5uE9vzm9t9urTQk9DSlIDvVHnbweMGq6WZJ7jcm1rquBoRp6yquZqMhnDLY/mY zXHt+Qy/CGt9G2JLkB2HNM5iUl4uEfv8F3x1hy/7F2r2/1+gkYxIil1TOJJVXD3thDlQ71DGm+Q FSnmA6zWexliGu09Cq/oAPiIAJXnvj1uhbiqAlboSZl1tL1YlnGwkOb5XyNFrrx4d5UNBw+m/93 2EpZVFNZX/0autry+mrVv2peXLCo/lQBNpZA+/tihQzG1gEa99BN06Lqen1IYOkqX3FPAwYTDYU 4FIa5Xmxg0PHx/yFL7UlkdjhJLo/5d12DZr/SCVplU= X-Received: by 2002:a05:690e:12c6:b0:66f:7dbe:74f1 with SMTP id 956f58d0204a3-66f9b93156emr407634d50.2.1788308755886; Tue, 01 Sep 2026 17:25:55 -0700 (PDT) Received: from llmbox.. ([38.81.85.65]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66f98656c1esm755344d50.11.2026.09.01.17.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 17:25:55 -0700 (PDT) From: Michael Jordan To: Laurent Pinchart , Hans de Goede , Ricardo Ribalda Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Jordan Subject: [PATCH v2 1/3] media: uvcvideo: report AUTO_UPDATE controls as volatile Date: Tue, 1 Sep 2026 20:25:51 -0400 Message-ID: <20260902002553.34839-2-jordan.mymail@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260902002553.34839-1-jordan.mymail@gmail.com> References: <20260902002553.34839-1-jordan.mymail@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A control with UVC_CTRL_FLAG_AUTO_UPDATE is one whose value the device changes on its own: the driver never trusts its cached value for it, re-reading the device on every VIDIOC_G_EXT_CTRLS (the rollback at the end of the ioctl runs uvc_ctrl_commit_entity(), which clears ctrl->loaded for these controls) and re-reading it after each write. That is exactly what V4L2_CTRL_FLAG_VOLATILE describes to userspace, but the driver never reported it, so applications had no way to know that the value they read can change under them and that a fresh read is worth issuing. Report V4L2_CTRL_FLAG_VOLATILE for AUTO_UPDATE controls. The uAPI documents writes to a volatile control as ignored unless V4L2_CTRL_FLAG_EXECUTE_ON_WRITE is also set, and this driver sends every write of a writable control to the device, so report EXECUTE_ON_WRITE alongside it whenever the control is settable. Suggested-by: Ricardo Ribalda Reviewed-by: Ricardo Ribalda Signed-off-by: Michael Jordan --- drivers/media/usb/uvc/uvc_ctrl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index 3ca108b83..aceb26310 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -1840,6 +1840,17 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_ch= ain *chain, if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_MAX) && (ctrl->info.flags & UVC_CTRL_FLAG_GET_MIN)) v4l2_ctrl->flags |=3D V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX; + if (ctrl->info.flags & UVC_CTRL_FLAG_AUTO_UPDATE) { + v4l2_ctrl->flags |=3D V4L2_CTRL_FLAG_VOLATILE; + /* + * Writes to a volatile control are documented to be ignored + * unless EXECUTE_ON_WRITE is also reported. The driver sends + * every write of a writable control to the device, so report + * the flag accordingly. + */ + if (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) + v4l2_ctrl->flags |=3D V4L2_CTRL_FLAG_EXECUTE_ON_WRITE; + } =20 if (mapping->master_id) __uvc_find_control(ctrl->entity, mapping->master_id, --=20 2.43.0 From nobody Sat Sep 26 11:47:01 2026 Received: from mail-yx1-f42.google.com (mail-yx1-f42.google.com [74.125.224.42]) (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 179E22F5A2D for ; Wed, 2 Sep 2026 00:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788308759; cv=none; b=I2gdnKw/d0fgtATUGEUoYxbv5yoX5biybCQYGwkLqYM1TH6jEeUBiRuKWUDerWhky2GkwAdzzK1FR9SkFUG8k3RWe8xVRe0RTOKS87UyHeSBQs7M1ZUiULZ/e60SLwOva50vlA1KDstWP+5Tg9fX2L19Ps98EInMzEKoXPRbaa0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788308759; c=relaxed/simple; bh=heOUxFnfZ1Mv5w5T/wATPkt2ywMDCQWjEglYxe/ob0U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a5zLs6hOyNjeqVe75ZBOS48iQJgXDHJlhLvO549ZrM8WPVwmANPEpQe+LI4GqfkQmhpL+r+1/s6wu3+Qt5Y7Sx1zmSA2BQjKKkZq63mppqGx8EEiL7SWvRJ1xeQO1radftEOG4IW3lZIRq9yfq0ZLPbmFQlrbHhGA3PFKKqtNIk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=pKsQ4J3T; arc=none smtp.client-ip=74.125.224.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pKsQ4J3T" Received: by mail-yx1-f42.google.com with SMTP id 956f58d0204a3-66c711b7f2aso462072d50.3 for ; Tue, 01 Sep 2026 17:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788308757; x=1788913557; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XaX9nFI/ftp0aduMGpdZxQxv9LWib4/Sz+dza+s97Zc=; b=pKsQ4J3TS0sIa0/o19ovAr95avqb98mtM/WDhs5PUDhqFBhPkv8A8Jgd1y/nsydDDi 3o6E2pTWeQhAP9tV9eKKNwUiLCw9xasQHbhVEpwnk84bjPhjyvnGtpvr1rxGD68W5/Tf u7Ts7/yhuePLaMOObVkrfGatMeqXBOpq5G3qBIKemela+k4AemegoDansbXUQU6cVZiU 6UIwfDooM8ESdSpIql036OuFxeRBK526bfUC5FqDyuOVxuRAXeFRrW356zvePTEbZC/j Wp6hSFQtzzWSnZ4TfyHhUSHxyNxG6+8xBCd9gZBiYpLnnYHQamYlY9OvesyKzZSuc4We VaKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788308757; x=1788913557; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=XaX9nFI/ftp0aduMGpdZxQxv9LWib4/Sz+dza+s97Zc=; b=c0fCTCe/X4zrWRJY3c6AkIDBAPDPuF0OQgyvH0fnPPfq7iXLWQcrzVDhfVdUwbmZYZ XdL30T3QwbJRu0ZqDyYXlCwVlGLUjZqJtyCigHnkuzsmNkotS5u2DqlvZCIZKa/HD0NJ l17deXpL50mvoVQwxbrkMveYuqoRx5SLqtAgeST/LCv8VCDHAM83l+LEVcaBWuZe+jdH WwwWKSWo73oatlfZAjWBy654o3z+C85rHInz6rAlFsYVUuYhQ8nMdZxsIRRsYsBgYyZK vgorEBnpZmeIZ5QSf6h1XNQaAi4e+2xNrG4Tvgvuqb3+P2/tHSgvMAZgrGh9xhNGoteD bFAA== X-Forwarded-Encrypted: i=1; AKwUvBwJEepfpjkwL/3LwcFmgddF7wLKLKx6l+Pp2QtQK514f/6LP/yrBONDctXoC/DRx+vA2GhKypisVnZcXWA=@vger.kernel.org X-Gm-Message-State: AFuF++ldCTIoGlL3zzro7UUoE2SEDSIreamhcOaBnHDcijTTu5UhGWTf Duf2XfgHsuc3rQP/PlH/MnhFlsdRkP6iovbs11HxOBcjMP9SM+lnCq/r X-Gm-Gg: AYBFou3jDdHuZzbHdlsZf48vaBPKeRNwD29aaP39QcR7x7RB75RPldIdBXKDrC2xQcB GOUXlokrvLcT8Zt8KDc0VYeMlqeueQghBCVXxUAAdf5zkzSd5SwYURxvswS+IB8ULTI6Nl1jYeP qXePHGivlrNPnWH7tXmYrQ+5TkRMyoStihD07v8zHWQw5V6YDtN2dVTu3cDw77V4tl0w9HM3mtc B+NjwbA5CbJd1pUCdlOzLrF1NQuH4+vVM3T1vaz0x1Stj1U+9wE+MvNPXzq4F+Xj8Dw4PXQOyro IR73AcCnB+JrARqLbmiiY1DLM+MlllIk0WyxI3gsnBcOxMPivT3B9T+5lV7Lusy589ZYkBV9jaa gYBfZe7uwSrNW7f0wVNLO9bIe6paFYI3qqh4DBmHSs+non/Dd/CKitvbLp6m7uBzM6j5y58WIVh kGtU7mNcHO0Ytylii/XShy4cbzg7b00fL9EqfSeZQlq23AJuuWrbKdVBvU6H+fKs9FosPvUH8J8 DSnkxrgq10aIO4UOEUYjE46hD4hjURCEWztwLnOHWnCyZqP+e2bLA== X-Received: by 2002:a05:690e:480e:b0:66d:1851:1bc0 with SMTP id 956f58d0204a3-66f9be7f1b0mr230775d50.36.1788308756933; Tue, 01 Sep 2026 17:25:56 -0700 (PDT) Received: from llmbox.. ([38.81.85.65]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66f98656c1esm755344d50.11.2026.09.01.17.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 17:25:56 -0700 (PDT) From: Michael Jordan To: Laurent Pinchart , Hans de Goede , Ricardo Ribalda Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Jordan Subject: [PATCH v2 2/3] media: uvcvideo: generalise the XU flags fixup to all controls Date: Tue, 1 Sep 2026 20:25:52 -0400 Message-ID: <20260902002553.34839-3-jordan.mymail@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260902002553.34839-1-jordan.mymail@gmail.com> References: <20260902002553.34839-1-jordan.mymail@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" uvc_ctrl_fixup_xu_info() holds a per-device table of controls whose GET_INFO reply is wrong, and overrides the flags for them. It only runs from uvc_ctrl_fill_xu_info(), so it can only correct extension unit controls, but standard controls suffer from the same class of firmware bug: a device can report a wrong capability byte for a Camera Terminal or Processing Unit control just as easily. Rename it to uvc_ctrl_fixup_flags() and call it at the start of uvc_ctrl_get_flags(), where the flags are derived from GET_INFO for every control, standard and XU alike. The fixup replaces the flags wholesale, so when the table covers a control there is no point in querying a device we already know gives a wrong answer: return early and skip the GET_INFO request altogether. The call in uvc_ctrl_fill_xu_info() is dropped, as uvc_ctrl_get_flags() now handles the fixup for XU controls too. No functional change for the devices already in the table: their entries are XU controls, matched by entity and selector before as they are now, and their flags come from the table either way. The only difference is one GET_INFO request no longer issued per fixed-up control. Suggested-by: Ricardo Ribalda Signed-off-by: Michael Jordan Reviewed-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_ctrl.c | 91 ++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index aceb26310..64c90c380 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -2852,6 +2852,48 @@ int uvc_ctrl_set(struct uvc_fh *handle, struct v4l2_= ext_control *xctrl) * Dynamic controls */ =20 +static bool uvc_ctrl_fixup_flags(struct uvc_device *dev, + const struct uvc_control *ctrl, + struct uvc_control_info *info) +{ + struct uvc_ctrl_fixup { + struct usb_device_id id; + u8 entity; + u8 selector; + u8 flags; + }; + + static const struct uvc_ctrl_fixup fixups[] =3D { + { { USB_DEVICE(0x046d, 0x08c2) }, 9, 1, + UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX | + UVC_CTRL_FLAG_GET_DEF | UVC_CTRL_FLAG_SET_CUR | + UVC_CTRL_FLAG_AUTO_UPDATE }, + { { USB_DEVICE(0x046d, 0x08cc) }, 9, 1, + UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX | + UVC_CTRL_FLAG_GET_DEF | UVC_CTRL_FLAG_SET_CUR | + UVC_CTRL_FLAG_AUTO_UPDATE }, + { { USB_DEVICE(0x046d, 0x0994) }, 9, 1, + UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX | + UVC_CTRL_FLAG_GET_DEF | UVC_CTRL_FLAG_SET_CUR | + UVC_CTRL_FLAG_AUTO_UPDATE }, + }; + + unsigned int i; + + for (i =3D 0; i < ARRAY_SIZE(fixups); ++i) { + if (!usb_match_one_id(dev->intf, &fixups[i].id)) + continue; + + if (fixups[i].entity =3D=3D ctrl->entity->id && + fixups[i].selector =3D=3D info->selector) { + info->flags =3D fixups[i].flags; + return true; + } + } + + return false; +} + /* * Retrieve flags for a given control */ @@ -2862,6 +2904,14 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev, u8 *data; int ret; =20 + /* + * Some devices report bogus capabilities through GET_INFO. If the + * fixup table covers this control, take the flags from the table and + * skip the query altogether. + */ + if (uvc_ctrl_fixup_flags(dev, ctrl, info)) + return 0; + data =3D kmalloc(1, GFP_KERNEL); if (data =3D=3D NULL) return -ENOMEM; @@ -2893,45 +2943,6 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev, return ret; } =20 -static void uvc_ctrl_fixup_xu_info(struct uvc_device *dev, - const struct uvc_control *ctrl, struct uvc_control_info *info) -{ - struct uvc_ctrl_fixup { - struct usb_device_id id; - u8 entity; - u8 selector; - u8 flags; - }; - - static const struct uvc_ctrl_fixup fixups[] =3D { - { { USB_DEVICE(0x046d, 0x08c2) }, 9, 1, - UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX | - UVC_CTRL_FLAG_GET_DEF | UVC_CTRL_FLAG_SET_CUR | - UVC_CTRL_FLAG_AUTO_UPDATE }, - { { USB_DEVICE(0x046d, 0x08cc) }, 9, 1, - UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX | - UVC_CTRL_FLAG_GET_DEF | UVC_CTRL_FLAG_SET_CUR | - UVC_CTRL_FLAG_AUTO_UPDATE }, - { { USB_DEVICE(0x046d, 0x0994) }, 9, 1, - UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX | - UVC_CTRL_FLAG_GET_DEF | UVC_CTRL_FLAG_SET_CUR | - UVC_CTRL_FLAG_AUTO_UPDATE }, - }; - - unsigned int i; - - for (i =3D 0; i < ARRAY_SIZE(fixups); ++i) { - if (!usb_match_one_id(dev->intf, &fixups[i].id)) - continue; - - if (fixups[i].entity =3D=3D ctrl->entity->id && - fixups[i].selector =3D=3D info->selector) { - info->flags =3D fixups[i].flags; - return; - } - } -} - /* * Query control information (size and flags) for XU controls. */ @@ -2972,8 +2983,6 @@ static int uvc_ctrl_fill_xu_info(struct uvc_device *d= ev, goto done; } =20 - uvc_ctrl_fixup_xu_info(dev, ctrl, info); - uvc_dbg(dev, CONTROL, "XU control %pUl/%u queried: len %u, flags { get %u set %u auto %u }\n", info->entity, info->selector, info->size, --=20 2.43.0 From nobody Sat Sep 26 11:47:01 2026 Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (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 1DAED30BF6D for ; Wed, 2 Sep 2026 00:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788308761; cv=none; b=P11HFBefu8gGCXpWzK/WCthbwlfwV/YqDcOXKfdVWkFxJfCWFH15qUSARBEa9PBV0ATaz7ZFn2bkmn1UuOD2LddFX0aGskmYwLeYWkASivqtKsPFlsxA2TLH++X/l3pFxW7+WM4NQ9RC50c/wuRGGxWhKkkldnV8JdN4U3SOsl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788308761; c=relaxed/simple; bh=fHIem79VEQd6VN+J7Xr5Z2Z52DwKbCv2aFsKkIIRoIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FfTmrEHEXvVeIzHBW371cidBwlwujZ714oBvGvaSZlPmYAAdGs/bqSNgpzX73aQ/0ZTN52pbpOGJoUf79pZN4xbUViw1uAwuSKzUdkkzCOjj7YXmqIKw4/Tnm/cHV5siawdQAuiD5dnTwtAkVI3bOMxFq9L592Kag5ZSDzRQIbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UTv0O89N; arc=none smtp.client-ip=209.85.128.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UTv0O89N" Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-8623b1e7cb2so7877907b3.1 for ; Tue, 01 Sep 2026 17:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788308758; x=1788913558; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SMkDLgdMNZJUh64SAlWSMLfQyj4fAJxQgv3yE+ZZDPs=; b=UTv0O89NMArCClJ+4YqwKWsYF918IWerVKy5XUanXyug4quJtiAAYB+WOou3+dWDo8 4H/InzwIbQnOlKgaa9QXLOANjW3UwK7NwxyoaOCFt8m7d/7owT8hJZx64FNEkiHkdG6X fZIqKg4yxxJGPdjdLFIlfJzj2rVgez+FjR2EQAUbH6M05bdr2KOIXLkZYmO8WX7xujJe j6nYTEdylKD6xwTLouxYBE6z04m+MH6V5MrbiM4BgzP/Oda3z+9wP8HszMQZp0+V3Yte a5TYWJxaNsze8RPGsllitfeoQYFjYwwIZE5g29DOmH+iD1QQLDwCciKmb5wkTltHaxFM bsPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788308758; x=1788913558; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=SMkDLgdMNZJUh64SAlWSMLfQyj4fAJxQgv3yE+ZZDPs=; b=j66OIfakKim9LNBhCNl4Wc4NQg0H01pOxTG1RBPewJTzXDsZGWXYTNTQvZtPSnXrgg IV0oJlzEDsrTX8aNZewFIQNxgunL6M8b86twx84H4i92/o5agnk4xDER2fd6A8AS4qHq QcF2SZqdpcp4TBvLcp4Lnnxog1jKfPgU17xkk48+H6iXD6l836589shoSv1qCcGqFPjP 3GzhoQtP0yoY8Pe0er+V0SEaUjagHNSDV/iVMncWoXvbv4fNkQsnUnZAVRQQQh2USDUI vpurUwfyybFNx6gvz5Ys6o/+iGmN0TyBDeSyAz1p+GCSlTQE5DUwNTPsclN5W35/W8Q1 6cDw== X-Forwarded-Encrypted: i=1; AKwUvBwZoAqDOf7PSCCFPx++gy14zDNqqX9h2K9rxJMur+Jb5zTrVwix3qldbyjlVeThA0wq7XhQlQJ0WnPUhA8=@vger.kernel.org X-Gm-Message-State: AFuF++nW814Mfmg9OGwhX/uHyqBOgmcTIhSCiSui0pB9yqMbD4e+oCHU nOBOt6T11cQJiDcNCNisLVN1qqh56jYWVt4T80uuxY76/kvSwaobGHDW X-Gm-Gg: AYBFou0upjfE9071qizVejkYNqQ/aNUquJrzsHoxTPqK+VOW5JuObwGVMVSU9djbppZ 1yOutSjAdQs89SDUsKK9rnE0wvCaEvNx6PzAOvI+xOpLmWuqVNqSSqcdzeOz8hQkeYEZRw1L/Bo 87GDhLGEvR1oh/ij7U6SMHR2+W+pUEZOsLDJWtcHNQKShlBfTa9pch7sQP4+BoJSfLR3qkMPSLq KufaZn1Gjj1EPaBb+r/L0y5gjKHu6SbjH2acK/+7AhtoQwr4l+VPOkxoWKz871YcKnVaYOsDyf/ +Wom+WxDM8wB3PuC6W92lDz4RSEpoMyf+PeNunNenoZn3hZ+AgdQaPlEKEXDiQoeJl/lA1FNphP hW/R30ONKum03hcSmKoETiV1phGI63cnmUa85OTWqhmZvdp/MptoMZjp4SRHzlP+FUAMoBZH85Q wOq6uuuOWRqTwRlhVCiI/VsEh8PoZr1lxBvIhZhwvttAq9RD0EqTi8Tr5UMtA5ERNy71PAB+UQa kCJkJ9BnDXT9UDrVN0DK6syzgg9U0RlbhOcazajRfU= X-Received: by 2002:a53:ed8c:0:b0:66f:1ce2:db1e with SMTP id 956f58d0204a3-66f9bd41734mr273445d50.35.1788308757806; Tue, 01 Sep 2026 17:25:57 -0700 (PDT) Received: from llmbox.. ([38.81.85.65]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66f98656c1esm755344d50.11.2026.09.01.17.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 17:25:57 -0700 (PDT) From: Michael Jordan To: Laurent Pinchart , Hans de Goede , Ricardo Ribalda Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Jordan Subject: [PATCH v2 3/3] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Date: Tue, 1 Sep 2026 20:25:53 -0400 Message-ID: <20260902002553.34839-4-jordan.mymail@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260902002553.34839-1-jordan.mymail@gmail.com> References: <20260902002553.34839-1-jordan.mymail@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The OBSBOT Tiny 2 (3564:fef8) computes its GET_INFO capability byte per control, but gets it wrong for the controls that matter most on a motorised PTZ camera: CT_PANTILT_ABSOLUTE, CT_PANTILT_RELATIVE and CT_ZOOM_ABSOLUTE all answer 0x03 -- GET and SET capable, with the AUTOUPDATE bit clear. (The byte is not a constant stub: CT_ZOOM_RELATIVE correctly reports 0x0f, CT_ROLL_ABSOLUTE reports 0x01.) uvc_ctrl_get_flags() takes the flags from that byte, so it clears the UVC_CTRL_FLAG_AUTO_UPDATE that the static uvc_ctrls[] entries set for all three controls. Without AUTO_UPDATE nothing clears ctrl->loaded after the first read, so uvcvideo serves them from its cache indefinitely: VIDIOC_G_CTRL returns the last value the host commanded, never the live one. All three controls were verified on the hardware to change autonomously and to report the live value on GET_CUR: - pan/tilt position keeps changing for the seconds a commanded gimbal move takes, and changes on its own under the camera's autonomous subject tracking; - zoom follows the subject under the camera's AI framing (observed 0-71% with the host issuing no zoom request, matching the vendor status protocol's zoom report); - the pan/tilt speed control reports the actual current speed during a relative move (a commanded 80 reads back as 78, then the deceleration ramp, then 0 once the gimbal reaches the end stop). Without AUTO_UPDATE the cache would report the written speed forever. Add fixup entries restoring AUTO_UPDATE, alongside the flags each control already has in uvc_ctrls[], for these three controls. The fixup replaces info->flags wholesale rather than OR-ing, so each entry spells out the full flag set. The camera's other AUTO_UPDATE-flagged controls were checked and deliberately left alone: exposure, white balance and focus have working autos, but their GET_CUR just echoes the last SET_CUR (the firmware never reports the auto-chosen value), so AUTO_UPDATE would add USB traffic for no benefit; there is no auto-hue; CT_ZOOM_RELATIVE already reports AUTOUPDATE; CT_ROLL_ABSOLUTE is read-only and unmapped. The vendor has been asked to fix the firmware (support ticket #8220, 2026-08-04); no fix is available at the time of writing. lsusb -v (device descriptor and the Camera Terminal): Bus 003 Device 006: ID 3564:fef8 Remo Tech Co., Ltd. OBSBOT Tiny 2 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.10 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 [unknown] bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x3564 Remo Tech Co., Ltd. idProduct 0xfef8 OBSBOT Tiny 2 bcdDevice 4.09 iManufacturer 1 Remo Tech Co., Ltd. iProduct 2 OBSBOT Tiny 2 iSerial 0 bNumConfigurations 1 [...] VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0201 Camera Sensor bAssocTerminal 0 iTerminal 0 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x00023e3e Auto-Exposure Mode Auto-Exposure Priority Exposure Time (Absolute) Exposure Time (Relative) Focus (Absolute) Zoom (Absolute) Zoom (Relative) PanTilt (Absolute) PanTilt (Relative) Roll (Absolute) Focus, Auto Suggested-by: Ricardo Ribalda Signed-off-by: Michael Jordan --- drivers/media/usb/uvc/uvc_ctrl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index 64c90c380..74f6e8039 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -2876,6 +2876,26 @@ static bool uvc_ctrl_fixup_flags(struct uvc_device *= dev, UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_DEF | UVC_CTRL_FLAG_SET_CUR | UVC_CTRL_FLAG_AUTO_UPDATE }, + /* + * OBSBOT Tiny 2: GET_INFO reports GET|SET without AUTOUPDATE + * for the pan/tilt and zoom controls, clearing the AUTO_UPDATE + * the driver's own control table sets for them. The device + * moves all three on its own (gimbal moves take seconds, and + * its autonomous subject tracking pans, tilts and zooms with + * no host involvement) and reports the live values on GET_CUR. + */ + { { USB_DEVICE(0x3564, 0xfef8) }, 1, + UVC_CT_PANTILT_ABSOLUTE_CONTROL, + UVC_CTRL_FLAG_SET_CUR | UVC_CTRL_FLAG_GET_RANGE | + UVC_CTRL_FLAG_RESTORE | UVC_CTRL_FLAG_AUTO_UPDATE }, + { { USB_DEVICE(0x3564, 0xfef8) }, 1, + UVC_CT_PANTILT_RELATIVE_CONTROL, + UVC_CTRL_FLAG_SET_CUR | UVC_CTRL_FLAG_GET_RANGE | + UVC_CTRL_FLAG_AUTO_UPDATE }, + { { USB_DEVICE(0x3564, 0xfef8) }, 1, + UVC_CT_ZOOM_ABSOLUTE_CONTROL, + UVC_CTRL_FLAG_SET_CUR | UVC_CTRL_FLAG_GET_RANGE | + UVC_CTRL_FLAG_RESTORE | UVC_CTRL_FLAG_AUTO_UPDATE }, }; =20 unsigned int i; --=20 2.43.0