From 0dbe1732f6d2ed3c8d4d4b655b08c3cc29c818eb Mon Sep 17 00:00:00 2001 From: claude-noether Date: Thu, 14 May 2026 08:58:12 +0000 Subject: [PATCH] =?UTF-8?q?iter18=20=CE=B1-22=20(diag):=20log=20S=5FEXT=5F?= =?UTF-8?q?CTRLS=20error=5Fidx=20+=20request=5Ffd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tests mechanism 5 (silent partial failure). If error_idx != count after S_EXT_CTRLS, one of the per-request controls was rejected by the kernel even though the ioctl returned 0. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/v4l2.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/v4l2.c b/src/v4l2.c index 9e2ce8b..7e09ef9 100644 --- a/src/v4l2.c +++ b/src/v4l2.c @@ -433,6 +433,7 @@ static int v4l2_ioctl_controls(int video_fd, int request_fd, unsigned long ioc, unsigned int num_controls) { struct v4l2_ext_controls controls; + int rc; memset(&controls, 0, sizeof(controls)); @@ -444,7 +445,24 @@ static int v4l2_ioctl_controls(int video_fd, int request_fd, unsigned long ioc, controls.request_fd = request_fd; } - return ioctl(video_fd, ioc, &controls); + rc = ioctl(video_fd, ioc, &controls); + + /* + * iter18 α-22 diagnostic: dump error_idx + request_fd after each + * S_EXT_CTRLS to detect silent partial failure (mechanism 5). + * The kernel sets error_idx to the failing control's index or + * count (== num_controls) for "validation passed all" or + * "system-wide failure". Log unconditionally so we can correlate. + */ + if (ioc == VIDIOC_S_EXT_CTRLS) { + request_log("α-22: S_EXT_CTRLS rc=%d errno=%d count=%u " + "error_idx=%u request_fd=%d which=0x%x\n", + rc, rc < 0 ? errno : 0, controls.count, + controls.error_idx, controls.request_fd, + controls.which); + } + + return rc; } int v4l2_get_controls(int video_fd, int request_fd,