Documentation/userspace-api/media/v4l/func-write.rst

Source file repositories/reference/linux-study-clean/Documentation/userspace-api/media/v4l/func-write.rst

File Facts

System
Linux kernel
Corpus path
Documentation/userspace-api/media/v4l/func-write.rst
Extension
.rst
Size
2009 bytes
Lines
82
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L

.. _func-write:

************
V4L2 write()
************

Name
====

v4l2-write - Write to a V4L2 device

Synopsis
========

.. code-block:: c

    #include <unistd.h>

.. c:function:: ssize_t write( int fd, void *buf, size_t count )

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``buf``
     Buffer with data to be written

``count``
    Number of bytes at the buffer

Description
===========

:c:func:`write()` writes up to ``count`` bytes to the device
referenced by the file descriptor ``fd`` from the buffer starting at
``buf``. When the hardware outputs are not active yet, this function
enables them. When ``count`` is zero, :c:func:`write()` returns 0
without any other effect.

When the application does not provide more data in time, the previous
video frame, raw VBI image, sliced VPS or WSS data is displayed again.
Sliced Teletext or Closed Caption data is not repeated, the driver
inserts a blank line instead.

Return Value
============

On success, the number of bytes written are returned. Zero indicates
nothing was written. On error, -1 is returned, and the ``errno``
variable is set appropriately. In this case the next write will start at
the beginning of a new frame. Possible error codes are:

EAGAIN
    Non-blocking I/O has been selected using the
    :ref:`O_NONBLOCK <func-open>` flag and no buffer space was
    available to write the data immediately.

EBADF
    ``fd`` is not a valid file descriptor or is not open for writing.

EBUSY
    The driver does not support multiple write streams and the device is
    already in use.

EFAULT

Annotation

Implementation Notes