1 .. -*- coding: utf-8; mode: rst -*-
12 lirc-read - Read from a LIRC device
23 .. c:function:: ssize_t read( int fd, void *buf, size_t count )
31 File descriptor returned by ``open()``.
37 Max number of bytes to read
42 :ref:`read() <lirc-read>` attempts to read up to ``count`` bytes from file
43 descriptor ``fd`` into the buffer starting at ``buf``. If ``count`` is zero,
44 :ref:`read() <lirc-read>` returns zero and has no other results. If ``count``
45 is greater than ``SSIZE_MAX``, the result is unspecified.
47 The exact format of the data depends on what :ref:`lirc_modes` a driver
48 uses. Use :ref:`lirc_get_features` to get the supported mode.
50 The generally preferred mode for receive is
51 :ref:`LIRC_MODE_MODE2 <lirc-mode-mode2>`,
52 in which packets containing an int value describing an IR signal are
53 read from the chardev.
58 On success, the number of bytes read is returned. It is not an error if
59 this number is smaller than the number of bytes requested, or the amount
60 of data required for one frame. On error, -1 is returned, and the ``errno``
61 variable is set appropriately.