From: Gregor Jasny <jasny@vidsoft.de>
To: Hans de Goede <j.w.r.degoede@hhs.nl>
Cc: video4linux-list@redhat.com,
v4l2 library <v4l2-library@linuxtv.org>,
SPCA50x Linux Device Driver Development
<spca50x-devs@lists.sourceforge.net>
Subject: Re: [V4l2-library] Messed up syscall return value
Date: Tue, 29 Jul 2008 13:52:24 +0200 [thread overview]
Message-ID: <20080729115224.GD21280@vidsoft.de> (raw)
In-Reply-To: <488EEA42.2020907@hhs.nl>
On Tue, Jul 29, 2008 at 12:00:34PM +0200, Hans de Goede wrote:
> Indeed, so iow I'm happy to conclude that thie is not a libv4l bug :)
Will you add a work around like the above in libv4l?
Thanks,
Gregor
Index: libv4l2/libv4l2.c
===================================================================
RCS file: /var/cvs/vidsoft/extern/libv4l/libv4l2/libv4l2.c,v
retrieving revision 1.5
diff -u -r1.5 libv4l2.c
--- libv4l2/libv4l2.c 14 Jul 2008 14:00:28 -0000 1.5
+++ libv4l2/libv4l2.c 29 Jul 2008 11:51:20 -0000
@@ -97,7 +97,7 @@
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 @@
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 @@
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)
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
next prev parent reply other threads:[~2008-07-29 11:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 12:20 Announcing libv4l 0.3.7 Hans de Goede
2008-07-28 21:49 ` Messed up syscall return value Gregor Jasny
[not found] ` <488E4090.5020600@gmail.com>
2008-07-28 22:16 ` [V4l2-library] " Gregor Jasny
[not found] ` <488E46BC.10104@gmail.com>
2008-07-28 22:34 ` Gregor Jasny
2008-07-28 22:35 ` H. Willstrand
2008-07-29 10:00 ` Hans de Goede
2008-07-29 11:52 ` Gregor Jasny [this message]
2008-07-29 19:49 ` Hans de Goede
2008-07-29 16:00 ` Mauro Carvalho Chehab
2008-07-29 19:05 ` Laurent Pinchart
2008-07-29 20:51 ` Mauro Carvalho Chehab
2008-07-29 20:57 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080729115224.GD21280@vidsoft.de \
--to=jasny@vidsoft.de \
--cc=j.w.r.degoede@hhs.nl \
--cc=spca50x-devs@lists.sourceforge.net \
--cc=v4l2-library@linuxtv.org \
--cc=video4linux-list@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox