After recently getting my pi re purposed as a medium for watching my DVD rips (which I own). I was delighted to see that my TV remote worked out of the box (ish) in openelec.
The one major flaw was that I had no back button! With no back but to the pi is unusable. I had the android remote installed but I wanted to make it easy to use for my kids (who don't have phones). I also have a harmony 300 remote which has a spare mode on it.
So my plan was to remap the available buttons to something more sensible on the remote. I found the guides on the kodi website and forums which suggested I create an XML file with the mappings in /storage/.xbmc/userdata/keymaps. I have moderate success with this using the log file to get my key names and putting them in the file against new actions. But it didn't work quite right and it took me several hours to realise that xbmc was lying to me about my button names!! I wasted hours and hours seconding guessing file names etc when all along I had the wrong button names. Suffice is to say ignore the names and go only by the hex value (convert to decimal).
It was just at the point I was about to start over with the right button names when I found a much simpler way that took all of 5 minutes!
1) Install the Kodi Keymap GUI add on in settings>addons.
2) Launch Keymap add-on and select edit.
3) Choose an action to remap.
4) Press the button you want it to be mapped to.
It was that simple! The Keymap GUI generates the XML in just the right format. It even reloads the Keymap when you save it.
I can't believe how much time I wasted following guides etc when I could of mapped it in the GUI.
So I thought I'd post here to hopefully save someone else the trouble.