v4l2-poll — Wait for some event on a file descriptor
|struct pollfd *ufds,|
|unsigned int nfds,|
poll() function applications
can suspend execution until the driver has captured data or is ready
to accept data for output.
When streaming I/O has been negotiated this function waits
until a buffer has been filled or displayed and can be dequeued with
VIDIOC_DQBUF ioctl. When buffers are already in the outgoing
queue of the driver the function returns immediately.
poll() returns the number of
file descriptors that have been selected (that is, file descriptors
for which the
revents field of the
respective pollfd structure is non-zero).
Capture devices set the
POLLRDNORM flags in the
revents field, output devices the
flags. When the function timed out it returns a value of zero, on
failure it returns -1 and the
errno variable is set appropriately. When the
application did not call
VIDIOC_STREAMON yet the
poll() function succeeds, but sets the
POLLERR flag in the
When use of the
read() function has
been negotiated and the driver does not capture yet, the
poll function starts capturing. When that fails
it returns a
POLLERR as above. Otherwise it waits
until data has been captured and can be read. When the driver captures
continuously (as opposed to, for example, still images) the function
may return immediately.
When use of the
write() function has
been negotiated the
poll function just waits
until the driver is ready for a non-blocking
All drivers implementing the
write() function or streaming I/O must also
For more details see the
poll() manual page.
poll() returns the number
structures which have non-zero
fields, or zero if the call timed out. On error
-1 is returned, and the
errno variable is set appropriately:
One or more of the
specify an invalid file descriptor.
The driver does not support multiple read or write streams and the device is already in use.
ufds references an inaccessible
The call was interrupted by a signal.
nfds argument is greater