[Linux]How to use an unsupported button on your remote.[Linux]
#1
Maybe my search skills suck but I couldn't find it so here it is.

My Microsoft XBOX360 Universal Remote has a DVD Open/Close button but XBMC does not supply a button code (left,right,play...etc) to use it. Find a button code in ButtonTranslator.cpp you are not using and map it to your Open/Close button. I picked the star button because my remote does not have a star.

Below is the contents of the relevant portion of ButtonTranslator.cpp


Step 1 (Pick a button)

Code:
if (strButton.Equals("left")) buttonCode = XINPUT_IR_REMOTE_LEFT;
  else if (strButton.Equals("right")) buttonCode = XINPUT_IR_REMOTE_RIGHT;
  else if (strButton.Equals("up")) buttonCode = XINPUT_IR_REMOTE_UP;
  else if (strButton.Equals("down")) buttonCode = XINPUT_IR_REMOTE_DOWN;
  else if (strButton.Equals("select")) buttonCode = XINPUT_IR_REMOTE_SELECT;
  else if (strButton.Equals("back")) buttonCode = XINPUT_IR_REMOTE_BACK;
  else if (strButton.Equals("menu")) buttonCode = XINPUT_IR_REMOTE_MENU;
  else if (strButton.Equals("info")) buttonCode = XINPUT_IR_REMOTE_INFO;
  else if (strButton.Equals("display")) buttonCode = XINPUT_IR_REMOTE_DISPLAY;
  else if (strButton.Equals("title")) buttonCode = XINPUT_IR_REMOTE_TITLE;
  else if (strButton.Equals("play")) buttonCode = XINPUT_IR_REMOTE_PLAY;
  else if (strButton.Equals("pause")) buttonCode = XINPUT_IR_REMOTE_PAUSE;
  else if (strButton.Equals("reverse")) buttonCode = XINPUT_IR_REMOTE_REVERSE;
  else if (strButton.Equals("forward")) buttonCode = XINPUT_IR_REMOTE_FORWARD;
  else if (strButton.Equals("skipplus")) buttonCode = XINPUT_IR_REMOTE_SKIP_PLUS;
  else if (strButton.Equals("[b][color=red]star[/color][/b]")) buttonCode = XINPUT_IR_REMOTE_STAR;  
  else if (strButton.Equals("skipminus")) buttonCode = XINPUT_IR_REMOTE_SKIP_MINUS;
  else if (strButton.Equals("stop")) buttonCode = XINPUT_IR_REMOTE_STOP;
  else if (strButton.Equals("zero")) buttonCode = XINPUT_IR_REMOTE_0;
  else if (strButton.Equals("one")) buttonCode = XINPUT_IR_REMOTE_1;
  else if (strButton.Equals("two")) buttonCode = XINPUT_IR_REMOTE_2;
  else if (strButton.Equals("three")) buttonCode = XINPUT_IR_REMOTE_3;
  else if (strButton.Equals("four")) buttonCode = XINPUT_IR_REMOTE_4;
  else if (strButton.Equals("five")) buttonCode = XINPUT_IR_REMOTE_5;
  else if (strButton.Equals("six")) buttonCode = XINPUT_IR_REMOTE_6;
  else if (strButton.Equals("seven")) buttonCode = XINPUT_IR_REMOTE_7;
  else if (strButton.Equals("eight")) buttonCode = XINPUT_IR_REMOTE_8;
  else if (strButton.Equals("nine")) buttonCode = XINPUT_IR_REMOTE_9;
  // additional keys from the media center extender for xbox remote
  else if (strButton.Equals("power")) buttonCode = XINPUT_IR_REMOTE_POWER;
  else if (strButton.Equals("mytv")) buttonCode = XINPUT_IR_REMOTE_MY_TV;
  else if (strButton.Equals("mymusic")) buttonCode = XINPUT_IR_REMOTE_MY_MUSIC;
  else if (strButton.Equals("mypictures")) buttonCode = XINPUT_IR_REMOTE_MY_PICTURES;
  else if (strButton.Equals("myvideo")) buttonCode = XINPUT_IR_REMOTE_MY_VIDEOS;
  else if (strButton.Equals("record")) buttonCode = XINPUT_IR_REMOTE_RECORD;
  else if (strButton.Equals("start")) buttonCode = XINPUT_IR_REMOTE_START;
  else if (strButton.Equals("volumeplus")) buttonCode = XINPUT_IR_REMOTE_VOLUME_PLUS;
  else if (strButton.Equals("volumeminus")) buttonCode = XINPUT_IR_REMOTE_VOLUME_MINUS;
  else if (strButton.Equals("channelplus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_PLUS;
  else if (strButton.Equals("channelminus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_MINUS;
  else if (strButton.Equals("pageplus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_PLUS;
  else if (strButton.Equals("pageminus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_MINUS;
  else if (strButton.Equals("mute")) buttonCode = XINPUT_IR_REMOTE_MUTE;
  else if (strButton.Equals("recordedtv")) buttonCode = XINPUT_IR_REMOTE_RECORDED_TV;
  else if (strButton.Equals("guide")) buttonCode = XINPUT_IR_REMOTE_TITLE;   // same as title
  else if (strButton.Equals("livetv")) buttonCode = XINPUT_IR_REMOTE_LIVE_TV;
    else if (strButton.Equals("hash")) buttonCode = XINPUT_IR_REMOTE_HASH;
  else if (strButton.Equals("clear")) buttonCode = XINPUT_IR_REMOTE_CLEAR;
  else if (strButton.Equals("enter")) buttonCode = XINPUT_IR_REMOTE_SELECT;  // same as select
  else if (strButton.Equals("xbox")) buttonCode = XINPUT_IR_REMOTE_DISPLAY; // same as display
  else if (strButton.Equals("teletext")) buttonCode = XINPUT_IR_REMOTE_TELETEXT;
  else if (strButton.Equals("red")) buttonCode = XINPUT_IR_REMOTE_RED;
  else if (strButton.Equals("green")) buttonCode = XINPUT_IR_REMOTE_GREEN;
  else if (strButton.Equals("yellow")) buttonCode = XINPUT_IR_REMOTE_YELLOW;
  else if (strButton.Equals("blue")) buttonCode = XINPUT_IR_REMOTE_BLUE;
  else if (strButton.Equals("subtitle")) buttonCode = XINPUT_IR_REMOTE_SUBTITLE;
  else if (strButton.Equals("language")) buttonCode = XINPUT_IR_REMOTE_LANGUAGE;
  else CLog::Log(LOGERROR, "Remote Translator: Can't find button %s", strButton.c_str());
  return buttonCode;
}

Step 2 (Add it to) /home/xbmc/.xbmc/Lircmap.xml

Code:
<lircmap>
            <remote device="Microsoft_Xbox360">
                    [color=red]<star>OpenClose</star>[/color]    
                <left>LeftArrow</left>
                <right>RightArrow</right>

I removed the bottom portion of this file to make this post shorter. Yours will be much longer

OpenClose is the name of my DVD button on my remote as described in my /etc/lirc/lircd.conf and star is the button we picked to use in the ButtonTranslator.cpp






Step 3 (Add it to) /home/xbmc/.xbmc/Keymap.xml

Code:
<keymap>
    <keymap>
    <global>
        <remote>
            [color=red]<star>XBMC.EjectTray()</star> [/color]
            <left>Left</left>
            <right>Right</right>
            <up>Up</up>
            <down>Down</down>


Step 4 Restart XBMC try the button.



You can get a very good understanding of the relationship between these files by this example so you can map just about any button any way you want. There are lots of commands internal to XBMC you can send.
Reply
#2
Indeed. Thanks for the guide.

I did this yesterday but instead of finding an unused button in the ButtonTranslator.cpp, I used the <obc#> ones.

In the end your lircmap.xml will look like this

Code:
<obc1>OpenClose</obc1>

and keymap.xml will look like this
Code:
    <keymap>
    <global>
        <remote>
            <left>Left</left>
            <right>Right</right>
            <up>Up</up>
            <down>Down</down>
                 </remote>
                 <universalremote>
                         <obc1>XBMC.EjectTray()</obc1>
                 </universalremote>

This method allows you to add a greater amount of buttons.

Here are a few other posts on the topic
Link 1
Link 2
Link 3


EDIT: Not exactly sure why but those file locations don't look right to me, mine is
/home/.xbmc/userdata/keymaps/remote.xml
/home/.xbmc/userdata/lircmap.xml
Reply
#3
Nick8888 Wrote:Indeed. Thanks for the guide.

I did this yesterday but instead of finding an unused button in the ButtonTranslator.cpp, I used the <obc#> ones.

In the end your lircmap.xml will look like this

Code:
<obc1>OpenClose</obc1>

and keymap.xml will look like this
Code:
    <keymap>
    <global>
        <remote>
            <left>Left</left>
            <right>Right</right>
            <up>Up</up>
            <down>Down</down>
                 </remote>
                 <universalremote>
                         <obc1>XBMC.EjectTray()</obc1>
                 </universalremote>

This method allows you to add a greater amount of buttons.

Here are a few other posts on the topic
Link 1
Link 2
Link 3


EDIT: Not exactly sure why but those file locations don't look right to me, mine is
/home/.xbmc/userdata/keymaps/remote.xml
/home/.xbmc/userdata/lircmap.xml

I was thinking about doing it your way but was not sure if I could mix match the obc# codes with actual remote codes. I see now that you can, and you did.

Thanks
Reply
#4
I may be way off base, but is this something you can do if you have a button on your remote that doesn't register at all? For example, my MCE remote works for almost all buttons, but there are a few that even IRW doesn't output anything. So where do I start to configure that? Somehow I have to get the Operating System to output something for it correct?
Reply
#5
Now is "EjectTray()" not "XBMC.EjectTray()".

Bye.
Reply
#6
This thread was very helpful in getting my RF remote working. My AHA moment came when I realized a keyboard has twelve function keys (F1-F12) which are not present in a remote!! I have documented the same here http://lifeofpenguin.blogspot.in/2016/01...-htpc.html
Reply

Logout Mark Read Team Forum Stats Members Help
[Linux]How to use an unsupported button on your remote.[Linux]0