Introduction: Configuring Unused Buttons on Your MCE Remote on OpenElec
This instructable is written for OpenElec 5.0.8 but it will work with newer builds of OpenElec. It is written for those who have unused Media Center Remote (I use Logitech Harmony remote with MCE receiver on PC and MCE remote is surplus). It also work with Panasonic TV remote, maybe with other manufacturer remotes. If someone tried other remote, please wrote brand of remote in comment of this instructable. If you use such remote as MCE you will find that there is a few buttons that does nothing or does something you don't want (when you press "power" button Raspi goes to shutdown). So, in this instructable I will try to explain how to make "non-workable" buttons to do something you want or how to change default action for button.
I'll presume that you have working Raspberry Pi (I have model 2) with infrared (IR) receiver attached on GPIO and OpenElec installed and connected to your network. If don't buy Raspi (buy and case), mount OpenElec image on SD card, configure OpenElec by your needs. You can add IR sensor using this page: http://aron.ws/projects/lirc_rpi . Basicly, you need proper IR sensor that work on 3.3V and connect it on GPIO pins 3.3V, GND and GPIO18.
That was hardware part, now come some software adjustment :)
Step 1: Connecting to Working OpenElec
To connect to OpenElec you need another PC on your network. Also need to know your Raspi OpenElec IP address. You can make static IP address in OpenElec config on Raspi. Or you can search your network with some scanners like free Advanced IP Scanner. Run it, press search and look for "OpenElec" machine and address.
Use this address in Putty and connect to your Raspi running OpenElec. Login as: root and password is openelec
First you need to "tell" OpenElec that you want to use IR remote. To do this type in Putty window:
mount -o remount,rw /flash
Then in opened editor, scroll to end of text, press enter to goes to new line and copy this:
Press CTRL + X answer Y and copy this in Putty:
mount -o remount,ro /flash
Your Raspi will be rebooted and you can use your remote now ! Try it, it should work, if not, you probably didn't connect sensor in right way.
As soon you will find that there is a few buttons that does nothing when pressed, like Windows button. On the other side if you accidentally press "power" button OpenElec goes to shutdown. This is very inconvenient if you watch something and press power button on remote. Couldn't be better if shutdown window appear when you press power button?
Step 2: Assigning Function to Buttons
To do this first connect to OpenElec with Putty and type irw and press enter. Now go to Raspi and press not assigned button on your remote (point remote to Raspi).
On Putty screen you will see something like this:
OpenELEC:~ # irw
66 0 KEY_HOME devinput
66 0 KEY_HOME_UP devinput
This happened when I press Windows button on my MCE remote. Nothing happens on Kodi, it don't respond to this button. Now, I want to this button do what ih should - go to home screen.
Step 3: Creating a File Lircmap.xml
Now open your network on windows explorer and look for computer named "openelec". Open it and look for network share "userdata". Open it and create with Notepad file called lircmap.xml. In notepad type as you see on upper picture.
What those lines means? It is file that tells to Openelec what button is pressed. Only that, not what to do when button is pressed. There is default action for almost every button and if you don't change that action in next step Kodi will do what default action is. In this case it will go to home screen or open and close OSD in fullscreen.
You can add more lines below third line, first word is command and word in capital letters is that you saw in Putty when press button on your remote.
Full list of commands can be found HERE. You should use commands below 64. line.
So, use your remote, press button which do nothing, look at putty screen what is this button name, look in table for this name (use search in your browser). Copy that whole line in lircmap.xml and save the file.
Type reboot in Putty and wait Kodi to show. Try buttons that didn't work. They should do something now.
Step 4: Creating New Actions for Remote Buttons
By now you should have all buttons on your remote working. But, you want to change Kodi actions for some of buttons. You can assign different commands to every button, like subtitle search window, subtitle delay, etc.
To do this open Openelec network share, open userdata\keymap and create in notepad keymap.xml.
In that file you will "tell" Kodi what action will execute when you press button on remote. Whole structure of keymap.xml is explained HERE . Part 5.1 is part where actions are. Use commands from step 3. and bind it with actions. One interesting example of keymap.xml is HERE, at bottom of page.
My keymap.xml is at the picture. What it does? It has two section: global and FullscreenVideo. In global I put actions what Kodi will do in main window and all windows. In FullscreenVideo are actions what Kodi will do only when full video is on screen. I think those lines are self-explanatory. Interesting part is command ActivateWindow(). This is a command that will open a window from this LIST. There is a lot of windows that you can open by this command so you can use your remote in many different ways. Use the force :)
Sorry for my bad English grammar, hope you will find this instructions useful.