v4l2-compliance: allow EINVAL to be returned by S/TRY_FMT.
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 7 Jan 2013 09:44:45 +0000 (10:44 +0100)
committerHans Verkuil <hans.verkuil@cisco.com>
Mon, 7 Jan 2013 09:44:45 +0000 (10:44 +0100)
See http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html why
this is needed for now.

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

index 343e888..a4f73c8 100644 (file)
@@ -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);