TechNazgul RSS

Wednesday, September 8, 2010

Add custom remote control commands to XBMC Dharma



XBMC Remote Setup with irxevent

If you need to setup custom remote commands, i.e. mapping non- standard keys like “LiveTV” on your Windows MCE remote to a new function in XBMC, one method of doing so is using irxevent.

To be clear, this is not the most common way to set up customized remote commands.  The more common method is using lircmap.xml and remote.xml, which can be confusing, so this is another way of accomplishing the same thing.

 

This guide is a good start.  Here’s what I took away and customized for use with the XBMCFreak version of Dharma Beta 1.

 

  • Install irxevent
    • sudo apt-get install lirc-x
  • Create your customized .lircrc file in your ~user directory (/home/user)

 

This is what mine looks like:

begin
#MAPS LIVETV button to “tab” key for toggling between menus and fullscreen video

        prog = irxevent
        button = LiveTV
        config = Key Tab XBMC
end

# MAPS RECTV BUTTON TO SHOW MOVIE LIBRARY - SET UP AS F2 IN KEYBOARD.XML
begin
    prog = irxevent
    button = RecTV
    config = Key F2 XBMC
end

# MAPS  BUTTON TO RESTART XBMC - SET UP AS F3 in KEYBOARD.XML
begin
        prog = irxevent
        button = Print
        config = Key F3 XBMC
end

# MAPS  BUTTON TO OPEN FAVOURITES - SET UP AS F4 in KEYBOARD.XML
begin
        prog = irxevent
        button = Radio
        config = Key F4 XBMC
end


As you can see above in the notes, you have to set up the associated entries in your keyboard.xml file, which is located in /home/user/.xbmc/userdata/keymaps/keyboard.xml.  Here are a few examples of custom entries in my keyboard.xml file.

 

<keymap>
  <global>
    <keyboard>

… LOTS OF DATA OTHER STANDARD LINES EXCLUDED HERE …

 

     <f2>XBMC.ActivateWindow(videolibrary,movietitles)</f2> <!-- CUSTOM -->
     <f3>XBMC.RestartApp</f3> <!-- CUSTOM -->
     <f4>XBMC.ActivateWindow(favourites)</f4> <!-- CUSTOM --> 

 

     … LOTS OF DATA OTHER STANDARD LINES EXCLUDED HERE …

 

  </keyboard>
</global>

 

 

You can add other commands to the irxevent configuration as well, just make sure that whatever remote code you choose for irxevent isn’t already used in XBMC for something else.  If you choose a remote code or button that is already mapped to another functionality in remote.xml, lircmap.xml, or keyboard.xml, XBMC will send two button presses every time you use the custom mapped button.  The first function will be the one in .lircrc (using irxevent functionality) and the second function will be the one defined in remote.xml/lircmap.xml/keyboard.xml.  As long as you don’t overlap anything, this will work fine.

 

Autostart  irexec

 

Lastly, you need to add irexec to autostart with your XBMC Live session.  You do this by editing this file:  /usr/bin/xbmc

 

The text in red is the only text you need to add.  The rest is shown just so that you can see where you include it in the file.

 

#  You should have received a copy of the GNU General Public License
#  along with XBMC; see the file COPYING.  If not, write to
#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html

 

# start irxevent

irxevent &

 

SAVED_ARGS="$@"
prefix="/usr"

 

Technorati Tags: ,,

No comments:

Post a Comment

Followers

Facebook