Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: V4L
0003 
0004 .. _func-write:
0005 
0006 ************
0007 V4L2 write()
0008 ************
0009 
0010 Name
0011 ====
0012 
0013 v4l2-write - Write to a V4L2 device
0014 
0015 Synopsis
0016 ========
0017 
0018 .. code-block:: c
0019 
0020     #include <unistd.h>
0021 
0022 .. c:function:: ssize_t write( int fd, void *buf, size_t count )
0023 
0024 Arguments
0025 =========
0026 
0027 ``fd``
0028     File descriptor returned by :c:func:`open()`.
0029 
0030 ``buf``
0031      Buffer with data to be written
0032 
0033 ``count``
0034     Number of bytes at the buffer
0035 
0036 Description
0037 ===========
0038 
0039 :c:func:`write()` writes up to ``count`` bytes to the device
0040 referenced by the file descriptor ``fd`` from the buffer starting at
0041 ``buf``. When the hardware outputs are not active yet, this function
0042 enables them. When ``count`` is zero, :c:func:`write()` returns 0
0043 without any other effect.
0044 
0045 When the application does not provide more data in time, the previous
0046 video frame, raw VBI image, sliced VPS or WSS data is displayed again.
0047 Sliced Teletext or Closed Caption data is not repeated, the driver
0048 inserts a blank line instead.
0049 
0050 Return Value
0051 ============
0052 
0053 On success, the number of bytes written are returned. Zero indicates
0054 nothing was written. On error, -1 is returned, and the ``errno``
0055 variable is set appropriately. In this case the next write will start at
0056 the beginning of a new frame. Possible error codes are:
0057 
0058 EAGAIN
0059     Non-blocking I/O has been selected using the
0060     :ref:`O_NONBLOCK <func-open>` flag and no buffer space was
0061     available to write the data immediately.
0062 
0063 EBADF
0064     ``fd`` is not a valid file descriptor or is not open for writing.
0065 
0066 EBUSY
0067     The driver does not support multiple write streams and the device is
0068     already in use.
0069 
0070 EFAULT
0071     ``buf`` references an inaccessible memory area.
0072 
0073 EINTR
0074     The call was interrupted by a signal before any data was written.
0075 
0076 EIO
0077     I/O error. This indicates some hardware problem.
0078 
0079 EINVAL
0080     The :c:func:`write()` function is not supported by this driver,
0081     not on this device, or generally not on this type of device.