Driver Model

  |  +---------------------------------------------------------------+
S |  | 'gpm -t msc -m /var/run/lirc/lircm' or a well configured X    |
O |  | (see section 'Configuring lircmd') for details                |
F |  +--------------+------------------------------------------------+
T |                 |
W |   /var/run/lirc/lircm (named pipe (FIFO) ==> one connection)
A |                 |
R |     +-----------+-----------+   +----------------------------------+
E |     | mouse daemon (lircmd) |   | tools (irexec, irxevent, ...)    |
  |     | configured with       |   | configured with ~/.config/lircrc |
  |     | lircmd.conf           |   |                                  |
  |     +-----------+-----------+   +-----------+----------------------+
  |                 |                           |
  |                 +-------------+-------------+
  |                               |
  |              /var/run/lirc/lircd (socket ==> multiple connections)
  |                               |
S |              +----------------+--------------------------+
O |              | decoder daemon (lircd), irrecord or mode2 |    TCP/IP
F |              | lircd is configured through lircd.conf    +---  port
T | User space   |                                           |     8765
W |              +------------------+------------------------+
A |                                 |            |
R |                                 |            |
E |                                 |            |
  |                                 |   /dev/uinput (Linux input layer)
  |                                 |
  |                                 |
  +---------------------------------+----------------------------------
  | Kernel space                    |              (character device
  |                                 |                  driver ==>
  |                    +------------+----------+    one connection)
  |                    |                       |
  |                /dev/lirc               /dev/ttySx
  |                    |                       |
  |       +------------+-------------+   +-----+---------------+
  |       |  LIRC device driver      |   | Linux serial driver |
  |       | (with ioctl-interface)   |   |                     |
  |       +------------+-------------+   +----------+----------+
  |                    |                            |
--+--------------------+----------------------------+------------------
  |                    |                            |
  |         +----------+------------+               |
  |         |                       |               |
  | +-------+----------------+ +----+-----+ +-------+-----------------+
H | | serial / parallel port | | TV cards | | Irman/RemoteMaster/etc. |
W | +------------------------+ +----------+ +-------------------------+
  |

Formats


Writing LIRC userspace drivers

Since 0.9.0 the lirc kernel drivers have been upstreamed to the kernel. So, while developing kernel drivers might be important from a LIRC perspective, it's no longer part of this project.

Since 0.9.1, lirc user-space drivers (plugins) are loaded dynamically and compiled out-of-tree. Refer to the Driver API, the last chapter.


Writing Applications for LIRC

As LIRC is able to both receive and send IR commands there are two possible types of applications: programs that send IR commands liked irsend or programs that receive commands like irexec.

In both cases, the lirc_client api can be used, supporting both sending and receiving of data. Refer to the API documentation and the lirc_client api.

Another way is to connect directly to lircd's output socket and use the command interface. This is common in older code, often to send data (the ability to send data was added to the API 0.9.2). The lircd socket interface is described in the lircd manpage. Note that the routines in the client API can be used to send and receive arbitrary commands, not just to send IR data.


Writing LIRC configuration tools

For the kernel-setup and related stuff such as available drivers and remotes there are a number of YAML files in the configs/ directory. Here is also a large number of *.conf files which represents a configuration a user can choose. The formats are described in configs/README.

The lirc-setup tool contains a self-contained module database.py which provides a python interface to these files.

The information in the lircd.conf files can be parsed by the library routine read_config().Here is also code to dump modified data to a new file. However, this is only available in the lirc_private interface which by definition is unstable.

The lircrc file is parsed using the lirc_readconfig() in the lirc_client interface. There is no code to write modified data to a new file.


Adding new remote controls

New remotes are added to the database according to the lirc-remotes wiki.