Understanding lircmap.xml, remote.xml, and keyboard.xml
I’ve written in the past about using irxevent to set up custom remote commands in XBMC on Linux. That was the way I originally set up my remote after getting hopelessly confused trying to follow the more common method of configuring lircmap.xml, remote.xml, and keyboard.xml.
In an effort to help others navigate this maze, I’ll try to explain what I’ve learned. Note that this is primarily directed at Linux users, though the key mapping relationships in Windows are nearly identical (but the file locations are different). For the most part, a Windows Media Center Edition (MCE) remote will work out of the box, though there are several unused remote codes that you can remap to custom keys using the guide below.
First, consider the graphic below outlining all of the pieces involved.
#1: Remote Control Commands
Open up a terminal and enter the irw command. You won’t see anything immediately, but will see confirmation of the IR code (or “Lirc button” in the graphic above) received when a button is pressed on the remote. This will confirm what Lirc button the system is receiving.
#2: The system lircmap and keymaps
As the graphic says above, do not edit anything in these files. These are the default xbmc files. They are also overwritten every time you reinstall xbmc, so any time you spend here to get your system running right will be washed away the first time you upgrade xbmc.
#3: Lircmap.xml in the xbmc userdata folder
In Lircmap.xml, you must define any Lirc button names that are not already defined in your /usr/share/xbmc/Lircmap.xml file. (i.e. if you look through that file under the entries for your remote and do not find an entry for the IR code in question, you need to define it here).
Here is one example of a way to map RecTV (an LIRC button) to recordedtv (an XBMC button):
#4: Remote.xml (and keyboard.xml) in the xbmc userdata folder
In Remote.xml, you continue to define for XBMC what to do when the system receives the RecTV Lirc Button. At this point, Linux has converted the RecTV IR code (Lirc button) to a button XBMC understands “recordedtv.” View the full list of the buttons XBMC understands here.
We define the function of recordedtv (an XBMC button that otherwise has no function in XBMC), by making an entry in the remote.xml file.
This entry in remote.xml tells XBMC what action to take when the button <recordedtv> is pressed (which is a button it recognizes, but which has no function until defined here). The command above tells XBMC to open the movie library when this button is pressed.
You can repeat this process for other buttons you wish to define via remote shortcut. Other shortcuts I recommend to map to a key are:
- Fullscreen (returns XBMC to full screen video if you navigate through the menu/library while watching a movie in the background)