Linux Cannot map MCE remote
#1
Hi everyone,
I've got Debian 6.x and XBMC 10 installed on my thinkpad. Lately I got me an MCE remote from ebay which xbmc recognized out of the box so I don't need lirc and most of the key mappings. However there are still usefull buttons not working and I tried everything from
http://wiki.xbmc.org/index.php?title=Rem...MCE_remote

When I press one of the coloured buttons blue, yellow, green or orange I allways end up in the corresponding TTY even though I allready set a mod="ctrl,alt" to the corresponding f1,f2,f3,f4 keys in the keyboard.xml. The super key was recognized once but isn't anylonger. Huh

Here is what my keyboard.xml looks like now:
Code:
<keymap>
  <global>
    <keyboard>
      <f1 mod="ctrl,alt">XBMC.AvtivateWindow(MyPictures)</f1>
      <f2 mod="ctrl,alt">XBMC.AvtivateWindow(MyMusic)</f2>
      <f3 mod="ctrl,alt">XBMC.AvtivateWindow(MovieTitles)</f3>
      <f4 mod="ctrl,alt">PlayDVD</f4>
      <super>Notification(Key Pressed, Windows)</super>
      <return mod="alt">AspectRatio</return>
      <d mod="super">XBMC.ActivateWindow(shutdownmenu)</d>
      <e mod="ctrl">Notification(Key Pressed, MyComputer)</e>
      <tab mod="alt">Notification(Key Pressed, Alt+Tab)</tab>
      <leftclick>Notification(Key Pressed, Mouse_left_click)</leftclick>
      <r mod="super">Notification(Key Pressed, Refresh)</r>
    </keyboard>
  </global>
</keymap>

It doesn't change wether I'm activating "remote send keyboard commands" or not.

Could someone give me hint of where to look for the problemme?
Reply
#2
I have that remote (but no longer use it). I take it that your definitions are based on the documentation, which states that each of the four hotkeys sends three sets of keypresses:
Code:
A: ctrl-alt-f1, ctrl-alt-a, ctrl-alt-1 ... D: ctrl-alt-f4, ctrl-alt-d, ctrl-alt-4
However, enabling debug logging in XBMC and pressing the hotkeys reveals that XBMC sees each hotkey as sending the following four sets of keypresses:
Code:
A: leftctrl, ctrl-leftalt, ctrl-alt-a, ctrl-alt-one ... D: leftctrl, ctrl-leftalt, ctrl-alt-d, ctrl-alt-four
The ctrl-alt-f1/f2/f3/f4 keystrokes are not recognized by XBMC, so you'll need to select either the ctrl-alt-a/b/c/d or ctrl-alt-one/two/three/four keys for your keymapping. So, your hotkey definitions should look like this:

Code:
<keymap>
  <global>
    <keyboard>
      <a mod="ctrl,alt">XBMC.ActivateWindow(MyPictures)</a>
      <b mod="ctrl,alt">XBMC.ActivateWindow(MyMusic)</b>
      <c mod="ctrl,alt">XBMC.ActivateWindow(Videos,MovieTitles)</c>
      <d mod="ctrl,alt">PlayDVD</d>
       :
    </keyboard>
  </global>
</keymap>

Also note the following errors in your definitions which would also prevent them from working:
  • For each of your hotkey definitions, you misspelled "ActivateWindow" as "AvtivateWindow"
  • For the third hotkey definition, the "MovieTitles" window is a child of the primary "Videos" window, so you need to specify "ActivateWindow(Videos,MovieTitles)" rather than "ActivateWindow(MovieTitles)"
Reply
#3
Thanks for the detailed reply!
The part about debugging log was very helpfull as I now assigned specific key id's to the actions. This worked for a little while and now XBMC continues to ignore my key presses.
My keyboard.xml now looks like:
Code:
<keymap>                                                                                                                                                                    
  <global>                                                                                                                                                                  
    <keyboard>                                                                                                                                                              
      <key id="323699">Close</key>                                                                                                                                          
      <a mod="ctrl,alt">XBMC.ActivateWindow(MyPictures)</a>                                                                                                                  
      <b mod="ctrl,alt">XBMC.ActivateWindow(MyMusic)</b>                                                                                                                    
      <c mod="ctrl,alt">XBMC.ActivateWindow(Videos,MovieTitles)</c>                                                                                                          
      <key id="127136">PlayDVD</key>                                                                                                                                        
      <key id="61448">ParentDir</key>                                                                                                                                        
      <key id="323748">FullScreen</key>                                                                                                                                      
      <key id="323597"">AspectRatio</key>                                                                                                                                    
      <key id="127058">Notification(Key Pressed, REC)</key>                                                                                                                  
      <key id="61624">XBMC.ActivateWindow(systeminfo)</key>                                                                                                                  
      <key id="61620">Notification(Key Pressed, Mail)</key>                                                                                                                  
      <key id="127136">Nitification(Key Pressed, Recorded TV)</key>                                                                                                          
      <key id="258132">Notification(Key Pressed, Recorded TV)</key>                                                                                                          
      <key id="61612">Notification(Key Pressed, Internet Explorer)</key>                                                                                                    
      <key id="61448">Notification(Key Pressed, Back)</key>                                                                                                                  
      <key id="61607">Notification(Key Pressed, Forward)</key>                                                                                                              
      <key id="61556">Notification(Key Pressed, Refresh)</key>                                                                                                              
      <key id="323593">Notification(Key Pressed, WindowsToggle)</key>                                                                                                        
      <key id="585796">XBMC.ActivateWindow(shutdownmenu)</key>                                                                                                              
    </keyboard>                                                                                                                                                              
  </global>
