< LIRC

LIRC/Quick start guide

Step-by-step LIRC setup guide for USB (MCE [Media Center Edition]) IR receiver with universal remote control.

This is a quick-start guide only. Please refer to man pages of the commands and files used and online documentation for in-depth help.

Prerequisites

  • Get a USB IR receiver, preferably an MCE model which is almost always supported out-of-the-box.
  • Re-purpose an old universal remote control you have lying around the house.

Setup

  1. Connect the USB IR receiver.
  2. Ensure there are fully charged batteries in your remote control.
  3. Get some kind of output/response from the remote using mode2:
    # mode2
    Point the remote control at the IR receiver and press some buttons. This will attempt to autodetect the correct input device using the default "devinput" driver. However, this might not work without manual configuration of protocols.
  4. If no button presses are detected for most keys, change IR protocols. If you get no response to the remote control buttons you want to use, you likely need to enable different protocols:
    # ir-keytable -p <protocol> -p <protocol> ...
    Look at the output of ir-keytable (as well as cat /sys/class/rc/rc0/protocols). When you have problems, run ir-keytable -p all as root.
  5. If no button presses are detected for most keys, try different universal remote control device modes. You may also need to try different universal remote control device modes (TV, DVD, Audio, etc., buttons) in order to detect button presses when you are getting started. (You could possibly reprogram the universal remote's modes, but that would likely be a long trial-and-error process to find a setting that works.)
  6. After reconfiguring IR protocols and remote control device mode, retest:
    # mode2
    Point the remote control at the IR receiver and press some buttons. If button presses for most keys are not detected repeat the prior two steps until they are (or just run ir-keytable -p all as root).
  7. If you have narrowed down what protocols you need to support for your remote control, set them: Otherwise, you can just use all protocols:
  8. Determine the correct device for your IR receiver. Use either the default "devinput" driver or the older "default" driver:
  9. Use the device found for your USB IR receiver, e.g., :
    # mode2 --driver devinput --device /dev/input/event11
    or just try:
    # mode2 --driver devinput --device auto
    See if button presses are detected.
  10. If required, edit , e.g., if you are using the driver "default" instead of "devinput".
  11. Test your remote to see if scancodes are printed: See if button presses are detected.
  12. Use a drop-in file: . At the section add the following line: where each protocol string is replaced by the protocol(s) you need (or just use ).
  13. Start the lirc daemon, , so you can record keypresses in order to write an lircd configuration file for your remote control.
  14. Use irrecord to record keypress scancodes. Run: to save/record the keystrokes to be used for your application. Follow irrecord's instructions.
  15. Install the recorded lircd configuration file:
  16. Move devinput.lircd.conf to to disable it, because you are not using an IR keyboard and/or mouse, just the IR receiver:
  17. Restart so you use the newly created lircd configuration file.
  18. Test to make sure the keys you recorded are correctly detected, that is, the correct key symbol is output for each button you press: See if the correct key symbols are reported, and if repeated signals are properly rejected.

Troubleshooting

Keypresses are not detected

Follow #Setup.

Repeated keypress events

If you are having keypress repeating problems (each button press is echoed multiple times), examine the output of . The second column value is the repeat count. This will increment when repeated signals are detected. Each decoded button press with its count reset to "00" is reported as a separate button press event by lircd.

To fix this problem, generally the "gap" parameter sampled by irrecord in the file should be adjusted, often to a much larger value (e.g., from 44968 up to 113975).

After editing/adjusting any lircd configuration file, be sure to restart lircd (as shown above).

Final configuration

Write an lircrc file for your end user application. This file is used by all client programs built with lirc support that attach to lircd to read IR control events. Edit to issue commands to the program to be controlled. Test this configuration by running:

$ ircat prog

to see if the correct "config" strings for program are being output when you press all the buttons you wish to use. Note: If is not read by your application or just does not work, an alternate default location is .

Final testing

Finally, run your end user application and test remote control button presses to control it. If it works, you are done! If not, review and repeat the above sections as necessary to get each configuration step working before proceeding to the next step or section.

gollark: Great, I should pay money for an inferior solution!
gollark: Er, not might, inevitably will.
gollark: Another thing which increases cost and which I might løse!
gollark: <@151391317740486657> Ah yes, so I have to additionally deal with an extra thing to carry around and cannot listen to music on my phone whilst I charge it.
gollark: Also, making it symmetrical is not a good enough reason to make it incompatible with 90% of the headphones around and make the available ones for it cost more.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.