irrecord [-f] [-n] [-H driver] [-d device] [file]
irrecord -a <file>
irrecord --help | --version
This program will record the signals from your remote control and create a config file for lircd. Although a good deal of effort is put in this program it is often not possible to automatically recognize all features of a remote control. See Usage Notes below.
If file is not specified it defaults to "irrecord.lircd.conf"
If file already exists and contains a valid config irrecord will use the protocol description found there and will only try to record the buttons.
- -a --analyse
Analyse a raw_codes config file, trying to convert it to a regular configuration.
- -u --update
Add new buttons to an existing config file. No protocol information is updated.
- -f --force
Force raw mode. Use this if recording fails otherwise. This creates a raw codes configuration file which can be used as-is or converted using the -a option.
- -n --disable-namespace
Disable namespace checks.
- -l --list-namespace
List valid button names.
- -H --driver=driver
Use given driver. -H help lists available drivers.
- -d --device=device
Read from given device. Use mode2(1) --list-devices to list available devices for a driver.
- -U --plugindir=directory
Load drivers from directory. See DRIVER LOADING.
- -k --keep-root
Don't drop root privileges after opening device. See Running As Root.
- -A, --driver-options key:value[|key:value...]
Set one or more options for the driver. The argument is a list of key:value pairs delimited by '|'. The key can not contain spaces, but such are allowed in the value part. Certain characters including '#' and ';' are used as comment markers in the config file and are not allowed anywhere.
- -D --loglevel=level
Determine the amount of logging information. [level] can be a symbolic syslog level: 'error','warning, 'info', 'notice' or 'debug'. lirc also defines three additional levels 'trace', 'trace1' and 'trace2' which gives even more messages ('trace2' bringing the most). However, in the log these messages are marked as '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 current directory. See [Files] below.
- -h --help
Display this message.
- -v --version
The primary options are --driver and usually also --device (some drivers does not need --device). These could be verified using mode2(1) if irrecord runs into trouble.
When driver and device is known it saves some work to update lirc_options.conf with the new values. irrecord uses the [lircd] section as a fallback, so with a proper lirc_options.conf irrecord could be run without command line options.
Using an existing file as a template can sometimes be required for irrecord to work. If using one of the generic templates it can also provide better timing. See Protocol Parameters and Templates.
If the program fails to recognize the protocol of the remote control you could use the --force option to at least create a config file in raw mode.
After recording some buttons with irrecord, you should check the repeat masks. These are needed in order to handle repeated button presses, which are very common
Using the config file, start lircd and irw. Keeping a button pressed down, you should see something like:<
0000000000f40bf0 00 KEY_1 ANIMAX 0000000000f40bf0 01 KEY_1 ANIMAX 0000000000f40bf0 02 KEY_1 ANIMAX 0000000000f40bf0 03 KEY_1 ANIMAX 0000000000f40bf0 04 KEY_1 ANIMAX 0000000000f40bf0 05 KEY_1 ANIMAX
Note how the second field gets incremented. This must work for correct operation.
Protocol Parameters and Templates.
irrecord actually works in two phases. In the first, it tries to identify the protocol used by the remote. Although this often works quite well, there are advantages using an existing file as a template.
One reason to use a template is when irrecord fails to recognize the protocol in the beginning. In such cases, try to find an existing configuration from the same vendor using something like:
$ irdb-get find motorola # lots of remotes listed... $ irdb-get download motorola/VIP_1200.lircd.conf # Pick any $ cp VIP_1200.lircd.conf my_remote.lircd.conf $ irrecord my_remote.lircd.conf
Invoking irrecord this way re-uses the existing protocol which usually works (vendors seldom changes protocol parameters).
Another reason to use an existing file is to get more exact timing, important when planning to also transmit (blast). In such cases, using a generic template found using irdb-get find generic has advantages since the timing values here are hand-crafted from specifications. To use these, you need to know which protocol your remote uses, though.
If decoding of IR commands does not work reliably you can try to modify the eps and aeps values in the lircd config file to adjust the tolerance of signal lengths. aeps is an absolute value while eps is a relative value expressed in percent. See lircd.conf(5)
Some remotes actually emulates two or more remotes. irrecord runs into trouble if buttons from different logical remotes are mixed in the same run, in particular in the initial protocol identification. For such devices, irrecord must be invoked once for every logical device using only buttons from this device during the run.
Un-printable garbage when using default driver
If there is various non-printable garbage on the screen when running irrecord when using the default driver the rc protocol needs to be set. With a single device the protocol can be set and inspected using
sudo sh -c "echo 'lirc' > /sys/class/rc/rc0/protocol" cat /sys/class/rc/rc0/protocol
As for physical disturbances, the primary source is fluorescent light. You should not have any such light around when using irrecord. It's also important to have a suitable distance between the remote and the capture device, which often is smaller than in typical, normal usage. However, making the distance too small might cause other problems. At a first try use a foot or two.
Driver Load Path
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 --plugindir option.
- The 'plugindir' entry in the [lircd] section of the lirc_options.conf file.
- The environment variable LIRC_PLUGINDIR.
- A hardcoded default (/usr/lib64/lirc/plugins).
Running As Root
In many cases irrecord needs to run as root to access devices not available to regular users. On the other hand, running as root creates problems such as log files owned by root, security concerns etc.
In order to cope with this, irrecord by default drops root privileges after opening the input device. This support is based on that root permissions are accquired using sudo(1) e. g., using
$ sudo irrecord --device /dev/lirc0 --driver default
If not using sudo, the same behaviour could be accomplished using the SUDO_USER environment variable e. g.,
# SUDO_USER=$LOGNAME irrecord --device /dev/lirc0 --driver default
The --keep-root option will make irrecord to keep root privileges for the complete run.
The options file holding default values for command line options in the [irrecord] section. For some values including debug, plugindir, driver and device irrecord falls back to the [lircd] section if not found in [irrecord].
The location of this file can be changed using the -O/--options-file command-line option or using the environment variable LIRC_OPTIONS_PATH.
Debug output. Setting the XDG_CACHE_HOME environment variable relocates this file to $XDG_CACHE_HOME/irrecord.log
irsend(1), lircd(8), lircd.conf(5), lircd-uinput(8).