iter18 α-22 (diag): log S_EXT_CTRLS error_idx + request_fd

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) <noreply@anthropic.com>
This commit is contained in:
claude-noether
2026-05-14 08:58:12 +00:00
parent e63bfd4dde
commit 0dbe1732f6
+19 -1
View File
@@ -433,6 +433,7 @@ static int v4l2_ioctl_controls(int video_fd, int request_fd, unsigned long ioc,
unsigned int num_controls) unsigned int num_controls)
{ {
struct v4l2_ext_controls controls; struct v4l2_ext_controls controls;
int rc;
memset(&controls, 0, sizeof(controls)); 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; 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, int v4l2_get_controls(int video_fd, int request_fd,