OpenELEC: kills XBMC using keyboard or remote

03 June 2014 2 minutes

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: cat /proc/bus/input/devices

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.

evtest /dev/input/event3 | while read line; do
echo $line|grep -q "(KEY_E), value 0"
if [[ $? == 0 ]]; then
killall xbmc.bin

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

Have fun with OpenELEC. I’m very pleased with the setup so far.


TV Viet Nam 0.9.1

Great news! The long-anticipated update has been released. v0.9.1 is now in the official repo, so make sure you force-refresh in case xbmc was too lazy to do it automatically. Thanks to your error-reportings and donations, your continued support make it worthwhile to keep maintaining this addon.


Clean up XBMC’s screensaver cache to get rid of blurry low resolution slideshows.

I have XBMC run a slideshow of family photos in screensaver mode. Problem? XBMC caches the images automatically and therefore the photos are replaced by low-resolution, blurry cached copies. This is noticeably annoying especially if you have large, hi-res TV. I approached the developer of the screensaver addon about the problem but it is out of his hands because the cache are managed system-wide (within XBMC of course).