mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2
@ 2026-09-28 21:50 Michael Jordan
  2026-09-28 21:50 ` [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Michael Jordan @ 2026-09-28 21:50 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 do not set AUTOUPDATE in GET_INFO for their
pan/tilt and zoom controls, so uvcvideo returns cached values for them.
This series marks AUTO_UPDATE controls as volatile, applies the flags
fixup table to all controls, and adds entries for the two cameras.

Changes in v4:
- Shorten the commit messages (Laurent).
- Use "Assisted-by: LLM" (Ricardo).
- No code changes.

v3: https://lore.kernel.org/linux-media/20260928152416.766957-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] 10+ messages in thread

* [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
  2026-09-28 21:50 [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
@ 2026-09-28 21:50 ` Michael Jordan
  2026-09-29 12:34   ` Laurent Pinchart
  2026-09-28 21:50 ` [PATCH v4 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Michael Jordan @ 2026-09-28 21:50 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

AUTO_UPDATE controls can change on their own, and the driver already
re-reads them from the device. Tell userspace by setting
V4L2_CTRL_FLAG_VOLATILE, plus EXECUTE_ON_WRITE for writable controls
so that writes are not ignored.

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: LLM
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] 10+ messages in thread

* [PATCH v4 2/4] media: uvcvideo: generalise the XU flags fixup to all controls
  2026-09-28 21:50 [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
  2026-09-28 21:50 ` [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
@ 2026-09-28 21:50 ` Michael Jordan
  2026-09-28 21:50 ` [PATCH v4 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Michael Jordan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Michael Jordan @ 2026-09-28 21:50 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

The flags fixup table is only applied to extension unit controls.
Apply it to all controls, and skip GET_INFO when an entry matches.

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: LLM
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] 10+ messages in thread

* [PATCH v4 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2
  2026-09-28 21:50 [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
  2026-09-28 21:50 ` [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
  2026-09-28 21:50 ` [PATCH v4 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
@ 2026-09-28 21:50 ` Michael Jordan
  2026-09-28 21:50 ` [PATCH v4 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2 Michael Jordan
  2026-09-29 15:51 ` [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and " Hans de Goede
  4 siblings, 0 replies; 10+ messages in thread
From: Michael Jordan @ 2026-09-28 21:50 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 does not set AUTOUPDATE in GET_INFO for its pan/tilt
and zoom controls, so reads return the last value written. The camera
moves them on its own when tracking a subject, and sends no control
change events.

Add fixup entries for the three controls.

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: LLM
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] 10+ messages in thread

* [PATCH v4 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2
  2026-09-28 21:50 [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
                   ` (2 preceding siblings ...)
  2026-09-28 21:50 ` [PATCH v4 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Michael Jordan
@ 2026-09-28 21:50 ` Michael Jordan
  2026-09-29 15:51 ` [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and " Hans de Goede
  4 siblings, 0 replies; 10+ messages in thread
From: Michael Jordan @ 2026-09-28 21:50 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 has the same defect as the Tiny 2. Add the same
fixup entries for it.

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: LLM
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] 10+ messages in thread

* Re: [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
  2026-09-28 21:50 ` [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
@ 2026-09-29 12:34   ` Laurent Pinchart
  2026-09-29 13:54     ` Michael Jordan
  2026-10-02  8:14     ` Hans Verkuil
  0 siblings, 2 replies; 10+ messages in thread
From: Laurent Pinchart @ 2026-09-29 12:34 UTC (permalink / raw)
  To: Michael Jordan
  Cc: Hans de Goede, Ricardo Ribalda, Mauro Carvalho Chehab,
	Hans Verkuil, linux-media, linux-kernel, Hans de Goede

On Mon, Sep 28, 2026 at 05:50:18PM -0400, Michael Jordan wrote:
> AUTO_UPDATE controls can change on their own, and the driver already
> re-reads them from the device. Tell userspace by setting
> V4L2_CTRL_FLAG_VOLATILE, plus EXECUTE_ON_WRITE for writable controls
> so that writes are not ignored.

Writes are not ignored by the driver regardless of whether or not
V4L2_CTRL_FLAG_EXECUTE_ON_WRITE is reported to userspace.

> 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: LLM
> 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;

A blank line here would be nice.

> +	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;
> +	}

The V4L2 documentation also states

  Setting a new value for a volatile control will never trigger a
  V4L2_EVENT_CTRL_CH_VALUE event.

This patch seems to break that as we unconditionally send
V4L2_EVENT_CTRL_CH_VALUE events on control write for controls that don't
have UVC_CTRL_FLAG_ASYNCHRONOUS set.

>  
>  	if (mapping->master_id)
>  		__uvc_find_control(ctrl->entity, mapping->master_id,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
  2026-09-29 12:34   ` Laurent Pinchart
@ 2026-09-29 13:54     ` Michael Jordan
  2026-10-02  8:14     ` Hans Verkuil
  1 sibling, 0 replies; 10+ messages in thread
From: Michael Jordan @ 2026-09-29 13:54 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Michael Jordan, Hans de Goede, Hans de Goede, Ricardo Ribalda,
	Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-kernel

Hi Laurent,

You're right. The driver already sends the writes regardless of
EXECUTE_ON_WRITE. I'll correct the commit message and add the blank
line.

I also missed the restriction on write-triggered CH_VALUE events.
Reporting VOLATILE needs corresponding changes to the event handling.
I'll check the write-notification paths, including asynchronous
completion, and test those changes before sending v5.

Thanks,
Michael

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

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

Hi,

On 28-Sep-26 23:50, Michael Jordan wrote:
> The OBSBOT Tiny 2 and Tail 2 do not set AUTOUPDATE in GET_INFO for their
> pan/tilt and zoom controls, so uvcvideo returns cached values for them.
> This series marks AUTO_UPDATE controls as volatile, applies the flags
> fixup table to all controls, and adds entries for the two cameras.
> 
> Changes in v4:
> - Shorten the commit messages (Laurent).
> - Use "Assisted-by: LLM" (Ricardo).
> - No code changes.

Thank you for your patch.

I have merged patches 2-4 into:

https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/for-next/

For patch 1/4 lets wait for a new version and see if Laurent likes
that better.

Regards,

Hans



> 
> v3: https://lore.kernel.org/linux-media/20260928152416.766957-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(-)
> 


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

* Re: [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
  2026-09-29 12:34   ` Laurent Pinchart
  2026-09-29 13:54     ` Michael Jordan
@ 2026-10-02  8:14     ` Hans Verkuil
  2026-10-02 12:41       ` Michael Jordan
  1 sibling, 1 reply; 10+ messages in thread
From: Hans Verkuil @ 2026-10-02  8:14 UTC (permalink / raw)
  To: Laurent Pinchart, Michael Jordan
  Cc: Hans de Goede, Ricardo Ribalda, Mauro Carvalho Chehab,
	linux-media, linux-kernel, Hans de Goede

On 29/09/2026 14:34, Laurent Pinchart wrote:
> On Mon, Sep 28, 2026 at 05:50:18PM -0400, Michael Jordan wrote:
>> AUTO_UPDATE controls can change on their own, and the driver already
>> re-reads them from the device. Tell userspace by setting
>> V4L2_CTRL_FLAG_VOLATILE, plus EXECUTE_ON_WRITE for writable controls
>> so that writes are not ignored.
> 
> Writes are not ignored by the driver regardless of whether or not
> V4L2_CTRL_FLAG_EXECUTE_ON_WRITE is reported to userspace.
> 
>> 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: LLM
>> 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;
> 
> A blank line here would be nice.
> 
>> +	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;
>> +	}
> 
> The V4L2 documentation also states
> 
>   Setting a new value for a volatile control will never trigger a
>   V4L2_EVENT_CTRL_CH_VALUE event.
> 
> This patch seems to break that as we unconditionally send
> V4L2_EVENT_CTRL_CH_VALUE events on control write for controls that don't
> have UVC_CTRL_FLAG_ASYNCHRONOUS set.
> 
>>  
>>  	if (mapping->master_id)
>>  		__uvc_find_control(ctrl->entity, mapping->master_id,
> 

So this is not correct. The best place to see how this should be done in this
driver is the kernel doc comment for v4l2_ctrl_auto_cluster() in include/media/v4l2-ctrls.h.

A driver that uses the control framework can mark a set of controls as a cluster where
the first control switches between automatic and manual handling, and the other controls
are only active if manual handling is selected. If automatic handling is selected, then
the INACTIVE flag is automatically set. In addition, if the 'set_volatile' flag is true
when v4l2_ctrl_auto_cluster is called, then the VOLATILE flag is also set when automatic
handling is selected. That flag is cleared when you switch to manual mode.

So when in manual mode these are all normal, non-volatile controls. When in automatic mode,
and if set_volatile is true, then all but the first control are marked as inactive and
volatile, so reading one of those controls will call g_volatile_ctrl. Setting a volatile
control is just ignored as expected, since it is meaningless.

So don't set V4L2_CTRL_FLAG_EXECUTE_ON_WRITE, instead you have to modify the flags on
the fly whenever you switch between manual and automatic mode.

I hope this helps!

Regards,

	Hans

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

* Re: [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
  2026-10-02  8:14     ` Hans Verkuil
@ 2026-10-02 12:41       ` Michael Jordan
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Jordan @ 2026-10-02 12:41 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Michael Jordan, Laurent Pinchart, Hans de Goede, Hans de Goede,
	Ricardo Ribalda, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Hi Hans,

Thanks for pointing me to `v4l2_ctrl_auto_cluster()`. I’m trying to
understand how to apply that model correctly here.

From UVC 1.5 §4.1.2, Table 4-3, I understand that GET_INFO distinguishes
“Disabled due to automatic mode” (D2, a state bit) from “Autoupdate
Control” (D3, a capability bit). That helps me understand why AUTO_UPDATE
alone should not determine the flags for controls with an auto/manual
master.

The Tiny 2 and Tail 2 pan/tilt case is what I’m unsure about. These are
the only cameras I have available to test. On both, writing the V4L2
pan/tilt controls sends a target position to the camera. With the
AUTO_UPDATE fixups applied, subsequent V4L2 reads retrieve values from
the camera that follow its movement towards that target, rather than
immediately returning the commanded target. I observed this with tracking
disabled as well. The pan/tilt mappings in uvcvideo have no `master_id`.

This is what I observed on these devices; I’m not assuming the
specification requires live position feedback. In particular,
§4.2.2.1.14 describes pan/tilt “settings,” and both cameras advertise
UVC 1.00.

Would the appropriate approach be to follow the mode-dependent flag
handling you described for controls with an auto/manual master, and use
`VOLATILE | EXECUTE_ON_WRITE` for writable PTZ controls exhibiting this
behavior? Or am I misunderstanding how that read/write behavior should
be represented in V4L2?

The v5 I sent fixes the event-notification issue but retains the blanket
flag mapping, so your feedback still applies.

Thanks for helping me understand this.

Michael

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

end of thread, other threads:[~2026-10-02 12:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 21:50 [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
2026-09-28 21:50 ` [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
2026-09-29 12:34   ` Laurent Pinchart
2026-09-29 13:54     ` Michael Jordan
2026-10-02  8:14     ` Hans Verkuil
2026-10-02 12:41       ` Michael Jordan
2026-09-28 21:50 ` [PATCH v4 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
2026-09-28 21:50 ` [PATCH v4 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Michael Jordan
2026-09-28 21:50 ` [PATCH v4 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2 Michael Jordan
2026-09-29 15:51 ` [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and " Hans de Goede

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®