1 .. -*- coding: utf-8; mode: rst -*-
12 lirc-read - Read from a LIRC device
23 .. cpp:function:: ssize_t read( int fd, void *buf, size_t count )
30 File descriptor returned by ``open()``.
39 :ref:`read() <lirc-read>` attempts to read up to ``count`` bytes from file
40 descriptor ``fd`` into the buffer starting at ``buf``. If ``count`` is zero,
41 :ref:`read() <lirc-read>` returns zero and has no other results. If ``count``
42 is greater than ``SSIZE_MAX``, the result is unspecified.
44 The lircd userspace daemon reads raw IR data from the LIRC chardev. The
45 exact format of the data depends on what modes a driver supports, and
46 what mode has been selected. lircd obtains supported modes and sets the
47 active mode via the ioctl interface, detailed at :ref:`lirc_func`.
48 The generally preferred mode for receive is
49 :ref:`LIRC_MODE_MODE2 <lirc-mode-mode2>`, in which packets containing an
50 int value describing an IR signal are read from the chardev.
53 `http://www.lirc.org/html/technical.html <http://www.lirc.org/html/technical.html>`__
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.