Raspbmc and my LG Remote Control Mappings

Having recently decided to use Raspbmc as my system of choice in my bedroom, I thought it was time to ensure that the system could be controlled via a remote control. The system was hooked up to a LG 32LE3300 with its original remote being the one I wanted to use.

Now, I had already configured all the add-ins that I wanted to use and created the favourites that I wanted (all using a keyboard). How to use the remote control now for general usage?

Some of the buttons were working well already so that was most of the job done; but when using TVCatchup it appeared that the Back and Exit buttons seemed to kill the add-in. Not good!

Time to delve in and fix things…

Standard remote control key mappings can be found in: /opt/xbmc-bcm/xbmc-bin/share/xbmc/system/keymaps/remote.xml
User applied remote control mappings can be found in: ~/.xbmc/userdata/keymaps/remote.xml

I started off by thinking that I should be able to map all keys that were available on the remote; how wrong was I?! It would appear that some of the buttons on the remote always pass to the TV and not any subsequent CEC enabled device. I needed to identify which buttons I could actually use. To do this I had the following command running in an SSH session to the RPi.

tail -f .xbmc/temp/xbmc.log | grep OnKey

This should give me the buttons that I’ve pressed and what they map to. Output of this is below…

tail output for keypresses

I pressed all buttons on the remote and these were the only ones that resulted in anything usable. So, now knowing that I have 11 buttons at my disposal I needed to get them working the way that I wanted. N.B. Back and Exit report themselves as the same button.

Available buttons on the remote are highlighted below…

Remote control available buttons

Now that I have all of this information I can start building a configuration that works for what I need. Below is my config for the remote.xml


<keymap>
  <global>
    <remote>
      <skipplus>PageDown</skipplus>
      <skipminus>PageUp</skipminus>
    </remote>
  </global>
  <FullscreenVideo>
    <remote>
      <back>PreviousMenu</back>
      <up>XBMC.ShutDown()</up>
      <down>noop</down>
      <left>noop</left>
      <right>XBMC.AlarmClock(shutdowntimer,XBMC.Shutdown())</right>
    </remote>
  </FullscreenVideo>
  <Home>
    <remote>
      <play>XBMC.ActivateWindow(Favourites)</play>
      <pause>XBMC.AlarmClock(shutdowntimer,XBMC.Shutdown())</pause>
      <stop>XBMC.ShutDown()</stop>
    </remote>
  </Home>
  <NumericInput>
    <remote>
      <back>PreviousMenu</back>
    </remote>
  </NumericInput>
</keymap>

So what does this configuration do…

Whilst on the Home Screen I am able to access my favourites (Play) but also set a Sleep Timer (Pause) or Shutdown (Stop).
When in Full Screen Video I can also set a Sleep Timer (Direction Right) or Shutdown (Direction Up).
Setting the Fast Forward and Rewind buttons to be Page Down and Page Up respectively allows me to be able to paginate through the TV guide in TVCatchup.

I thought that I had completed the job, but alas no. The TVCatchup add-in also maps its own keys/buttons. This meant that whilst in Full Screen Video my directional buttons weren’t behaving as expected (they were working perfectly when streaming from my media server). The bindings for TVCathup can be found in: ~/.xbmc/addons/script.tvcatchup/tvcatchup.xml. In here I block commented out the areas that handled the directional buttons.

This seems to be working well for me at the moment. I’ll update this post if I have to make any more tweaks.