Skip to contentSkip to conversation

media: pvrusb2: fix control enumeration with V4L2_CTRL_FLAG_NEXT_COMPOUND

PATCH In review Ext745 1 participant 2 messages Oct 21 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ext745

author
#1 lore raw

PATCH 1/1 media: pvrusb2: fix control enumeration with V4L2_CTRL_FLAG_NEXT_COMPOUND

Since pvrusb2 implements vidioc_query_ext_ctrl, applications that enumerate controls with VIDIOC_QUERY_EXT_CTRL and V4L2_CTRL_FLAG_NEXT_CTRL | V4L2_CTRL_FLAG_NEXT_COMPOUND (v4l2-ctl, qv4l2) reach it with both flags set. Only NEXT_CTRL is cleared before the lookup, so the search starts above 0x40000000, finds nothing and the enumeration ends at once. v4l2-ctl then falls back to probing the user-class IDs one by one: the MPEG encoder controls are not listed and "v4l2-ctl -C" can't find them by name.

Mask the ID with V4L2_CTRL_ID_MASK like v4l2_query_ext_ctrl() does. pvrusb2 has no compound controls, so NEXT_COMPOUND needs no other handling.

Tested on an HVR-1950, kernel 7.0: v4l2-ctl -l on the video node lists 9 controls before, the full set including the MPEG controls after.

Fixes 8b5ebc688054 ("media: pvrusb2: Convert queryctrl to query_ext_ctrl")
Assisted-by Claude Opus 5.5
---
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +1 -1
index 101b2e9fb..5c0117493 100644
@@ -510,7 +510,7 @@ static int pvr2_query_ext_ctrl(struct file *file, void *priv,
 
 	if (vc->id & V4L2_CTRL_FLAG_NEXT_CTRL) {
 		cptr = pvr2_hdw_get_ctrl_nextv4l(
-				hdw, (vc->id & ~V4L2_CTRL_FLAG_NEXT_CTRL));
+				hdw, vc->id & V4L2_CTRL_ID_MASK);
 		if (cptr)
 			vc->id = pvr2_ctrl_get_v4lid(cptr);
 	} else {
Signature · 1 line
2.53.0