162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci.. c:namespace:: V4L 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci.. _func-write: 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci************ 762306a36Sopenharmony_ciV4L2 write() 862306a36Sopenharmony_ci************ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciName 1162306a36Sopenharmony_ci==== 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_civ4l2-write - Write to a V4L2 device 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciSynopsis 1662306a36Sopenharmony_ci======== 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci.. code-block:: c 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci #include <unistd.h> 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci.. c:function:: ssize_t write( int fd, void *buf, size_t count ) 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ciArguments 2562306a36Sopenharmony_ci========= 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci``fd`` 2862306a36Sopenharmony_ci File descriptor returned by :c:func:`open()`. 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci``buf`` 3162306a36Sopenharmony_ci Buffer with data to be written 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci``count`` 3462306a36Sopenharmony_ci Number of bytes at the buffer 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciDescription 3762306a36Sopenharmony_ci=========== 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci:c:func:`write()` writes up to ``count`` bytes to the device 4062306a36Sopenharmony_cireferenced by the file descriptor ``fd`` from the buffer starting at 4162306a36Sopenharmony_ci``buf``. When the hardware outputs are not active yet, this function 4262306a36Sopenharmony_cienables them. When ``count`` is zero, :c:func:`write()` returns 0 4362306a36Sopenharmony_ciwithout any other effect. 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ciWhen the application does not provide more data in time, the previous 4662306a36Sopenharmony_civideo frame, raw VBI image, sliced VPS or WSS data is displayed again. 4762306a36Sopenharmony_ciSliced Teletext or Closed Caption data is not repeated, the driver 4862306a36Sopenharmony_ciinserts a blank line instead. 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ciReturn Value 5162306a36Sopenharmony_ci============ 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ciOn success, the number of bytes written are returned. Zero indicates 5462306a36Sopenharmony_cinothing was written. On error, -1 is returned, and the ``errno`` 5562306a36Sopenharmony_civariable is set appropriately. In this case the next write will start at 5662306a36Sopenharmony_cithe beginning of a new frame. Possible error codes are: 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ciEAGAIN 5962306a36Sopenharmony_ci Non-blocking I/O has been selected using the 6062306a36Sopenharmony_ci :ref:`O_NONBLOCK <func-open>` flag and no buffer space was 6162306a36Sopenharmony_ci available to write the data immediately. 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ciEBADF 6462306a36Sopenharmony_ci ``fd`` is not a valid file descriptor or is not open for writing. 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ciEBUSY 6762306a36Sopenharmony_ci The driver does not support multiple write streams and the device is 6862306a36Sopenharmony_ci already in use. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciEFAULT 7162306a36Sopenharmony_ci ``buf`` references an inaccessible memory area. 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ciEINTR 7462306a36Sopenharmony_ci The call was interrupted by a signal before any data was written. 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ciEIO 7762306a36Sopenharmony_ci I/O error. This indicates some hardware problem. 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ciEINVAL 8062306a36Sopenharmony_ci The :c:func:`write()` function is not supported by this driver, 8162306a36Sopenharmony_ci not on this device, or generally not on this type of device. 82