LIRCD(8)
β¨ NAME β¨
lircd β decode infrared signals and serve them up on a socket, bestie. π
(Also: this is a System Administration Utilities page, section 8. That's the lircd(8) energy. π«Ά)
π¦ SYNOPSIS π¦
lircd [options] [config file]
πΈ DESCRIPTION πΈ
Okay so here's the whole vibe: the main task of lircd is decoding infrared signals and giving client apps one uniform interface to talk to. No chaos, no "every app speaks a different dialect", just one pretty little door.
Clients connect to lircd through a Unix domain socket, and by default that's /var/run/lirc/lircd. Through that socket they get the infrared codes lircd received, and they can also send commands to lircd. Two-way street, main character behavior. π
π ARGUMENTS π
config fileβ the config file, by default/etc/lirc/lircd.conf. A relative path gets interpreted from/etc/lirc. And the default configuration file? It includes all the files in/etc/lircd.conf.d.
Every remote that should be decoded by lircd usually needs its own specific file, e.g. by copying it to /etc/lirc/lirc.conf.d/. The format is described over in lircd.conf(5). You can find config files using irdb-get(1) or lirc-setup(1). And it's also possible to generate a config file using irrecord(1). DIY queen behavior. π§
π OPTIONS π
π Common options
-d,--device <device>β pick the character devicelircdshould read from. The default is currently/dev/lirc0on most systems.
Some drivers, including the default devinput driver, support the auto device, which picks the first usable device found for the actual driver. β¨
When you're using the devinput driver, name=STRING or phys=STRING can be used to select the device; lircd will look in /dev/input to find a device with a matching description. Super useful when the device name isn't fixed. STRING may contain the '*' and '?' wildcards and '\' to mark them as literal. To list the actual devices, run mode2 --driver devinput --list-devices.
-H,--driver <driver>β the driver to use. Using--driver helplists all available drivers, see DRIVER LOADING below. π-h,--helpβ displays a short help message. Short king. π«
π Other options
-a,--allow-simulateβ enable theSIMULATEcommand, which can be issued usingirsend(1)or the client API. This will allow simulating arbitrary IR events straight from the command line.
Use this option with caution, because it will give all users with access to the lircd socket wide control over the system. E.g., if you have configured your system to shut down by a button press on your remote control, everybody will be able to shut down your system from the command line. π That's not a vibe. That's a security situation.
-c,--connect [host[:port]][,[host[:port]]]β connects to otherlircdservers that provide a network socket at the given host and port number (see--listen). The number of such connections is currently limited to 100. The connectinglircdinstance will receive IR events from thelircdinstance it connects to. To connect to multiple servers, add them as a comma separated list. π₯-e,--effective-user <uid>β if started as user root,lircddrops its privileges and runs as user<uid>after opening files etc. Glow-down, not glow-up, but make it security. π-i,--immediate-initβlircdnormally initializes the driver when the first client connects. If this option is selected, the driver is instead initialized immediately at start. No waiting around. β-A,--driver-options key:value[|key:value...]β set one or more options for the driver. The argument is a list ofkey:valuepairs delimited by'|'. The key can not contain spaces, but spaces are allowed in the value part. Certain characters including'#'and';'are used as comment markers in the config file and are not allowed anywhere. π«-Y,--dynamic-codes[EXPERIMENTAL] β allows use of codes which have been decoded for one remote but are not defined inlircd.conf. New codes are dynamically created with a default name.
This feature is experimental and subject to all sorts of changes. It has not ben tested thoroughly. (That typo is in the original, bestie, we keep the lore. π) Proceed with the understanding that this is a situationship, not a commitment.
-l,--listen [[address:]port]]β letlircdlisten for network connections on the given address/port. The default address is0.0.0.0, which means connections on all network interfaces will be accepted. The address must be given in dotted numerical form. Port defaults to8765. The listeninglircdinstance will send all IR events to the connectinglircdinstances without any security checks. π
On non-glibc platforms the address:port argument is mandatory, but can be given as an empty string e.g. --listen= which then defaults to 0.0.0.0:8765.
-L,--logfile <logfile path>β select thelircddaemon log file.logfileis either the string'syslog', indicating thatsyslog(1)should be used, or a log file path. The default is to use syslog. π-D,--loglevel [level]β determine the amount of logging information.levelcan be a symbolic syslog level:'error','warning','info','notice'or'debug'.lircdalso defines three additional levels,'trace','trace1'and'trace2', which give even more messages ('trace2'bringing the most). However, in the log these messages are marked as'debug'.
On non-glibc platforms the level argument is mandatory, but can be given as an empty string e.g. --loglevel= which then defaults to debug.
The level can also be an integer in the range 3 (almost no messages) to 10.
-O,--options-file <path>β file containing default values for all options. A relative path is interpreted from the current directory. See [FILES] below. π-o,--output <output socket>β select the Unix domain socket whichlircdwill write remote key codes to. The default currently is/var/run/lirc/lircd. πΈ-p,--permission <perm>β gives the file permission of the output socket if it has to be created, in octal representation. Seechmod(1). If no--permissionoption is given when the socket is initially created, the default is to give all users read and write permissions (0666in octal representation). If the socket already exists, this option has no effect.-p,--pidfile <path>β select thelircddaemon pid file, defaults to/var/run/lirc/lircd.pid.
Yes, -p really is listed twice in the original page. Both of them. We don't fix it, we respect it. π
-U,--plugindir <path>β sets the directory from whichlircdloads its userspace drivers. These are*.sofiles, by default found as described under DRIVER LOADING. The argument is a:-separated search path. π¦-R,--repeat-max <limit>β sets an upper limit to the number of repeats when sending a signal. The current default is 600. ASEND_STARTrequest will repeat the signal this many times. Also, if the number of repeats in aSEND_ONCErequest exceeds this number, it will be replaced by this number. π
π SOCKET BROADCAST MESSAGES FORMAT π
When decoding a button press or receiving a SIGHUP signal, lircd broadcasts messages to all connected clients. π’
For each decoded button press a package is made available on the socket. This is printable data formatted as:
<code> <repeat count> <button name> <remote control name>
e.g.,
0000000000f40bf0 00 KEY_UP ANIMAX
The fields are:
codeβ a 16 hexadecimal digits number encoding of the IR signal. Its usage in applications is deprecated and it should be ignored. πrepeat countβ shows how long the user has been holding down a button. The counter will start at0and increment each time a new IR signal has been received.button nameβ is the name of a key defined in thelircd.conffile.remote control nameβ is the mandatorynameattribute in thelircd.confconfig file. π
These packets are broadcasted to all clients. The only other situation when lircd broadcasts to all clients is when it receives the SIGHUP signal and successfully re-reads its config file. Then it will send a SIGHUP packet to its clients indicating that its configuration might have changed. The sighup packet is three lines:
BEGIN
SIGHUP
END
β¨ SOCKET COMMAND INTERFACE β¨
okay so bestie, applications can also slide commands into lircd over the socket interface. The most common task is sending data, but there are also other commands. Each command is a single printable line, terminated with a newline. For each command, lircd replies with a reply package. π¬
Supported commands β let's go:
SEND_ONCE <remote control> <button name> [repeats]β Telllircdto send the IR signal associated with the given remote control and button name, and then repeat itrepeatstimes.repeatsis a decimal number between0andrepeat_max. The latter can be given as a--repeat-maxcommand line argument tolircd, and defaults to600. Ifrepeatsis not specified or is less than the minimum number of repeats for the selected remote control, the minimum value will be used. πSEND_START <remote control name> <button name>β Telllircdto start repeating the given button until it receives aSEND_STOPcommand. However, the number of repeats is limited torepeat_max.lircdwon't accept any new send commands while it is repeating. π«SEND_STOP <remote control name> <button name>β Telllircdto abort aSEND_STARTcommand. πLIST [remote control]β Without argumentslircdreplies with a list of all defined remote controls. Given a remote control argument,lircdreplies with a list of all keys defined in the given remote. πSET_INPUTLOG [path]β Given a path,lircdwill start logging all received data on that file. The log is printable lines as defined inmode2(1)describing pulse/space durations. Without a path, current logfile is closed and the logging is stopped. πDRV_OPTION key valueβ Makelircdinvoke thedrvctl_func(DRVCTL_SET_OPTION, option)withoptionbeing made up by the parsedkeyandvalue. The return package reflects the outcome of thedrvctl_funccall. π§SIMULATE key dataβ Givenkey data, instructslircdto send this to all clients i. e., to simulate that this key has been decoded. Thekey datamust be formatted exactly as the packet described in [SOCKET BROADCAST MESSAGES FORMAT], notably is the number of digits incodeand repeat count hardcoded. This command is only accepted if the--allow-simulatecommand line option is active. β οΈSET_TRANSMITTERS transmitter maskβ Makelircdinvoke thedrvctl_func(LIRC_SET_TRANSMITTER_MASK, &channels), wherechannelsis the decoded value oftransmitter mask. Seelirc(4)for more information. π‘VERSIONβ Telllircdto send a version packet response. π·οΈ
The protocol guarantees that broadcasted messages won't interfere with reply packets. But broadcasts may appear at any point between packets. The only exception are SIGHUP packages. These may appear just after you have sent a command to lircd, so you have to make sure you don't confuse them with replies. π΅βπ«
The format of the reply packet is:
BEGIN
<command>
[SUCCESS|ERROR]
[DATA
n
n lines of data]
END
If the command was successful, data is only sent for the commands that return some information. Note that a packet containing 0 lines of data can be a valid reply. π
π RUNNING AS REGULAR USER π
Traditionally lircd has been running as root since accessing kernel devices like /dev/lirc0 by default requires root privileges. However, running a long-running service like this is a major security issue. π¨
The lirc distribution contains example udev rules which makes /dev/lirc[0-9] , USB and serial devices accessible by the lirc user. Using these rules, it is possible to run lircd as a regular user and group such as lirc. π«Ά
π FILES π
/etc/lirc/lircd.confβ Main config file, seelircd.conf(5). π/etc/lirc/lirc_options.confβ The options file.lircdhandles the values under the[lircd]section in this file. The location can be changed using the-O/--options-filecommand-line option or using the environment variableLIRC_OPTIONS_PATH. The values here are used as defaults for any option not present on command line. βοΈ
πΏ ENVIRONMENT πΏ
LIRC_OPTIONS_PATHβ Options file path, see FILES. ποΈLIRC_PLUGINDIRβ Plugin load path, see DRIVER LOADING. πLIRC_DEBUG_OPTIONSβ If set, enables debugging in early stages when the--debugoption is yet not parsed. π
π DRIVER LOADING π
Drivers are loaded dynamically. This is done from a traditional *ux :-separated path where each component in the path is searched (leading part first, trailing last). π£οΈ
The path used for this is determined by (falling priority):
- The
--plugindiroption. - The
'plugindir'entry in the[lircd]section of thelirc_options.conffile. - The environment variable
LIRC_PLUGINDIR. - A hardcoded default (
/usr/lib/x86_64-linux-gnu/lirc/plugins).
π¨ SIGNALS π¨
HUPβ On receivingSIGHUPlircdre-reads thelircd.confconfiguration file (but notlirc_options.conf) and adjusts itself if the file has changed. πUSR1β On receivingSIGUSR1lircdmakes a clean exit. π
π DAEMONS π
lircd is a daemon. It should be started in some system-dependent init script. By default, lirc ships with systemd files enabling user to control the lircd service. π
π SEE ALSO π
This iconic manual page is from lircd 0.10.2, last changed Jun 2017, and it's LIRCD(8) β no cap, that's the whole vibe πβ¨π
π¦ where this page comes from
- debian trixie: lirc 0.10.2-0.10 Β· GPL-2.0-or-later
- ubuntu noble: lirc 0.10.2-0.8build1 Β· GPL-2.0-or-later
- ubuntu questing: lirc 0.10.2-0.10build1
- ubuntu resolute: lirc 0.10.2-0.10ubuntu1 Β· GPL-2.0-or-later
- ubuntu stonking: lirc 0.10.2-0.11 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms