From 88ff2498fae67a170027c6860463d84e9f943cb8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 8 Jan 2011 12:55:04 +0100 Subject: [PATCH] v4l2-compliance: report "Not supported" if VIDIOC_G_PRIORITY is not supported. Currently v4l2-compliance just reports FAIL in that case. Signed-off-by: Hans Verkuil --- utils/v4l2-compliance/v4l2-compliance.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 3e25ad8..ef77662 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -237,8 +237,12 @@ static int testCap(int fd) static int check_prio(int fd, int fd2, enum v4l2_priority match) { enum v4l2_priority prio; + int err; - if (doioctl(fd, VIDIOC_G_PRIORITY, &prio, "VIDIOC_G_PRIORITY")) + err = doioctl(fd, VIDIOC_G_PRIORITY, &prio, "VIDIOC_G_PRIORITY"); + if (err == EINVAL) + return ENOSYS; + if (err) return -1; if (prio != match) { if (verbose) printf("wrong priority returned (%d, expected %d)\n", prio, match); @@ -256,29 +260,31 @@ static int check_prio(int fd, int fd2, enum v4l2_priority match) static int testPrio(int fd, int fd2) { enum v4l2_priority prio; + int err; - if (check_prio(fd, fd2, V4L2_PRIORITY_DEFAULT)) - return -1; + err = check_prio(fd, fd2, V4L2_PRIORITY_DEFAULT); + if (err) + return err; prio = V4L2_PRIORITY_RECORD; if (doioctl(fd, VIDIOC_S_PRIORITY, &prio, "VIDIOC_S_PRIORITY")) - return -2; + return -10; if (check_prio(fd, fd2, V4L2_PRIORITY_RECORD)) - return -3; + return -11; prio = V4L2_PRIORITY_INTERACTIVE; if (!doioctl(fd2, VIDIOC_S_PRIORITY, &prio, "VIDIOC_S_PRIORITY")) { if (verbose) printf("Can lower prio on second filehandle\n"); - return -4; + return -12; } prio = V4L2_PRIORITY_INTERACTIVE; if (doioctl(fd, VIDIOC_S_PRIORITY, &prio, "VIDIOC_S_PRIORITY")) { if (verbose) printf("Could not lower prio\n"); - return -5; + return -13; } if (check_prio(fd, fd2, V4L2_PRIORITY_INTERACTIVE)) - return -3; + return -14; return 0; } -- 2.7.4