v4l2-compliance: Fix V4L2_CTRL_WHICH_DEF_VAL in multi_classes
PATCH 1/1 v4l2-compliance: Fix V4L2_CTRL_WHICH_DEF_VAL in multi_classes
If there are multiple classes, the ioctl should fail.
--- utils/v4l2-compliance/v4l2-test-controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
utils/v4l2-compliance/v4l2-test-controls.cpp +4 -1
@@ -793,7 +793,10 @@ int testExtendedControls(struct node *node) ctrls.which = V4L2_CTRL_WHICH_DEF_VAL; fail_on_test(!doioctl(node, VIDIOC_S_EXT_CTRLS, &ctrls)); fail_on_test(!doioctl(node, VIDIOC_TRY_EXT_CTRLS, &ctrls)); - fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + if (multiple_classes) + fail_on_test(!doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + else + fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); return 0; }
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Quoted 1 line · Ricardo Ribalda
If there are multiple classes, the ioctl should fail.
It shouldn't matter if there are multiple classes or not, it should work.
What is the exact error you get with which driver?
Regards,
Hans
Quoted 24 lines
Fixes 0884b19adada ("v4l2-compliance: add test for V4L2_CTRL_WHICH_DEF_VAL")Signed-off-by Ricardo Ribalda <[email protected]>--- utils/v4l2-compliance/v4l2-test-controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)utils/v4l2-compliance/v4l2-test-controls.cpp +4
-1@@ -793,7 +793,10 @@ int testExtendedControls(struct node *node) ctrls.which = V4L2_CTRL_WHICH_DEF_VAL; fail_on_test(!doioctl(node, VIDIOC_S_EXT_CTRLS, &ctrls)); fail_on_test(!doioctl(node, VIDIOC_TRY_EXT_CTRLS, &ctrls)); - fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + if (multiple_classes) + fail_on_test(!doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + else + fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); return 0; }
Hi Hans
Thanks for your review!
Quoted 6 lines · Hans Verkuil
Quoted 1 line · Ricardo Ribalda
If there are multiple classes, the ioctl should fail.
It shouldn't matter if there are multiple classes or not, it should work.
I believe this is the part of the kernel that is triggering the issue:
I can send a patch if that is not the intended behaviour ;)
/* Check that all controls are from the same control class. */ for (i = 0; i < c->count; i++) {
if (V4L2_CTRL_ID2WHICH(c->controls[i].id) != c->which) { c->error_idx = i;
return 0;
Quoted 2 lines
What is the exact error you get with which driver?
I am trying to fix uvc compliance
fail: v4l2-test-controls.cpp(813): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
Quoted 2 lines
Regards,
Best regards!
Quoted 28 lines
Hans
Quoted 24 lines
Fixes 0884b19adada ("v4l2-compliance: add test for V4L2_CTRL_WHICH_DEF_VAL")Signed-off-by Ricardo Ribalda <[email protected]>--- utils/v4l2-compliance/v4l2-test-controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)utils/v4l2-compliance/v4l2-test-controls.cpp +4
-1@@ -793,7 +793,10 @@ int testExtendedControls(struct node *node) ctrls.which = V4L2_CTRL_WHICH_DEF_VAL; fail_on_test(!doioctl(node, VIDIOC_S_EXT_CTRLS, &ctrls)); fail_on_test(!doioctl(node, VIDIOC_TRY_EXT_CTRLS, &ctrls)); - fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + if (multiple_classes) + fail_on_test(!doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + else + fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); return 0; }
Signature · 1 line
Ricardo Ribalda
Quoted 17 lines · Ricardo Ribalda
Hi Hans
Thanks for your review!
Quoted 6 lines · Hans Verkuil
Quoted 1 line · Ricardo Ribalda
If there are multiple classes, the ioctl should fail.
It shouldn't matter if there are multiple classes or not, it should work.
I believe this is the part of the kernel that is triggering the issue:
Quoted 7 lines
I can send a patch if that is not the intended behaviour ;)
/* Check that all controls are from the same control class. */ for (i = 0; i <
c->count; i++) {
if (V4L2_CTRL_ID2WHICH(c->controls[i].id)!=c->which) {c->error_idx= i;
return 0;
Ah, and this is only called for drivers that do not use the control framework.
This is a bug, just before that for-loop it says:
if (!c->which)
return 1;This should be:
if (!c->which || c->which == V4L2_CTRL_WHICH_DEF_VAL)
return 1;
if (c->which == V4L2_CTRL_WHICH_REQUEST_VAL)
return 0;Regards,
Hans
Quoted 45 lines
Quoted 3 lines
What is the exact error you get with which driver?
I am trying to fix uvc compliance
fail: v4l2-test-controls.cpp(813):
doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAILQuoted 2 lines
Regards,
Best regards!
Quoted 28 lines
Hans
Quoted 24 lines
Fixes 0884b19adada ("v4l2-compliance: add test for V4L2_CTRL_WHICH_DEF_VAL")Signed-off-by Ricardo Ribalda <[email protected]>--- utils/v4l2-compliance/v4l2-test-controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)utils/v4l2-compliance/v4l2-test-controls.cpp +4
-1@@ -793,7 +793,10 @@ int testExtendedControls(struct node *node) ctrls.which = V4L2_CTRL_WHICH_DEF_VAL; fail_on_test(!doioctl(node, VIDIOC_S_EXT_CTRLS, &ctrls)); fail_on_test(!doioctl(node, VIDIOC_TRY_EXT_CTRLS, &ctrls)); - fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + if (multiple_classes) + fail_on_test(!doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + else + fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); return 0; }
Quoted 34 lines · Hans Verkuil
Quoted 17 lines · Ricardo Ribalda
Hi Hans
Thanks for your review!
Quoted 6 lines · Hans Verkuil
Quoted 1 line · Ricardo Ribalda
If there are multiple classes, the ioctl should fail.
It shouldn't matter if there are multiple classes or not, it should work.
I believe this is the part of the kernel that is triggering the issue:
Quoted 7 lines
I can send a patch if that is not the intended behaviour ;)
/* Check that all controls are from the same control class. */ for (i = 0; i <
c->count; i++) {
if (V4L2_CTRL_ID2WHICH(c->controls[i].id)!=c->which) {c->error_idx= i;
return 0;Ah, and this is only called for drivers that do not use the control framework.
This is a bug, just before that for-loop it says:
if (!c->which) return 1;
Quoted 6 lines
This should be:
if (!c->which || c->which == V4L2_CTRL_WHICH_DEF_VAL) return 1; if (c->which == V4L2_CTRL_WHICH_REQUEST_VAL) return 0;
Can I send a patch for that?
Quoted 51 lines
Regards,
Hans
Quoted 45 lines
Quoted 3 lines
What is the exact error you get with which driver?
I am trying to fix uvc compliance
fail: v4l2-test-controls.cpp(813):
doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAILQuoted 2 lines
Regards,
Best regards!
Quoted 28 lines
Hans
Quoted 24 lines
Fixes 0884b19adada ("v4l2-compliance: add test for V4L2_CTRL_WHICH_DEF_VAL")Signed-off-by Ricardo Ribalda <[email protected]>--- utils/v4l2-compliance/v4l2-test-controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)utils/v4l2-compliance/v4l2-test-controls.cpp +4
-1@@ -793,7 +793,10 @@ int testExtendedControls(struct node *node) ctrls.which = V4L2_CTRL_WHICH_DEF_VAL; fail_on_test(!doioctl(node, VIDIOC_S_EXT_CTRLS, &ctrls)); fail_on_test(!doioctl(node, VIDIOC_TRY_EXT_CTRLS, &ctrls)); - fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + if (multiple_classes) + fail_on_test(!doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); + else + fail_on_test(doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)); return 0; }
Signature · 1 line
Ricardo Ribalda