From: Hans Verkuil Date: Mon, 7 Jan 2013 09:44:45 +0000 (+0100) Subject: v4l2-compliance: allow EINVAL to be returned by S/TRY_FMT. X-Git-Tag: v4l-utils-0.9.4~99 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a74168e4a5fe779f40f628a9402dc4697dd24d42;p=platform%2Fupstream%2Fv4l-utils.git 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 --- 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);