diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2021-03-11 17:59:28 +0100 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2021-03-11 17:59:28 +0100 |
commit | f53c2fa1a95154f75cf4a510113179ff39d548e7 (patch) | |
tree | 229f8b8e1b309edb50f46bac9b3492c98583611f | |
parent | a6eab98a2a046f59514bcc33f549d22626d05b2e (diff) | |
download | v4l-utils-f53c2fa1a95154f75cf4a510113179ff39d548e7.tar.gz |
v4l2-compliance: improve fmtdesc.description check
Check that the driver doesn't make up pixelformat descriptions.
It should be left to the v4l2 core.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r-- | utils/v4l2-compliance/v4l2-test-formats.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index 61bb317d..60ebf559 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -255,6 +255,14 @@ static int testEnumFormatsType(struct node *node, unsigned type) return fail("fmtdesc.description not set\n"); if (!fmtdesc.pixelformat) return fail("fmtdesc.pixelformat not set\n"); + + // Check that the driver does not overwrites the kernel pixelformat description + std::string descr = pixfmt2s(fmtdesc.pixelformat); + if (strcmp(descr.c_str(), (const char *)fmtdesc.description) && + memcmp(descr.c_str(), "Unknown", 7)) + return fail("fmtdesc.description mismatch: was '%s', expected '%s'\n", + fmtdesc.description, descr.c_str()); + if (node->g_direct() && (fmtdesc.flags & V4L2_FMT_FLAG_EMULATED)) return fail("drivers must never set the emulated flag\n"); if (fmtdesc.flags & ~(V4L2_FMT_FLAG_COMPRESSED | V4L2_FMT_FLAG_EMULATED | |