From 312f892576856b56b59b7900807a8d045344b3c9 Mon Sep 17 00:00:00 2001 From: tonton Th Date: Tue, 28 Jan 2020 22:11:20 +0100 Subject: [PATCH] beurk... --- v4l2/t.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/v4l2/t.c b/v4l2/t.c index bf537fa5..2edc5a65 100644 --- a/v4l2/t.c +++ b/v4l2/t.c @@ -20,9 +20,9 @@ int verbosity; /* --------------------------------------------------------------------- */ -int essai(char *dev, int k) +int essai_get_fmt(char *dev, int k) { -int vfd, foo; +int vfd, idx, foo; struct v4l2_format fmt; struct v4l2_requestbuffers reqbuf; @@ -31,20 +31,22 @@ fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k); vfd = open_device(dev); if (verbosity) fprintf(stderr, "\topen %s -> %d\n", dev, vfd); -memset(&fmt, 0, sizeof(fmt)); -fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - -foo = ioctl(vfd, VIDIOC_G_FMT, &fmt); -fprintf(stderr, "ioctl -> %d\n", foo); -if (0 != foo) { - perror("ioctl G_FMT"); - exit(1); - } + memset(&fmt, 0, sizeof(fmt)); + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + foo = ioctl(vfd, VIDIOC_G_FMT, &fmt); + fprintf(stderr, "%s : ioctl -> %d\n", __func__, foo); + if (0 != foo) { + perror("ioctl G_FMT"); + return -1; + } pr_v4l2_format("after ioctl VIDIOC_G_FMT", &fmt); /* this function is bugged */ +close(vfd); + + return k; } /* --------------------------------------------------------------------- */ @@ -79,7 +81,7 @@ while ((opt = getopt(argc, argv, "d:hK:v")) != -1) { if (verbosity) fimg_print_version(0); -foo = essai(device, K); +foo = essai_get_fmt(device, K); fprintf(stderr, "\tessai -> %d\n", foo); return 0;