V4L2 Bug and/or Bad Docs for VIDIOC_REQBUFS ioctl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Forwarding from a coder who wants to be anonymous]

The documentation at:

 http://v4l2spec.bytesex.org/spec-single/v4l2.html#VIDIOC-REQBUFS

says that the VIDIOC_REQBUFS ioctl(), used to initiate memory mapping
or user pointer i/o on V4L2 devices, returns a 0 upon success, or a -1
on error, and sets errno to either EBUSY or EINVAL. The code, however,
does not follow this logic.

In /usr/src/linux/drivers/media/video/videobuf-core.c, in the function

 int videobuf_reqbufs(struct videobuf_queue *q, \
                      struct v4l2_requestbuffers *req);

If an error occours, "return -EINVAL" is called. If an error does not
occour, execution reaches the following statement:

 retval = __videobuf_mmap_setup(q, count, size, req->memory);

followed by:

 req->count = retval;

and:

 return retval;

So, the value being returned, upon success, is the value returned from
the call to __videobuf_mmap_setup(). Looking inside the code for this
function, the buffers are setup inside a for() loop, and the last value
of "i" used as a counter for that loop is returned. In other words, the
buffers allocated count is returned.

So, is the documentation wrong ? or is the code wrong ?

_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux