[SOLVED] Map remote button to Kodi Context Menu

Post Reply
gramenauer
Posts: 27
Joined: Wed Dec 30, 2015 2:01 am
languages_spoken: english
ODROIDs: C1+
Location: Barcelona
Has thanked: 0
Been thanked: 0
Contact:

[SOLVED] Map remote button to Kodi Context Menu

Post by gramenauer »

Hi, I have C1+ with Ubuntu on it.

I want to map the "Options" button on my remote to "Context Menu" on Kodi.
Button presses from my remote are converted to "key presses" via CEC driver.

So to achieve my goal I have tried this:

1) Editting Kodi's keyboard.xml

In order to know the exact keycode, I enabled Kodi's depuration log, and this is what I get:

Code: Select all

12:38:41 T:3035914240   DEBUG: Keyboard: scancode: 0x93, sym: 0x1008ff65, unicode: 0x0000, modifier: 0x0
12:38:41 T:3035914240   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
12:38:41 T:3035914240   DEBUG: Previous line repeats 1 times.
So the key is mapped on "0xf200" which means (if I'm not wrong) that Kodi is not recognizing the key.
Anyway, I can edit keyboard.xml in order to configure keycode "0xf200" to the ContextMenu but ...... surprise ... the stop button is also getting 0xf200 code on Kodi, so I have to choose between "Stop" and "Context Menu". The first wins :). I finally dropped out this solution, didn't know how to get Kodi recognize the correct keycode (I think I should recompile Kodi which is not easy for me)

2) xmodmap

Using "xev" (out from Kodi, on LXTerminal), I get this:

Code: Select all

KeyPress event, serial 37, synthetic NO, window 0x2400001,
    root 0xa5, subw 0x0, time 7944183, (163,-16), root:(219,84),
    state 0x0, keycode 147 (keysym 0x1008ff65, XF86MenuKB), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False
So it seems that OS is getting the right keycode for my button (keycode 147) (stop button gives another keycode)

In KODI, if we want to popup the context menu, we only need to press "C" on the selected item. So, using "xmodmap", I tried to map keycode 147 to letter "C", like this:

Code: Select all

xmodmap -e "keycode 147 = C"
and verifying with "xmodmap -pke | grep "keycode 147" I can see:

Code: Select all

keycode 147 = c C c C
then I pressed the "options" button and .. "C" appears on my terminal. But after few seconds ... it no longer works. It seems that there is a process overwritting the xmodmap configuration, because after few seconds the command "xmodmap -pke | grep "keycode 147" " shows:

Code: Select all

keycode 147 = XF86MenuKB NoSymbol XF86MenuKB
Finally I dropped out this solution because of that issue

3) Changing keyboard layout

using setxkbmap, I tried to modify "us" keyboard layout, trying to assign keycode 147 to "C" letter, with no success.
And finally dropped out, I was modifying root files and actually I was not concerned of what I was exactly doing ....


I'm a bit desperate right now. Don't know what more to do. So I decided to ask for help here. Which is the correct way to achieve this?

Many thanks to all.
Gram.

stmicro
Posts: 255
Joined: Tue Apr 28, 2015 4:23 pm
languages_spoken: english, chinese
ODROIDs: Many Odroids and Rpis.
Location: shenzhen china
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Map remote button to Kodi Context Menu

Post by stmicro »


gramenauer
Posts: 27
Joined: Wed Dec 30, 2015 2:01 am
languages_spoken: english
ODROIDs: C1+
Location: Barcelona
Has thanked: 0
Been thanked: 0
Contact:

Re: Map remote button to Kodi Context Menu

Post by gramenauer »

Hi stmicro,
No, it's not related, because on my case remote control buttons are mapped to keyboard strokes, via CEC driver.
So the file to be edited is keyboard.xml rather than remote.xml, which is the first solution I already tried.

The issue on your thread is related to IR remotes, not CEC/keyboard issues.

Thanks anyway ;)

gramenauer
Posts: 27
Joined: Wed Dec 30, 2015 2:01 am
languages_spoken: english
ODROIDs: C1+
Location: Barcelona
Has thanked: 0
Been thanked: 0
Contact:

Re: Map remote button to Kodi Context Menu

Post by gramenauer »

Any clue? Thanks!

User avatar
rooted
Posts: 9506
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 761 times
Been thanked: 487 times
Contact:

Re: Map remote button to Kodi Context Menu

Post by rooted »

Have you tried the keymap editor KODI plugin?

/tmp
Posts: 21
Joined: Fri Mar 13, 2015 9:42 am
languages_spoken: English, Deutsch,
ODROIDs: C1
Has thanked: 0
Been thanked: 0
Contact:

Re: Map remote button to Kodi Context Menu

Post by /tmp »

This -----^
Another option is Flirc -
a programmable IR usb dongle
(could also be used in conjuction with keymap for complex setups)
I use this for my Htpc and it's nice for single remote setups.

or just .xml

gramenauer
Posts: 27
Joined: Wed Dec 30, 2015 2:01 am
languages_spoken: english
ODROIDs: C1+
Location: Barcelona
Has thanked: 0
Been thanked: 0
Contact:

Re: Map remote button to Kodi Context Menu

Post by gramenauer »

The problem is that Kodi is not recognizing the key, it is giving the keycode "0xf200" which means something like "I know you pressed something but can't determine the exact keycode".

The problem is that Kodi is giving the "0xf200" code to the "stop" button too, for the same reason. Then I have to choose to map the stop button or to map the "options" button to context menu ..

Finally I solved it with a little workaround. I mapped the 0xf200 keycode to Context Menu in Global Scope (using KeyMap Editor Kodi add-on), and mapped the same keycode to "stop" action in Fullscreen Video Scope, so the same keycode has a different behaviour depending on the scope.

Many thanks for your help.

Gram.

User avatar
rooted
Posts: 9506
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 761 times
Been thanked: 487 times
Contact:

Re: Map remote button to Kodi Context Menu

Post by rooted »

Glad you got it working.

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 1 guest