From 3d1feaebac107977acda8fc23d3b8c66d18c7194 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 27 Apr 2012 13:42:42 +0200 Subject: [PATCH] v4l2-compliance: EIO after getting/setting a control is now a warning USB devices can return EIO when setting or getting certain controls due to hardware constraints. Warn about this, but no longer treat it as an error. Signed-off-by: Hans Verkuil --- utils/v4l2-compliance/v4l2-compliance.h | 2 +- utils/v4l2-compliance/v4l2-test-controls.cpp | 23 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h index 951f8394..b22011cc 100644 --- a/utils/v4l2-compliance/v4l2-compliance.h +++ b/utils/v4l2-compliance/v4l2-compliance.h @@ -71,7 +71,7 @@ struct node { do { \ warnings++; \ if (verbose) \ - printf("\t\twarn: " fmt, ##args); \ + printf("\t\twarn: %s(%d): " fmt, __FILE__, __LINE__, ##args); \ } while (0) #define fail(fmt, args...) \ diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp index dffe39aa..7c7bdd3a 100644 --- a/utils/v4l2-compliance/v4l2-test-controls.cpp +++ b/utils/v4l2-compliance/v4l2-test-controls.cpp @@ -361,8 +361,11 @@ int testSimpleControls(struct node *node) if (iter->flags & V4L2_CTRL_FLAG_READ_ONLY) { if (ret != EACCES) return fail("s_ctrl did not check the read-only flag\n"); + } else if (ret == EIO) { + warn("s_ctrl returned EIO\n"); + ret = 0; } else if (ret) { - return fail("s_ctrl returned an error\n"); + return fail("s_ctrl returned an error (%d)\n", ret); } if (ret) continue; @@ -543,8 +546,12 @@ int testExtendedControls(struct node *node) ctrl.size = iter->maximum + 1; ret = doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls); } + if (ret == EIO) { + warn("g_ext_ctrls returned EIO\n"); + ret = 0; + } if (ret) - return fail("g_ext_ctrls returned an error\n"); + return fail("g_ext_ctrls returned an error (%d)\n", ret); if (checkExtendedCtrl(ctrl, *iter)) return fail("invalid control %08x\n", iter->id); } @@ -568,6 +575,10 @@ int testExtendedControls(struct node *node) if (ctrls.error_idx != ctrls.count) return fail("invalid error index\n"); } else { + if (ret == EIO) { + warn("s_ext_ctrls returned EIO\n"); + ret = 0; + } if (ret) return fail("s_ext_ctrls returned an error\n"); @@ -629,6 +640,10 @@ int testExtendedControls(struct node *node) if (ret) return fail("could not try all controls\n"); ret = doioctl(node, VIDIOC_S_EXT_CTRLS, &ctrls); + if (ret == EIO) { + warn("s_ext_ctrls returned EIO\n"); + ret = 0; + } if (ret) return fail("could not set all controls\n"); @@ -648,6 +663,10 @@ int testExtendedControls(struct node *node) if (multiple_classes && ctrls.error_idx >= ctrls.count) return fail("error_idx should be < count\n"); ret = doioctl(node, VIDIOC_S_EXT_CTRLS, &ctrls); + if (ret == EIO) { + warn("s_ext_ctrls returned EIO\n"); + ret = 0; + } if (ret && !multiple_classes) return fail("could not set all controls of a specific class\n"); if (ret != EINVAL && multiple_classes) -- 2.34.1