Remote control media player without lirc using ir-keytable

Overview

I want to use my TV remote to control my media player. Since understanding infra-red commands is now built into the Ubuntu kernal, i wanted to stop using lirc, and instead use ir-keytable. The aim is to control XBMC with the minimum of fuss!

My set-up

This article is maily aimed at Ubuntu, but it could be tailored to any Linux distro.

I could have used a CEC controller, but the external pulse-8 controller doesn't play nice with my NUC, affecting it's boot, and the internal one is too big to fit inside the standard NUC case. So i decided to use ir-keytable instead.

You could use almost any infra-red TV remote and computer, incuding a universal one, but here is my set-up.

Things you need before you start

Hardware

Make sure you have an infra-red remote control. I am using my LG television remote control.

You will need an infra-red receiver. This may be an external one that you plug into your computer, or the receiver may be part of the motherboard. Mine is the latter, being part of my Intel NUC motherboard.

Software

You should be familiar with accessing your computer using SSH or directly on the terminal.

Everything in this article needs to be done as root:-

sudo -s

This will prevent us needing to put sudo in front of all our commands.

You will need to install ir-keytable

apt-get install ir-keytable

If already installed it is sometimes recommended to remove lirc

apt-get remove lirc

Check that your remote is recognised

Hopefully Ubuntu will recognise your remote control. To test this, we are going to run ir-keytable and press some buttons on our remote control.

ir-keytable -t

As you press a button on your remote control, you should see some output like the following:-

Theoretically, you could name your buttons anything you like. However, the application you are trying to control will not recognise your commands if you start making up random names. For example, i could have listed my OK button like this:-

0x444 MY_OK_BUTTON

But it wouldn't be mapped correctly. I've included a list of common button names at the end of this article.

Save your keymap file

Your keymap files are stored in the following location - /etc/rc_keymaps

I am going to create a file called rc6_lg32, using the nano text editor, and paste in my recorded keymap information information:-

cd /etc/rc_keymaps
nano rc6_lg32

Copy the recorded information, then right click in nano to paste it, ctrl + o to save it, then ctrl + x to exit out of nano.

Write your file to the keytable

Now that we have a keymap file, we want our infra-red receiver device to use it:-

ir-keytable -c
ir-keytable -p NEC,RC6 -w /etc/rc_keymaps/rc6_lg32

This tells any device using the NEC or RC6 protocol to use my new keymap.