</keymap>

And the output of xbmc.log now looks like:
Code:
10:30:38 T:3022960496 M:959418368   DEBUG: OnKey: 847885 pressed, action is                                                                                                  
10:30:39 T:3022960496 M:959426560   DEBUG: SDLKeyboard: scancode: 64, sym: 308, unicode: 0, modifier: 0                                                                      
10:30:39 T:3022960496 M:959426560   DEBUG: SDLKeyboard: scancode: 133, sym: 311, unicode: 0, modifier: 100                                                                  
10:30:39 T:3022960496 M:959426560   DEBUG: OnKey: 323748 pressed, action is                                                                                                  
10:30:39 T:3022960496 M:959426560   DEBUG: SDLKeyboard: scancode: 36, sym: 13, unicode: 13, modifier: 110                                                                    
10:30:39 T:3022960496 M:959426560   DEBUG: OnKey: 847885 pressed, action is
10:31:34 T:3022960496 M:950456320   DEBUG: OnKey: 585796 pressed, action is                                                                                                  
10:31:34 T:3022960496 M:950456320   DEBUG: SDLKeyboard: scancode: 133, sym: 311, unicode: 0, modifier: 0                                                                    
10:31:34 T:3022960496 M:950456320   DEBUG: SDLKeyboard: scancode: 40, sym: 100, unicode: 100, modifier: 10                                                                  
10:31:34 T:3022960496 M:950456320   DEBUG: OnKey: 585796 pressed, action is                                                                                                  
10:31:35 T:3022960496 M:950472704   DEBUG: SDLKeyboard: scancode: 133, sym: 311, unicode: 0, modifier: 0                                                                    
10:31:35 T:3022960496 M:950472704   DEBUG: SDLKeyboard: scancode: 40, sym: 100, unicode: 100, modifier: 10                                                                  
10:31:35 T:3022960496 M:950472704   DEBUG: OnKey: 585796 pressed, action is

So xbmc can't seem to find the equivalent action to the keypress. Huh
Reply
#4
Do you have the "Remote control sends keyboard presses" option enabled in System > Settings > System > Input devices ?
Reply
#5
Ja, I've tried with and without "Remote control sends keyboard presses" (restarted after activating/deactivating this option). But I doubt this option makes any difference since my remote is recognized as a keyboard anyways.
Still no clue on that.
Reply
#6
(2012-08-24, 11:03)dead_kenny Wrote: But I doubt this option makes any difference since my remote is recognized as a keyboard anyways.
Precisely the reason you should have that option enabled.

Reply
#7
Still the same. Confused The .log lists the commands so xbmc is recognizing the keys but does not commit the action to them. Even with "remote sends keyboard presses" enabled.
Reply
#8
In Germany we have the saying "Ashes on my head" whenever we feel really embarrassed by an own mistake.

My mistake was in line 11:
Code:
<key id="323597"">AspectRatio</key>
With the double "".

And everything works fine now. Blush
Reply
#9
Ah, that certainly would do it! Wink

Some text editors, such as gedit, will highlight syntax errors such as that.
Reply
#10
Still I wonder how to disable the remote's behaviour to jump me to one of the ttys. For one of the coloured buttons it does get me to the corresponding window in XBMC but at the same time instantly commits the command to get me to one of the tty's. Could there be any possibility to disable some of the four commands the remote sends for one of the coloured buttons?
Reply
#11
Unfortunately, that remote control isn't programmable, so it is hard-wired to send out that series of keypresses with each button. On my Ubuntu 12.04 system, the Ctrl-Alt-Fn keystrokes aren't picked up by the OS, only the Ctrl-Alt-a/b/c/d and Ctrl-Alt-1/2/3/4 keystrokes are (I checked using xkeycaps). I suppose you can disable Ctrl-Alt-Fn from displaying your TTY consoles at the OS level, but that may be like using a hammer to kill a fly. Smile
Reply
#12
(2012-08-25, 20:37)artrafael Wrote: I suppose you can disable Ctrl-Alt-Fn from displaying your TTY consoles at the OS level, but that may be like using a hammer to kill a fly. Smile
Indeed. Big Grin
On my media centre I'm running debian 6.0.4. And even if there would be a possibility to deactivate the key strokes for the TTY's I still need the TTY's. And this wouldn't be worth the effort I guess. So thanx for the info! Smile
Reply
#13
Well, the quirks of this remote control plus its poor range led me to abandon it (as I'd mentioned in my first reply). I ended up getting the VRC-1100 (wiki) remote for a few dollars more and have been happy with it. I believe the VRC-1100 (wiki) is readily available (under various brand names or unbranded) in Europe as it is here in the US.
Reply

Logout Mark Read Team Forum Stats Members Help
Cannot map MCE remote0