Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) .. c:namespace:: V4L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) .. _func-select:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) *************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) V4L2 select()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) *************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) v4l2-select - Synchronous I/O multiplexing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) .. code-block:: c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)     #include <sys/time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)     #include <sys/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)     #include <unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) .. c:function:: int select( int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) ``nfds``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)   The highest-numbered file descriptor in any of the three sets, plus 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) ``readfds``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)   File descriptions to be watched if a read() call won't block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) ``writefds``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)   File descriptions to be watched if a write() won't block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) ``exceptfds``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)   File descriptions to be watched for V4L2 events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) ``timeout``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)   Maximum time to wait.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) With the :c:func:`select()` function applications can suspend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) execution until the driver has captured data or is ready to accept data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) for output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) When streaming I/O has been negotiated this function waits until a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) buffer has been filled or displayed and can be dequeued with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl. When buffers are already in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) the outgoing queue of the driver the function returns immediately.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) On success :c:func:`select()` returns the total number of bits set in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) ``fd_set``. When the function timed out it returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) a value of zero. On failure it returns -1 and the ``errno`` variable is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) set appropriately. When the application did not call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) :ref:`VIDIOC_QBUF` or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) :ref:`VIDIOC_STREAMON` yet the :c:func:`select()`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) function succeeds, setting the bit of the file descriptor in ``readfds``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) or ``writefds``, but subsequent :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) calls will fail. [#f1]_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) When use of the :c:func:`read()` function has been negotiated and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) driver does not capture yet, the :c:func:`select()` function starts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) capturing. When that fails, :c:func:`select()` returns successful and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) a subsequent :c:func:`read()` call, which also attempts to start
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) capturing, will return an appropriate error code. When the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) captures continuously (as opposed to, for example, still images) and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) data is already available the :c:func:`select()` function returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) immediately.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) When use of the :c:func:`write()` function has been negotiated the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) :c:func:`select()` function just waits until the driver is ready for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) non-blocking :c:func:`write()` call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) All drivers implementing the :c:func:`read()` or :c:func:`write()`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) function or streaming I/O must also support the :c:func:`select()`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) For more details see the :c:func:`select()` manual page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) On success, :c:func:`select()` returns the number of descriptors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) contained in the three returned descriptor sets, which will be zero if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) the timeout expired. On error -1 is returned, and the ``errno`` variable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) is set appropriately; the sets and ``timeout`` are undefined. Possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) error codes are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) EBADF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)     One or more of the file descriptor sets specified a file descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)     that is not open.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) EBUSY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)     The driver does not support multiple read or write streams and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)     device is already in use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) EFAULT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)     The ``readfds``, ``writefds``, ``exceptfds`` or ``timeout`` pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)     references an inaccessible memory area.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) EINTR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)     The call was interrupted by a signal.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) EINVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)     The ``nfds`` argument is less than zero or greater than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)     ``FD_SETSIZE``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .. [#f1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)    The Linux kernel implements :c:func:`select()` like the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)    :c:func:`poll()` function, but :c:func:`select()` cannot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)    return a ``POLLERR``.