Raspberry Pi - LIRC GPIO driver OpenELEC HOWTO


Install OpenELEC:

You can find the official guide here.

Recompile kernel or download it:

Download pre-patched kernel:

Download the kernel from here (we have builds thanks to roadkill). When finished, unpack and install openelec as usual.

Configure LIRC:

Start your RPi and connect to it via SSH. (Default credentials are: root / openelec)

Check if the driver works correctly:

Check dmesg output:
root ~ # dmesg | grep lirc_rpi
[    1.089250] lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0
[    1.089276] lirc_rpi: driver registered!
[    2.046551] lirc_rpi: auto-detected active low receiver on GPIO pin 18
Start mode2 and push some buttons on your remote you should see something like this on your console:
root ~ # mode2 -d /dev/lirc0
space 4960669
pulse 2697
space 880
pulse 477
space 816
pulse 499
space 379
pulse 472
space 439
...

Start lirc correctly at startup:

We need to start lirc with the proper output socket path so the command below adds this to your autostart script. (I don't know how is this set properly? I tried hardware.conf with no luck ... If anybody knows this can you send it to me? Till then, this crap works...)
echo "killall lircd; /usr/sbin/lircd --driver=default --device=/dev/lirc0 --uinput --output=/var/run/lirc/lircd --pidfile=/var/run/lirc/lircd-lirc0.pid /storage/.config/lircd.conf" >> /storage/.config/autostart.sh

Record your buttons:

To record you remote codes we need to start a program called irrecord. (Check lirc manual)
killall lircd
irrecord -d /dev/lirc0 /storage/.config/lircd.conf

Reboot and verify:

reboot
Reconnect via SSH and launch irw to verify that our button presses are recognised by lircd.
irw

Create Lircmap.xml:

To map the lirc events to real actions in XBMC you need to place a Lircmap.xml file in you userdata folder. Detailed guide here. If you are familiar with sshfs, use it ;).
Reboot or restart XBMC when done.
Should look something like this:
<lircmap>
    <remote device="/storage/.config/lircd.conf">
        <left>KEY_LEFT</left>
        <right>KEY_RIGHT</right>
        <up>KEY_UP</up>
        <down>KEY_DOWN</down>
        <select>KEY_OK</select>
    </remote>
</lircmap>

Modified: 2012-06-10