diff options
author | Rob Herring <robh@kernel.org> | 2020-06-12 09:57:00 -0600 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2020-06-12 09:57:00 -0600 |
commit | 8440d4a75d90556cfb8fb3e244443f67381aafd6 (patch) | |
tree | 2e1c986942c3beb6257121e52449f827a8ce4eaf /Documentation/userspace-api/media/v4l/func-write.rst | |
parent | scripts/dtc: use pkg-config to include <yaml.h> in non-standard path (diff) | |
parent | dt-bindings: Remove redundant 'maxItems' (diff) | |
download | wireguard-linux-8440d4a75d90556cfb8fb3e244443f67381aafd6.tar.xz wireguard-linux-8440d4a75d90556cfb8fb3e244443f67381aafd6.zip |
Merge branch 'dt/schema-cleanups' into dt/linus
Diffstat (limited to 'Documentation/userspace-api/media/v4l/func-write.rst')
-rw-r--r-- | Documentation/userspace-api/media/v4l/func-write.rst | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Documentation/userspace-api/media/v4l/func-write.rst b/Documentation/userspace-api/media/v4l/func-write.rst new file mode 100644 index 000000000000..fb1955f70f0f --- /dev/null +++ b/Documentation/userspace-api/media/v4l/func-write.rst @@ -0,0 +1,91 @@ +.. Permission is granted to copy, distribute and/or modify this +.. document under the terms of the GNU Free Documentation License, +.. Version 1.1 or any later version published by the Free Software +.. Foundation, with no Invariant Sections, no Front-Cover Texts +.. and no Back-Cover Texts. A copy of the license is included at +.. Documentation/userspace-api/media/fdl-appendix.rst. +.. +.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections + +.. _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 ) + :name: v4l2-write + +Arguments +========= + +``fd`` + File descriptor returned by :ref:`open() <func-open>`. + +``buf`` + Buffer with data to be written + +``count`` + Number of bytes at the buffer + +Description +=========== + +:ref:`write() <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, :ref:`write() <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 + ``buf`` references an inaccessible memory area. + +EINTR + The call was interrupted by a signal before any data was written. + +EIO + I/O error. This indicates some hardware problem. + +EINVAL + The :ref:`write() <func-write>` function is not supported by this driver, + not on this device, or generally not on this type of device. |