I recently ditched my aging 12.04-Ubuntu-based XBMC setup to go with OpenELEC which is purposed-built and thus very fast. Because it is so streamlined, you lose the flexibility of a full-blown distro setup. One of which was the lack of lircd support on the recent builds. With my previous setup, I could use lircd to map a particular keyboard/remote key to a script that would kill and restart xbmc when it hang.
With OpenELEC, My IR receiver presents it self as a USB HID keyboard device and only send keystrokes, which are captured by XBMC and can’t be mapped to a shell-level script. And this is required if you want to kill XBMC, as you cannot kill XBMC from within XBMC when XBMC hangs — Unless you have one of those machines from Inception.
However with luck I found evtest, which “displays information on the input device specified on the command line, including all the events supported by the device. It then monitors the device and displays all the events layer events generated.” What’s more? It’s actually available on OpenELEC as an addon. So if you want to map a keyboard/remote key to kill XBMC, do the following:
1) Install evtest addon and reboot
2) Find your keyboard/remote device by running the following command:
3) My device shows up with:
H: Handlers=sysrq kbd mouse1 js0 event3. Now with
XBMC running, ssh to your OpenELEC and run
4) Now, try and press some random keys from the keyboard/remote. You should get
some response from evtest. Pick the key you want, find the unique line that
appears on evtest’s stdout everytime you press the key. Mine has this:
(KEY_E), value 0
5) Copy and paste the following to a file in /storage to make it persistent. Make appropriate changes to the input device and grep’ed strings.
6) Save file, chmod +x and run the script. You should now be able to kill XBMC with the key you picked
7) Make sure the script runs during boot-up by calling it from autostart.sh
Have fun with OpenELEC. I’m very pleased with the setup so far.