How to remotely control PC in Linux with LIRC
Irrecord instructions …
With the previous LIRC instructions we have created the interface between the remote control receiver hardware and the operating system or software. Now we have to teach-the remote control the desired keys to assign the respective commands – for instance, the “Program +” button command “Page Up” or “Pageup”. There are different tools that we use with the command irrecord.
Note: Alternatively, you can also download directly a remote file, but only if you know exactly which remote you have and the white(WRONG WORD) one with a selection on the universal remote control only rarely. The remote control must be selected to work proper with the USB Ultra IR Receiver v2.0, USB IR receiver v1.1 or similar Igor Plug USB Infrared USB-based receivers must be compliant RC5. Visit the following URL (eg start Firefox): http://lirc.sourceforge.net/remotes/
Then remember the exact name (note the uppercase and lowercase letters!) and add it here at XYZ: wget http://lirc.sourceforge.net/remotes/XYZ -O /etc/lirc/own_remote.conf But it’s often more work to adapt the pre-files, this solution is only mentioned here for completeness and is not used for the rest.
We are now going to teach the remote control with the following command:
sudo irrecord -d /dev/lirc0 -f /etc/lirc/own_remote.conf (You might be tempted to change the destination file to something else, but using this manual you must have the correct name – therefore it is better if you not do so)
Now you have a lot to read through irrecord command and press Enter:
Now it is time to get the universal remote control for the USB Ultra IR Receiver v2.0 RC5 to adjust, for example, a device compliant Philips TV. If you use the power button of the device to the PC on and off can (teach-by jumper), you have chosen a good 99% RC5 device in the universal remote control and can start with the identification. Enter the remote control:
The program expects many different keys to be be pressed in succession on the remote control to enable it to discover how the code is structured. Each entry is represented by a point in the shell and soon enough keys will have been pressed, then the program will display the following message: Do not press Enter! otherwise you can start again from scratch on this page …
First we need to enter the desired name for the commands that are specified by a particular scheme, for example: KEY_1 or KEY_STOP, etc. To see what names there are, it is recommended on the “Applications” (or the particular start button in Linux) to open another shell where it will display the name with the following command: (Or just use this page with all the key names that can be opened in a new browser window and printed out)
Then continue with the programming. Enter the desired name, for example KEY_PAGEUP press Enter and then press the key for learning on the remote control – for example KEY_PAGEUP the Channel + button:
Then enter the next key, then press Enter KEY_PAGEDOWN and press the button, for example channel on the remote control:
This will continue until you have actually programmed all the buttons you want to use later. Take a look at the list that you printed earlier and mark all learned buttons, because that relearning is not quite so simple. If all the keys are taught, you confirm without entering it’s name by pressing Enter:
Now backup the original lircd.conf before we write the new one:
sudo cp /etc/lirc/lircd.conf /etc/lirc/lircd.conf.bak
Then copy it in the correct directory with the following command, replacing the original lircd.conf:
sudo cp /etc/lirc/own_remote.conf /etc/lirc/lircd.conf
Now restart or start LIRC with the following command:
sudo /etc/init.d/lirc restart
The first two red ‘fail’ outputs are correct, as we had stopped LIRC before and thus would need only start without “stopping” LIRC:
With this command you can see now – if all goes well – the keys learned (or their names), when pressing a button on the remote control:
To quit irw simply use the following keystrokes control and C, and then press Enter:
Strg + c
Whoever wants to can again now with dmesg | grep lirc examine the log entries by LIRC. If you very often receive the following message, it is prudent to select a different device universal remote control device because the learned TV (for example) probably is not 100% RC5 compatible:
lirc_igorplugusb: Device buffer overrun.
Note: If you want to use a remote control device with buffer overrun or other error messages anyway, you might stop and try the command lirc mode2-d / dev/lirc0 as described above or download the file to FB. If everything is running properly, despite these log entries, you should not worry about these entries because it is also caused by another remote control, interference, or similar information, and is only an information of the igorplugusb plugins from LIRC.