[PATCH v3 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
From: Michael Jordan
Date: Mon Sep 28 2026 - 11:29:11 EST
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@xxxxxxxxxxxx>
Reviewed-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
Reviewed-by: Hans de Goede <johannes.goede@xxxxxxxxxxxxxxxx>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Michael Jordan <jordan.mymail@xxxxxxxxx>
---
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