• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>V4L2 write()</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9REL="HOME"
10TITLE="Video for Linux Two API Specification"
11HREF="book1.htm"><LINK
12REL="UP"
13TITLE="Function Reference"
14HREF="r7624.htm"><LINK
15REL="PREVIOUS"
16TITLE="V4L2 select()"
17HREF="r14390.htm"><LINK
18REL="NEXT"
19TITLE="V4L2 Driver Programming"
20HREF="c14592.htm"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFFFFF"
24TEXT="#000000"
25LINK="#0000FF"
26VLINK="#840084"
27ALINK="#0000FF"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>Video for Linux Two API Specification: Revision 0.24</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="r14390.htm"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="c14592.htm"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="FUNC-WRITE"
74></A
75>V4L2 write()</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN14500"
80></A
81><H2
82>Name</H2
83>v4l2-write&nbsp;--&nbsp;Write to a V4L2 device</DIV
84><DIV
85CLASS="REFSYNOPSISDIV"
86><A
87NAME="AEN14503"
88></A
89><H2
90>Synopsis</H2
91><DIV
92CLASS="FUNCSYNOPSIS"
93><P
94></P
95><A
96NAME="AEN14504"
97></A
98><PRE
99CLASS="FUNCSYNOPSISINFO"
100>#include &lt;unistd.h&gt;</PRE
101><P
102><CODE
103><CODE
104CLASS="FUNCDEF"
105>ssize_t write</CODE
106>(int fd, void *buf, size_t count);</CODE
107></P
108><P
109></P
110></DIV
111></DIV
112><DIV
113CLASS="REFSECT1"
114><A
115NAME="AEN14515"
116></A
117><H2
118>Arguments</H2
119><P
120></P
121><DIV
122CLASS="VARIABLELIST"
123><DL
124><DT
125><CODE
126CLASS="PARAMETER"
127>fd</CODE
128></DT
129><DD
130><P
131>File descriptor returned by <A
132HREF="r14090.htm"
133><CODE
134CLASS="FUNCTION"
135>open()</CODE
136></A
137>.</P
138></DD
139><DT
140><CODE
141CLASS="PARAMETER"
142>buf</CODE
143></DT
144><DD
145><P
146></P
147></DD
148><DT
149><CODE
150CLASS="PARAMETER"
151>count</CODE
152></DT
153><DD
154><P
155></P
156></DD
157></DL
158></DIV
159></DIV
160><DIV
161CLASS="REFSECT1"
162><A
163NAME="AEN14535"
164></A
165><H2
166>Description</H2
167><P
168><CODE
169CLASS="FUNCTION"
170>write()</CODE
171> writes up to
172<CODE
173CLASS="PARAMETER"
174>count</CODE
175> bytes to the device referenced by the
176file descriptor <CODE
177CLASS="PARAMETER"
178>fd</CODE
179> from the buffer starting at
180<CODE
181CLASS="PARAMETER"
182>buf</CODE
183>. When the hardware outputs are not active
184yet, this function enables them. When <CODE
185CLASS="PARAMETER"
186>count</CODE
187> is
188zero, <CODE
189CLASS="FUNCTION"
190>write()</CODE
191> returns
192<SPAN
193CLASS="RETURNVALUE"
194>0</SPAN
195> without any other effect.</P
196><P
197>When the application does not provide more data in time, the
198previous video frame, raw VBI image, sliced VPS or WSS data is
199displayed again. Sliced Teletext or Closed Caption data is not
200repeated, the driver inserts a blank line instead.</P
201></DIV
202><DIV
203CLASS="REFSECT1"
204><A
205NAME="AEN14546"
206></A
207><H2
208>Return Value</H2
209><P
210>On success, the number of bytes written are returned. Zero
211indicates nothing was written. On error, <SPAN
212CLASS="RETURNVALUE"
213>-1</SPAN
214>
215is returned, and the <CODE
216CLASS="VARNAME"
217>errno</CODE
218> variable is set
219appropriately. In this case the next write will start at the beginning
220of a new frame. Possible error codes are:</P
221><P
222></P
223><DIV
224CLASS="VARIABLELIST"
225><DL
226><DT
227><SPAN
228CLASS="ERRORCODE"
229>EAGAIN</SPAN
230></DT
231><DD
232><P
233>Non-blocking I/O has been selected using the <A
234HREF="r14090.htm"
235><CODE
236CLASS="CONSTANT"
237>O_NONBLOCK</CODE
238></A
239> flag and no
240buffer space was available to write the data immediately.</P
241></DD
242><DT
243><SPAN
244CLASS="ERRORCODE"
245>EBADF</SPAN
246></DT
247><DD
248><P
249><CODE
250CLASS="PARAMETER"
251>fd</CODE
252> is not a valid file
253descriptor or is not open for writing.</P
254></DD
255><DT
256><SPAN
257CLASS="ERRORCODE"
258>EBUSY</SPAN
259></DT
260><DD
261><P
262>The driver does not support multiple write streams and the
263device is already in use.</P
264></DD
265><DT
266><SPAN
267CLASS="ERRORCODE"
268>EFAULT</SPAN
269></DT
270><DD
271><P
272><CODE
273CLASS="PARAMETER"
274>buf</CODE
275> references an inaccessible
276memory area.</P
277></DD
278><DT
279><SPAN
280CLASS="ERRORCODE"
281>EINTR</SPAN
282></DT
283><DD
284><P
285>The call was interrupted by a signal before any
286data was written.</P
287></DD
288><DT
289><SPAN
290CLASS="ERRORCODE"
291>EIO</SPAN
292></DT
293><DD
294><P
295>I/O error. This indicates some hardware problem.</P
296></DD
297><DT
298><SPAN
299CLASS="ERRORCODE"
300>EINVAL</SPAN
301></DT
302><DD
303><P
304>The <CODE
305CLASS="FUNCTION"
306>write()</CODE
307> function is not
308supported by this driver, not on this device, or generally not on this
309type of device.</P
310></DD
311></DL
312></DIV
313></DIV
314><DIV
315CLASS="NAVFOOTER"
316><HR
317ALIGN="LEFT"
318WIDTH="100%"><TABLE
319SUMMARY="Footer navigation table"
320WIDTH="100%"
321BORDER="0"
322CELLPADDING="0"
323CELLSPACING="0"
324><TR
325><TD
326WIDTH="33%"
327ALIGN="left"
328VALIGN="top"
329><A
330HREF="r14390.htm"
331ACCESSKEY="P"
332>Prev</A
333></TD
334><TD
335WIDTH="34%"
336ALIGN="center"
337VALIGN="top"
338><A
339HREF="book1.htm"
340ACCESSKEY="H"
341>Home</A
342></TD
343><TD
344WIDTH="33%"
345ALIGN="right"
346VALIGN="top"
347><A
348HREF="c14592.htm"
349ACCESSKEY="N"
350>Next</A
351></TD
352></TR
353><TR
354><TD
355WIDTH="33%"
356ALIGN="left"
357VALIGN="top"
358>V4L2 select()</TD
359><TD
360WIDTH="34%"
361ALIGN="center"
362VALIGN="top"
363><A
364HREF="r7624.htm"
365ACCESSKEY="U"
366>Up</A
367></TD
368><TD
369WIDTH="33%"
370ALIGN="right"
371VALIGN="top"
372>V4L2 Driver Programming</TD
373></TR
374></TABLE
375></DIV
376></BODY
377></HTML
378>
379