Skip to main content

How To remap CEC buttons on a Sony TV Remote for XBMC under Xbian 1.0.5a

I recently configured a Raspberry Pi for a friend using Xbian and a Sony 46" LCD. It worked flawlessly with CEC support although there were a few commands that the Sony TV (remote) would not pass through the HDMI cable to the Pi.

As such, I had no Context Menu or Info button which are both rather useful. After spending a few hours searching about, I managed to resolve it by remapping the coloured buttons below the D-Pad to perform the following:

Red = Context Menu
Blue = Info
Yellow = Update video library
Green = Clean video library

You can only remap buttons that are supported by your TV remote. i.e. If you push a button on your TV remote and your TV performs a TV function (in my case the number buttons switched back to TV and that channel) or the TV displays a message saying "Unsupported" or something similar, there is nothing you can do with that button. Those buttons are not being sent via CEC back to the Pi over HDMI.

What you need:
The IP address of your Pi.
WinSCP or a similar tool to SCP into your Xbian instance.

  1. Using WinSCP, navigate to root/usr/local/share/xbmc/system/keymaps/remote.xml
  2. Copy the remote.xml file to your local machine. 
  3. Edit the remote.xml file so that the coloured buttons under the global section match your requirements. Mine is shown right.
  4. Copy the remote.xml file back to /home/xbian/.xbmc/userdata/keymaps then reboot your Pi. 
You should now have access to the Context menu with the Red button and Info (for video information etc.) on the Green button.


  1. i can't find the initial remote.xml to perform a copy...

    Using ubuntu with xbmc

    best regards Oskar

    1. This may help?

  2. thanks for the fast answer, but there is no remote.xml like in your post.
    shall i use the keyboard.xml instead of the remote.xml ??

    confused :)

    1. Section 2 there is a link to download a default keyboard.xml file. Modify this as required and save to userdata/keymaps. Name is not important as long as it ends with .xml.

  3. This comment has been removed by the author.

  4. Thanks! Very useful information.

    I've just attached a Pulse8 CEC adapter and mapped my Sony remote as follows

    LoadProfile(Master user)


Post a Comment

Popular posts from this blog

Using ESPEasy with Home Assistant via MQTT

Preface: I've just started playing around with Home Assistant on a Raspberry Pi and exploring the world of MQTT to control devices on the network. Learning curve is a bit steep but worth the effort as MQTT is very fast. The hardware and software tools I'm using are as follows: 2 x Sonoff relay units 2 x NodeMCU Boards ESPEasy firmware (must be version 121 or above as that contains the MQTT 'retain' flag option. Home Assistant software on Raspberry Pi2 MQTT Test Software: PC: MQTT.fx Android: MQTT Dashboard

My Notepad++ tricks when editing YAML files in Home Assistant

To comment out a whole section in one go: Highlight the text you want to comment out and use CTRL + Q. If you do this at the start of a line, it will only comment that line. CTRL + Q is toggle mode (comment on/off). CTRL + K will allow you to add multiple comments one after the other.

Installing ha-bridge on your Raspberry Pi

EDIT: Updated 14th June 2017 to reflect version 4.5.5. Default port is now 80 to keep Google Home happy and service now supports MQTT! Advice on backups also added 7th Feb. Version 4x also supports adding a Home Assistant instance which is great! Want to control your Vera, Harmony hub or Home Assistant entities with your Amazon echo or Google Home? ha-bridge is the best way to achieve that and installation is actually quite easy and takes less than 5 minutes. Here are the steps.