v4l2-compliance: Print invalid return codes in control tests
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 24 Dec 2012 12:55:41 +0000 (13:55 +0100)
committerHans Verkuil <hans.verkuil@cisco.com>
Tue, 25 Dec 2012 11:16:54 +0000 (12:16 +0100)
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-compliance/v4l2-test-controls.cpp

index 27c0117..2e03551 100644 (file)
@@ -153,7 +153,7 @@ static int checkQCtrl(struct node *node, struct test_queryctrl &qctrl)
                qmenu.index = i;
                ret = doioctl(node, VIDIOC_QUERYMENU, &qmenu);
                if (ret && ret != EINVAL)
-                       return fail("invalid QUERYMENU return code\n");
+                       return fail("invalid QUERYMENU return code (%d)\n", ret);
                if (ret)
                        continue;
                if (i < qctrl.minimum || i > qctrl.maximum)
@@ -194,7 +194,7 @@ int testQueryControls(struct node *node)
                if (ret == ENOTTY)
                        return ret;
                if (ret && ret != EINVAL)
-                       return fail("invalid queryctrl return code\n");
+                       return fail("invalid queryctrl return code (%d)\n", ret);
                if (ret)
                        break;
                if (checkQCtrl(node, qctrl))
@@ -244,7 +244,7 @@ int testQueryControls(struct node *node)
                qctrl.id = id;
                ret = doioctl(node, VIDIOC_QUERYCTRL, &qctrl);
                if (ret && ret != EINVAL)
-                       return fail("invalid queryctrl return code\n");
+                       return fail("invalid queryctrl return code (%d)\n", ret);
                if (ret)
                        continue;
                if (qctrl.id != id)
@@ -260,7 +260,7 @@ int testQueryControls(struct node *node)
                qctrl.id = id;
                ret = doioctl(node, VIDIOC_QUERYCTRL, &qctrl);
                if (ret && ret != EINVAL)
-                       return fail("invalid queryctrl return code\n");
+                       return fail("invalid queryctrl return code (%d)\n", ret);
                if (ret)
                        break;
                if (qctrl.id != id)
@@ -352,7 +352,7 @@ int testSimpleControls(struct node *node)
                        ctrl.id = iter->id;
                        ctrl.value = iter->default_value;
                } else if (ret)
-                       return fail("g_ctrl returned an error\n");
+                       return fail("g_ctrl returned an error (%d)\n", ret);
                else if (checkSimpleCtrl(ctrl, *iter))
                        return fail("invalid control %08x\n", iter->id);
                
@@ -417,7 +417,7 @@ int testSimpleControls(struct node *node)
                                if (!valid && !ret)
                                        return fail("could set invalid menu item %d\n", i);
                                if (ret && ret != EINVAL)
-                                       return fail("setting invalid menu item returned wrong error\n");
+                                       return fail("setting invalid menu item returned wrong error (%d)\n", ret);
                        }
                } else {
                        // at least min, max and default values should work
@@ -581,7 +581,7 @@ int testExtendedControls(struct node *node)
                        if (ctrls.error_idx != 0)
                                return fail("invalid error index read only control\n");
                } else if (ret) {
-                       return fail("try_ext_ctrls returned an error\n");
+                       return fail("try_ext_ctrls returned an error (%d)\n", ret);
                }
                
                // Try to set the current value (or the default value for write only controls)
@@ -597,7 +597,7 @@ int testExtendedControls(struct node *node)
                                ret = 0;
                        }
                        if (ret)
-                               return fail("s_ext_ctrls returned an error\n");
+                               return fail("s_ext_ctrls returned an error (%d)\n", ret);
                
                        if (checkExtendedCtrl(ctrl, *iter))
                                return fail("s_ext_ctrls returned invalid control contents (%08x)\n", iter->id);