]>
Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
3 | .. _func-write: | |
4 | ||
5 | ************ | |
6 | V4L2 write() | |
7 | ************ | |
8 | ||
9 | *man v4l2-write(2)* | |
10 | ||
11 | Write to a V4L2 device | |
12 | ||
13 | ||
14 | Synopsis | |
15 | ======== | |
16 | ||
17 | .. code-block:: c | |
18 | ||
19 | #include <unistd.h> | |
20 | ||
21 | ||
b7e67f6c | 22 | .. cpp:function:: ssize_t write( int fd, void *buf, size_t count ) |
5377d91f MH |
23 | |
24 | Arguments | |
25 | ========= | |
26 | ||
27 | ``fd`` | |
28 | File descriptor returned by :ref:`open() <func-open>`. | |
29 | ||
30 | ``buf`` | |
31 | ``count`` | |
32 | ||
33 | ||
34 | Description | |
35 | =========== | |
36 | ||
37 | :c:func:`write()` writes up to ``count`` bytes to the device | |
38 | referenced by the file descriptor ``fd`` from the buffer starting at | |
39 | ``buf``. When the hardware outputs are not active yet, this function | |
40 | enables them. When ``count`` is zero, :c:func:`write()` returns 0 | |
41 | without any other effect. | |
42 | ||
43 | When the application does not provide more data in time, the previous | |
44 | video frame, raw VBI image, sliced VPS or WSS data is displayed again. | |
45 | Sliced Teletext or Closed Caption data is not repeated, the driver | |
46 | inserts a blank line instead. | |
47 | ||
48 | ||
49 | Return Value | |
50 | ============ | |
51 | ||
52 | On success, the number of bytes written are returned. Zero indicates | |
53 | nothing was written. On error, -1 is returned, and the ``errno`` | |
54 | variable is set appropriately. In this case the next write will start at | |
55 | the beginning of a new frame. Possible error codes are: | |
56 | ||
57 | EAGAIN | |
58 | Non-blocking I/O has been selected using the | |
59 | :ref:`O_NONBLOCK <func-open>` flag and no buffer space was | |
60 | available to write the data immediately. | |
61 | ||
62 | EBADF | |
63 | ``fd`` is not a valid file descriptor or is not open for writing. | |
64 | ||
65 | EBUSY | |
66 | The driver does not support multiple write streams and the device is | |
67 | already in use. | |
68 | ||
69 | EFAULT | |
70 | ``buf`` references an inaccessible memory area. | |
71 | ||
72 | EINTR | |
73 | The call was interrupted by a signal before any data was written. | |
74 | ||
75 | EIO | |
76 | I/O error. This indicates some hardware problem. | |
77 | ||
78 | EINVAL | |
79 | The :c:func:`write()` function is not supported by this driver, | |
80 | not on this device, or generally not on this type of device. |