v4l2-ctl: fix -w support.
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Jul 2011 10:04:36 +0000 (12:04 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Jul 2011 10:04:36 +0000 (12:04 +0200)
The -w option (use the libv4l2 wrapper library) never worked since the v4l2_open
and v4l2_close functions were never called. Fixed this.

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

index 28d40a4..652f7f7 100644 (file)
@@ -558,17 +558,17 @@ static void usage(void)
        exit(0);
 }
 
-static inline int test_open(const char *file, int oflag)
+static int test_open(const char *file, int oflag)
 {
        return options[OptUseWrapper] ? v4l2_open(file, oflag) : open(file, oflag);
 }
 
-static inline int test_close(int fd)
+static int test_close(int fd)
 {
        return options[OptUseWrapper] ? v4l2_close(fd) : close(fd);
 }
 
-static inline int test_ioctl(int fd, int cmd, void *arg)
+static int test_ioctl(int fd, int cmd, void *arg)
 {
        return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg);
 }
@@ -2543,7 +2543,7 @@ int main(int argc, char **argv)
                return 1;
        }
 
-       if ((fd = open(device, O_RDWR)) < 0) {
+       if ((fd = test_open(device, O_RDWR)) < 0) {
                fprintf(stderr, "Failed to open %s: %s\n", device,
                        strerror(errno));
                exit(1);
@@ -3701,6 +3701,6 @@ int main(int argc, char **argv)
                        perror("VIDIOC_QUERYCAP");
        }
 
-       close(fd);
+       test_close(fd);
        exit(app_result);
 }