v4l2-compliance: allow EIO for control ioctls
authorHans Verkuil <hans.verkuil@cisco.com>
Fri, 8 Aug 2014 09:04:50 +0000 (11:04 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Fri, 8 Aug 2014 09:04:50 +0000 (11:04 +0200)
The uvc driver has to pass on the new control values to the hardware,
and that may not always accept the new value, even though it was
reported as within the valid range. In that case EIO is returned
and v4l2-compliance should accept that as a valid error code. It's
not the uvc driver's fault that there are many devices with crappy
firmware.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-compliance/v4l2-test-controls.cpp

index c45181a..a8637ef 100644 (file)
@@ -379,7 +379,7 @@ int testSimpleControls(struct node *node)
                        ctrl.id = iter->id;
                        ctrl.value = iter->minimum - 1;
                        ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
-                       if (ret && ret != ERANGE)
+                       if (ret && ret != EIO && ret != ERANGE)
                                return fail("invalid minimum range check\n");
                        if (!ret && checkSimpleCtrl(ctrl, *iter))
                                return fail("invalid control %08x\n", iter->id);
@@ -389,7 +389,7 @@ int testSimpleControls(struct node *node)
                        ctrl.id = iter->id;
                        ctrl.value = iter->maximum + 1;
                        ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
-                       if (ret && ret != ERANGE)
+                       if (ret && ret != EIO && ret != ERANGE)
                                return fail("invalid maximum range check\n");
                        if (!ret && checkSimpleCtrl(ctrl, *iter))
                                return fail("invalid control %08x\n", iter->id);
@@ -402,7 +402,7 @@ int testSimpleControls(struct node *node)
                        if (ret == ERANGE)
                                warn("%s: returns ERANGE for in-range, but non-step-multiple value\n",
                                                iter->name);
-                       else if (ret)
+                       else if (ret && ret != EIO)
                                return fail("returns error for in-range, but non-step-multiple value\n");
                }
 
@@ -432,15 +432,15 @@ int testSimpleControls(struct node *node)
                        ctrl.id = iter->id; 
                        ctrl.value = iter->minimum;
                        ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
-                       if (ret)
+                       if (ret && ret != EIO)
                                return fail("could not set minimum value\n");
                        ctrl.value = iter->maximum;
                        ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
-                       if (ret)
+                       if (ret && ret != EIO)
                                return fail("could not set maximum value\n");
                        ctrl.value = iter->default_value;
                        ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
-                       if (ret)
+                       if (ret && ret != EIO)
                                return fail("could not set default value\n");
                }
        }