How to configure LIRC - stb-tester/stb-tester GitHub Wiki

LIRC is the Linux Infrared Remote Control system. LIRC supports many different models of infrared hardware; an incomplete list is maintained at the LIRC website. Some hardware that has been tested by users in the community is listed in Infrared hardware for DIY stb-tester rigs.

Install LIRC

Install the lirc package using your operating system's package manager (yum or apt-get, etc).

On Debian and derivatives like Ubuntu, installing lirc will prompt you to select hardware and infrared protocol configurations. If your remote control unit and infrared emitter hardware aren't listed, select "none", and after installation completes edit /etc/lirc/hardware.conf: Set REMOTE_DEVICE to the device node for your infrared emitter hardware (probably /dev/lirc0), and set START_LIRCD to true.

Make sure the LIRC daemon (lircd) is running. Use ps -A | grep lircd (the output should list a "lircd" process). Use sudo service lirc start (on Ubuntu; other systems may vary) to start the daemon if it isn't running. If that doesn't work, check your system logs for clues as to what went wrong. Google for a "system administration guide" for your system if you don't know where the system logs are, and for more details on stopping and starting services.

Remote control config file

You need to teach LIRC the infrared protocol that your remote control unit uses. Search for a config file for your specific remote control in the LIRC database. Copy the config file to /etc/lirc/lircd.conf. You may need to restart lircd so that it reads the new config file: On Ubuntu use sudo service lirc restart.

Test the config file by sending a button-press with irsend send_once remote-control-name button-name, where remote-control-name and button-name are names specified in the config file. For details see the irsend manual.

If you can't find an existing config file, you will have to record your own config file: Run irrecord and follow the instructions it displays on the screen. Copy the config file that irrecord created to /etc/lirc/lircd.conf, and test it with irsend as above.

If irrecord fails to identify the infrared protocol, try irrecord --force to record in "raw" mode. If you want to use non-standard names for the remote control buttons, use irrecord --disable-namespace. See the irrecord manual for details.

If you're using the RedRat3-II, you can use RedRat's Signal Database utility to record your remote control's infrared protocol, and export the configuration in LIRC format. The RedRat Signal Database utility only runs on Windows.

Troubleshooting

Many digital cameras can see infrared light, so point your smartphone's camera at the infrared emitter while you use irsend. If you see the emitter flashing, you know that LIRC and irsend are working correctly. If the set-top box still doesn't recognise the signal, then your protocol configuration in /etc/lirc/lircd.conf is wrong.

If you have carefully read all the instructions so far and you still can't get LIRC to work, try asking for help on the LIRC mailing list, but first read the Frequently Asked Questions and search the mailing list archives to see if your question has already been asked & answered. Don't ask on the stb-tester mailing list; your problem lies with LIRC, not with stb-tester, and we wouldn't be able to help you anyway because this article already contains everything that we know. See also our list of [recommended infrared hardware] for use with stb-tester.

stb-tester configuration

After you can successfully send infrared signals with irsend, the next step is to configure stb-tester to send infrared signals via LIRC when you use stbt.press("button-name") in your test scripts. Use the following configuration in your stb-tester config file, where myremote is the remote control name in /etc/lirc/lircd.conf.

[global]
control = lirc::myremote

The configuration for stbt record to receive signals is below, but note that you'll need two RedRat3-II devices, one to receive and one to send the signals, as per this wiring diagram.

[record]
control_recorder = lirc::myremote

Configuring LIRC to support more than one hardware device is a little bit complicated. For instructions see How to use multiple LIRC infra-red transceivers.

Instead, we recommend that you use stbt control, which reads button-presses from the PC keyboard. Run stbt control --help for instructions on configuring stbt control, and use the following in your stb-tester config file to tell stbt record to use stbt control for input. See the stbt manual for further details.

[record]
control_recorder = stbt-control