1 .. -*- coding: utf-8; mode: rst -*-
12 lirc-write - Write to a LIRC device
23 .. c:function:: ssize_t write( int fd, void *buf, size_t count )
30 File descriptor returned by ``open()``.
33 Buffer with data to be written
36 Number of bytes at the buffer
41 :ref:`write() <lirc-write>` writes up to ``count`` bytes to the device
42 referenced by the file descriptor ``fd`` from the buffer starting at
45 The exact format of the data depends on what mode a driver uses, use
46 :ref:`lirc_get_features` to get the supported mode.
48 When in :ref:`LIRC_MODE_PULSE <lirc-mode-PULSE>` mode, the data written to
49 the chardev is a pulse/space sequence of integer values. Pulses and spaces
50 are only marked implicitly by their position. The data must start and end
51 with a pulse, therefore, the data must always include an uneven number of
52 samples. The write function must block until the data has been transmitted
53 by the hardware. If more data is provided than the hardware can send, the
54 driver returns ``EINVAL``.
59 On success, the number of bytes read is returned. It is not an error if
60 this number is smaller than the number of bytes requested, or the amount
61 of data required for one frame. On error, -1 is returned, and the ``errno``
62 variable is set appropriately. The generic error codes are described at the
63 :ref:`Generic Error Codes <gen-errors>` chapter.