diff options
author | hans@localhost.localdomain <hans@localhost.localdomain> | 2008-07-29 21:48:08 +0200 |
---|---|---|
committer | hans@localhost.localdomain <hans@localhost.localdomain> | 2008-07-29 21:48:08 +0200 |
commit | 46da27966fefda91510002ea939d6e901c86f1d7 (patch) | |
tree | 3e62ad680c3355e16850da9ca1ce758adccdeaa1 /v4l2-apps/lib/libv4l | |
parent | 4381ceef6895b12019f4d55a6f5ff9629194b259 (diff) | |
download | mediapointer-dvb-s2-46da27966fefda91510002ea939d6e901c86f1d7.tar.gz mediapointer-dvb-s2-46da27966fefda91510002ea939d6e901c86f1d7.tar.bz2 |
libv4l2: work around wrong REQUEST_BUFFERS ioctl return code
From: Gregor Jasny <jasny@vidsoft.de>
libv4l2: work around wrong REQUEST_BUFFERS ioctl return code
Signed-off-by: Gregor Jasny <jasny@vidsoft.de>
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l2-apps/lib/libv4l')
-rw-r--r-- | v4l2-apps/lib/libv4l/libv4l2/libv4l2.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c b/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c index 8dfcf9b71..b2ab4dede 100644 --- a/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c +++ b/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c @@ -97,7 +97,7 @@ static int v4l2_request_read_buffers(int index) req.count = devices[index].nreadbuffers; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.memory = V4L2_MEMORY_MMAP; - if ((result = syscall(SYS_ioctl, devices[index].fd, VIDIOC_REQBUFS, &req))){ + if ((result = syscall(SYS_ioctl, devices[index].fd, VIDIOC_REQBUFS, &req)) < 0){ int saved_err = errno; V4L2_LOG_ERR("requesting buffers: %s\n", strerror(errno)); errno = saved_err; @@ -121,7 +121,7 @@ static int v4l2_unrequest_read_buffers(int index) req.count = 0; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.memory = V4L2_MEMORY_MMAP; - if ((result = syscall(SYS_ioctl, devices[index].fd, VIDIOC_REQBUFS, &req))) { + if ((result = syscall(SYS_ioctl, devices[index].fd, VIDIOC_REQBUFS, &req)) < 0) { int saved_err = errno; V4L2_LOG_ERR("unrequesting buffers: %s\n", strerror(errno)); errno = saved_err; @@ -723,8 +723,9 @@ int v4l2_ioctl (int fd, unsigned long int request, ...) v4l2_unmap_buffers(index); result = syscall(SYS_ioctl, devices[index].fd, VIDIOC_REQBUFS, req); - if (result) + if (result < 0) break; + result = 0; // some drivers return the number of buffers on success /* If we got more frames then we can handle lie to the app */ if (req->count > V4L2_MAX_NO_FRAMES) |