Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
4ed030af | 3 | .. _lirc-write: |
5377d91f | 4 | |
8a6ba5c0 MCC |
5 | ************ |
6 | LIRC write() | |
7 | ************ | |
8 | ||
9 | Name | |
10 | ==== | |
11 | ||
12 | lirc-write - Write to a LIRC device | |
13 | ||
14 | ||
15 | Synopsis | |
16 | ======== | |
17 | ||
18 | .. code-block:: c | |
19 | ||
20 | #include <unistd.h> | |
21 | ||
22 | ||
1b81f010 | 23 | .. c:function:: ssize_t write( int fd, void *buf, size_t count ) |
15c19014 | 24 | :name: lirc-write |
8a6ba5c0 MCC |
25 | |
26 | Arguments | |
27 | ========= | |
28 | ||
29 | ``fd`` | |
30 | File descriptor returned by ``open()``. | |
31 | ||
32 | ``buf`` | |
15c19014 | 33 | Buffer with data to be written |
8a6ba5c0 | 34 | |
15c19014 MCC |
35 | ``count`` |
36 | Number of bytes at the buffer | |
8a6ba5c0 MCC |
37 | |
38 | Description | |
39 | =========== | |
40 | ||
4ed030af | 41 | :ref:`write() <lirc-write>` writes up to ``count`` bytes to the device |
8a6ba5c0 MCC |
42 | referenced by the file descriptor ``fd`` from the buffer starting at |
43 | ``buf``. | |
5377d91f MH |
44 | |
45 | The data written to the chardev is a pulse/space sequence of integer | |
46 | values. Pulses and spaces are only marked implicitly by their position. | |
47 | The data must start and end with a pulse, therefore, the data must | |
48 | always include an uneven number of samples. The write function must | |
49 | block until the data has been transmitted by the hardware. If more data | |
cdb4af0f | 50 | is provided than the hardware can send, the driver returns ``EINVAL``. |
8a6ba5c0 MCC |
51 | |
52 | ||
53 | Return Value | |
54 | ============ | |
55 | ||
56 | On success, the number of bytes read is returned. It is not an error if | |
57 | this number is smaller than the number of bytes requested, or the amount | |
58 | of data required for one frame. On error, -1 is returned, and the ``errno`` | |
59 | variable is set appropriately. The generic error codes are described at the | |
60 | :ref:`Generic Error Codes <gen-errors>` chapter. |