From a74168e4a5fe779f40f628a9402dc4697dd24d42 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 7 Jan 2013 10:44:45 +0100 Subject: [PATCH] v4l2-compliance: allow EINVAL to be returned by S/TRY_FMT. See http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html why this is needed for now. Signed-off-by: Hans Verkuil --- utils/v4l2-compliance/v4l2-test-formats.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index 343e888..a4f73c8 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -560,10 +560,15 @@ int testTryFormats(struct node *node) fmt.fmt.win.bitmap = NULL; } ret = doioctl(node, VIDIOC_TRY_FMT, &fmt); - ret = testFormatsType(node, ret, type, fmt); - if (ret) - return fail("%s is valid, but TRY_FMT failed to return a format\n", - buftype2s(type).c_str()); + if (ret == EINVAL) { + warn("TRY_FMT cannot handle an invalid pixelformat. This may or may not be a problem.\n" + "See http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html for more information.\n"); + } else { + ret = testFormatsType(node, ret, type, fmt); + if (ret) + return fail("%s is valid, but TRY_FMT failed to return a format\n", + buftype2s(type).c_str()); + } } memset(&fmt, 0, sizeof(fmt)); @@ -713,10 +718,15 @@ int testSetFormats(struct node *node) fmt_set.type = type; fmt_set.fmt.pix.field = V4L2_FIELD_ANY; ret = doioctl(node, VIDIOC_S_FMT, &fmt_set); - ret = testFormatsType(node, ret, type, fmt_set); - if (ret) - return fail("%s is valid, but no S_FMT was implemented\n", - buftype2s(type).c_str()); + if (ret == EINVAL) { + warn("S_FMT cannot handle an invalid pixelformat. This may or may not be a problem.\n" + "See http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html for more information.\n"); + } else { + ret = testFormatsType(node, ret, type, fmt_set); + if (ret) + return fail("%s is valid, but no S_FMT was implemented\n", + buftype2s(type).c_str()); + } fmt_set = fmt; ret = doioctl(node, VIDIOC_S_FMT, &fmt_set); -- 2.7.4