1 <refentry id="func-write">
3 <refentrytitle>V4L2 write()</refentrytitle>
8 <refname>v4l2-write</refname>
9 <refpurpose>Write to a V4L2 device</refpurpose>
14 <funcsynopsisinfo>#include <unistd.h></funcsynopsisinfo>
16 <funcdef>ssize_t <function>write</function></funcdef>
17 <paramdef>int <parameter>fd</parameter></paramdef>
18 <paramdef>void *<parameter>buf</parameter></paramdef>
19 <paramdef>size_t <parameter>count</parameter></paramdef>
25 <title>Arguments</title>
29 <term><parameter>fd</parameter></term>
35 <term><parameter>buf</parameter></term>
41 <term><parameter>count</parameter></term>
50 <title>Description</title>
52 <para><function>write()</function> writes up to
53 <parameter>count</parameter> bytes to the device referenced by the
54 file descriptor <parameter>fd</parameter> from the buffer starting at
55 <parameter>buf</parameter>. When the hardware outputs are not active
56 yet, this function enables them. When <parameter>count</parameter> is
57 zero, <function>write()</function> returns
58 <returnvalue>0</returnvalue> without any other effect.</para>
60 <para>When the application does not provide more data in time, the
61 previous video frame, raw VBI image, sliced VPS or WSS data is
62 displayed again. Sliced Teletext or Closed Caption data is not
63 repeated, the driver inserts a blank line instead.</para>
67 <title>Return Value</title>
69 <para>On success, the number of bytes written are returned. Zero
70 indicates nothing was written. On error, <returnvalue>-1</returnvalue>
71 is returned, and the <varname>errno</varname> variable is set
72 appropriately. In this case the next write will start at the beginning
73 of a new frame. Possible error codes are:</para>
77 <term><errorcode>EAGAIN</errorcode></term>
79 <para>Non-blocking I/O has been selected using the <link
80 linkend="func-open"><constant>O_NONBLOCK</constant></link> flag and no
81 buffer space was available to write the data immediately.</para>
85 <term><errorcode>EBADF</errorcode></term>
87 <para><parameter>fd</parameter> is not a valid file
88 descriptor or is not open for writing.</para>
92 <term><errorcode>EBUSY</errorcode></term>
94 <para>The driver does not support multiple write streams and the
95 device is already in use.</para>
99 <term><errorcode>EFAULT</errorcode></term>
101 <para><parameter>buf</parameter> references an inaccessible
106 <term><errorcode>EINTR</errorcode></term>
108 <para>The call was interrupted by a signal before any
109 data was written.</para>
113 <term><errorcode>EIO</errorcode></term>
115 <para>I/O error. This indicates some hardware problem.</para>
119 <term><errorcode>EINVAL</errorcode></term>
121 <para>The <function>write()</function> function is not
122 supported by this driver, not on this device, or generally not on this
123 type of device.</para>
133 sgml-parent-document: "v4l2.sgml"
134 indent-tabs-mode: nil