mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2
@ 2026-09-28 15:24 Michael Jordan
  2026-09-28 15:24 ` [PATCH v3 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Michael Jordan @ 2026-09-28 15:24 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-kernel,
	Michael Jordan

The OBSBOT Tiny 2 and Tail 2 clear the AUTOUPDATE bit in GET_INFO for
their pan/tilt and zoom controls, so uvcvideo caches them and userspace
never sees the live values. This series reports AUTO_UPDATE controls as
volatile, extends the XU flags fixup table to all controls, and adds
entries for the two cameras.

Changes in v3:
- Add Assisted-by tags.
- Shorten the commit messages, patch 2 in particular (Laurent).
- Patch 3: move the table comment into the commit message (Laurent);
  mention that the device sends no control change events. Kept
  Ricardo's Reviewed-by, as the code change is only the comment removal.
- New patch 4: the same fixup for the OBSBOT Tail 2 (Hans, Ricardo).
- Picked up Hans' Reviewed-by on patches 1 and 2.
- Rebased on media/next.

v2: https://lore.kernel.org/linux-media/20260902002553.34839-1-jordan.mymail@gmail.com/

Michael Jordan (4):
  media: uvcvideo: report AUTO_UPDATE controls as volatile
  media: uvcvideo: generalise the XU flags fixup to all controls
  media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2
  media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2

 drivers/media/usb/uvc/uvc_ctrl.c | 126 +++++++++++++++++++++----------
 1 file changed, 85 insertions(+), 41 deletions(-)

--
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
  2026-09-28 15:24 [PATCH v3 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
@ 2026-09-28 15:24 ` Michael Jordan
  2026-09-28 15:24 ` [PATCH v3 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Jordan @ 2026-09-28 15:24 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-kernel,
	Michael Jordan, Hans de Goede

uvcvideo re-reads controls flagged UVC_CTRL_FLAG_AUTO_UPDATE from the
device instead of trusting its cache, as the device may change their
value on its own. That is what V4L2_CTRL_FLAG_VOLATILE describes, but
the driver does not report it to userspace.

Report V4L2_CTRL_FLAG_VOLATILE for AUTO_UPDATE controls. Writes to a
volatile control are ignored unless V4L2_CTRL_FLAG_EXECUTE_ON_WRITE is
also set, and uvcvideo sends every write to the device, so also report
EXECUTE_ON_WRITE when the control is writable.

Suggested-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Michael Jordan <jordan.mymail@gmail.com>
---
 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_ctrl.c
index 3ca108b83f1d..aceb263103e9 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_chain *chain,
 	if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_MAX) &&
 	    (ctrl->info.flags & UVC_CTRL_FLAG_GET_MIN))
 		v4l2_ctrl->flags |= V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX;
+	if (ctrl->info.flags & UVC_CTRL_FLAG_AUTO_UPDATE) {
+		v4l2_ctrl->flags |= 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 |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
+	}
 
 	if (mapping->master_id)
 		__uvc_find_control(ctrl->entity, mapping->master_id,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 2/4] media: uvcvideo: generalise the XU flags fixup to all controls
  2026-09-28 15:24 [PATCH v3 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
  2026-09-28 15:24 ` [PATCH v3 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
@ 2026-09-28 15:24 ` Michael Jordan
  2026-09-28 17:50   ` Ricardo Ribalda
  2026-09-28 15:24 ` [PATCH v3 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Michael Jordan
  2026-09-28 15:24 ` [PATCH v3 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2 Michael Jordan
  3 siblings, 1 reply; 7+ messages in thread
From: Michael Jordan @ 2026-09-28 15:24 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-kernel,
	Michael Jordan, Hans de Goede

uvc_ctrl_fixup_xu_info() overrides the flags of controls whose GET_INFO
reply is known to be wrong, but is only called for extension unit
controls. Standard controls can have the same problem.

Rename it to uvc_ctrl_fixup_flags() and call it from
uvc_ctrl_get_flags(), which handles all controls. When an entry
matches, skip the GET_INFO request, as its result would be overridden.

Suggested-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Michael Jordan <jordan.mymail@gmail.com>
---
 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_ctrl.c
index aceb263103e9..64c90c380d3d 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
  */
 
+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[] = {
+		{ { 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 = 0; i < ARRAY_SIZE(fixups); ++i) {
+		if (!usb_match_one_id(dev->intf, &fixups[i].id))
+			continue;
+
+		if (fixups[i].entity == ctrl->entity->id &&
+		    fixups[i].selector == info->selector) {
+			info->flags = 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;
 
+	/*
+	 * 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 = kmalloc(1, GFP_KERNEL);
 	if (data == NULL)
 		return -ENOMEM;
@@ -2893,45 +2943,6 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev,
 	return ret;
 }
 
-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[] = {
-		{ { 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 = 0; i < ARRAY_SIZE(fixups); ++i) {
-		if (!usb_match_one_id(dev->intf, &fixups[i].id))
-			continue;
-
-		if (fixups[i].entity == ctrl->entity->id &&
-		    fixups[i].selector == info->selector) {
-			info->flags = 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 *dev,
 		goto done;
 	}
 
-	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,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2
  2026-09-28 15:24 [PATCH v3 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
  2026-09-28 15:24 ` [PATCH v3 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
  2026-09-28 15:24 ` [PATCH v3 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
@ 2026-09-28 15:24 ` Michael Jordan
  2026-09-28 15:24 ` [PATCH v3 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2 Michael Jordan
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Jordan @ 2026-09-28 15:24 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-kernel,
	Michael Jordan

The OBSBOT Tiny 2 (3564:fef8) reports a GET_INFO of 0x03 (GET and SET,
no AUTOUPDATE) for CT_PANTILT_ABSOLUTE, CT_PANTILT_RELATIVE and
CT_ZOOM_ABSOLUTE. uvc_ctrl_get_flags() then clears the
UVC_CTRL_FLAG_AUTO_UPDATE set in uvc_ctrls[], and uvcvideo returns the
last value written by the host instead of the current one.

The device changes all three controls on its own: gimbal moves take
seconds, and its subject tracking pans, tilts and zooms without host
involvement. GET_CUR reports the live values, including the current
speed for CT_PANTILT_RELATIVE, but the device sends no control change
events on its interrupt endpoint.

Add fixup entries restoring AUTO_UPDATE for the three controls. The
fixup replaces the flags, so each entry lists the full set.

Exposure, white balance and focus are left alone: their GET_CUR echoes
the last SET_CUR even while the auto mode is active.

The vendor has been asked to fix the firmware (support ticket #8220)
and has not responded.

lsusb -v (device descriptor and 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 <ribalda@chromium.org>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Michael Jordan <jordan.mymail@gmail.com>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 64c90c380d3d..49ea6a6bcf57 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -2876,6 +2876,18 @@ 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 },
+		{ { 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 },
 	};
 
 	unsigned int i;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2
  2026-09-28 15:24 [PATCH v3 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
                   ` (2 preceding siblings ...)
  2026-09-28 15:24 ` [PATCH v3 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Michael Jordan
@ 2026-09-28 15:24 ` Michael Jordan
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Jordan @ 2026-09-28 15:24 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-kernel,
	Michael Jordan

The OBSBOT Tail 2 (3564:fefc) has the same firmware defect as the
Tiny 2: GET_INFO reports 0x03 (GET and SET, no AUTOUPDATE) for
CT_PANTILT_ABSOLUTE, CT_PANTILT_RELATIVE and CT_ZOOM_ABSOLUTE, so
uvcvideo returns the last value written by the host instead of the
current one.

As on the Tiny 2, the device changes all three controls on its own
(commanded moves, subject tracking, and zoom changed at the camera),
GET_CUR reports the live values, and no control change events are sent
on the interrupt endpoint.

Add fixup entries restoring AUTO_UPDATE for the three controls, with
the same flags as the Tiny 2 entries.

Exposure, white balance and focus are left alone for the same reason
as on the Tiny 2: their GET_CUR does not track the auto mode.

lsusb -v (device descriptor and Camera Terminal):

  Bus 002 Device 003: ID 3564:fefc Remo Tech Co., Ltd. OBSBOT Tail 2
  Device Descriptor:
    bLength                18
    bDescriptorType         1
    bcdUSB               3.20
    bDeviceClass          239 Miscellaneous Device
    bDeviceSubClass         2 [unknown]
    bDeviceProtocol         1 Interface Association
    bMaxPacketSize0         9
    idVendor           0x3564 Remo Tech Co., Ltd.
    idProduct          0xfefc OBSBOT Tail 2
    bcdDevice            4.19
    iManufacturer           1 Remo Tech Co., Ltd.
    iProduct                2 OBSBOT Tail 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

Assisted-by: Claude:claude-fable-5
Signed-off-by: Michael Jordan <jordan.mymail@gmail.com>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 49ea6a6bcf57..202c2c95432a 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -2888,6 +2888,18 @@ static bool uvc_ctrl_fixup_flags(struct uvc_device *dev,
 			UVC_CT_ZOOM_ABSOLUTE_CONTROL,
 			UVC_CTRL_FLAG_SET_CUR | UVC_CTRL_FLAG_GET_RANGE |
 			UVC_CTRL_FLAG_RESTORE | UVC_CTRL_FLAG_AUTO_UPDATE },
+		{ { USB_DEVICE(0x3564, 0xfefc) }, 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, 0xfefc) }, 1,
+			UVC_CT_PANTILT_RELATIVE_CONTROL,
+			UVC_CTRL_FLAG_SET_CUR | UVC_CTRL_FLAG_GET_RANGE |
+			UVC_CTRL_FLAG_AUTO_UPDATE },
+		{ { USB_DEVICE(0x3564, 0xfefc) }, 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 },
 	};
 
 	unsigned int i;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/4] media: uvcvideo: generalise the XU flags fixup to all controls
  2026-09-28 15:24 ` [PATCH v3 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
@ 2026-09-28 17:50   ` Ricardo Ribalda
  2026-09-28 18:02     ` Michael Jordan
  0 siblings, 1 reply; 7+ messages in thread
From: Ricardo Ribalda @ 2026-09-28 17:50 UTC (permalink / raw)
  To: Michael Jordan
  Cc: Laurent Pinchart, Hans de Goede, Mauro Carvalho Chehab,
	Hans Verkuil, linux-media, linux-kernel, Hans de Goede

Hi Michael


On Mon, 28 Sept 2026 at 17:24, Michael Jordan <jordan.mymail@gmail.com> wrote:
>
> uvc_ctrl_fixup_xu_info() overrides the flags of controls whose GET_INFO
> reply is known to be wrong, but is only called for extension unit
> controls. Standard controls can have the same problem.
>
> Rename it to uvc_ctrl_fixup_flags() and call it from
> uvc_ctrl_get_flags(), which handles all controls. When an entry
> matches, skip the GET_INFO request, as its result would be overridden.
>
> Suggested-by: Ricardo Ribalda <ribalda@chromium.org>
> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
> Assisted-by: Claude:claude-fable-5

nit: I think that the current way is to not mention the model version

Assisted-by: LLM

https://docs.kernel.org/process/coding-assistants.html#attribution

If you need to respin please fix it, but maybe Hans or Laurent fix it for you.

Regards!
> Signed-off-by: Michael Jordan <jordan.mymail@gmail.com>
> ---
>  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_ctrl.c
> index aceb263103e9..64c90c380d3d 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
>   */
>
> +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[] = {
> +               { { 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 = 0; i < ARRAY_SIZE(fixups); ++i) {
> +               if (!usb_match_one_id(dev->intf, &fixups[i].id))
> +                       continue;
> +
> +               if (fixups[i].entity == ctrl->entity->id &&
> +                   fixups[i].selector == info->selector) {
> +                       info->flags = 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;
>
> +       /*
> +        * 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 = kmalloc(1, GFP_KERNEL);
>         if (data == NULL)
>                 return -ENOMEM;
> @@ -2893,45 +2943,6 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev,
>         return ret;
>  }
>
> -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[] = {
> -               { { 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 = 0; i < ARRAY_SIZE(fixups); ++i) {
> -               if (!usb_match_one_id(dev->intf, &fixups[i].id))
> -                       continue;
> -
> -               if (fixups[i].entity == ctrl->entity->id &&
> -                   fixups[i].selector == info->selector) {
> -                       info->flags = 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 *dev,
>                 goto done;
>         }
>
> -       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,
> --
> 2.43.0
>


-- 
Ricardo Ribalda

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/4] media: uvcvideo: generalise the XU flags fixup to all controls
  2026-09-28 17:50   ` Ricardo Ribalda
@ 2026-09-28 18:02     ` Michael Jordan
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Jordan @ 2026-09-28 18:02 UTC (permalink / raw)
  To: Ricardo Ribalda
  Cc: Michael Jordan, Laurent Pinchart, Hans de Goede,
	Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-kernel

Hi Ricardo,

On Mon, 28 Sep 2026 19:50:01 +0200, Ricardo Ribalda <ribalda@chromium.org> wrote:
> nit: I think that the current way is to not mention the model version
>
> Assisted-by: LLM

You are right, thanks. It should be "Assisted-by: LLM" on all four
patches.

Hans, feel free to change the tag when applying. If you would rather
have a v4 with it fixed, let me know and I will send one right away.

Michael

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-28 18:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 15:24 [PATCH v3 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
2026-09-28 15:24 ` [PATCH v3 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
2026-09-28 15:24 ` [PATCH v3 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
2026-09-28 17:50   ` Ricardo Ribalda
2026-09-28 18:02     ` Michael Jordan
2026-09-28 15:24 ` [PATCH v3 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Michael Jordan
2026-09-28 15:24 ` [PATCH v3 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2 Michael Jordan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®