Linux From where does Kodi get the scan-codes from a remote control??
#1
I ask this question because I am totally confused by now.

My setup is briefly this: Kodi/Kodibuntu 15.1 running on a Zotac MAG. My IR receiver is the one embedded in a Hauppauge WinTV NOVA-TD USB-dongle and the remote is a Logitech Harmony 650 emulating the DSR-112 remote that came with the Hauppauge dongle.

The remote did not work out of the box, so I spent some time getting Lirc to accept the remote. This work was successful in that I would get the correct key codes from the remote with 'irw' (link to LIRC site). But Kodi did still not respond to the remote.

By chance I stumbled on LB06's excellent post on the Kodi forum so I followed the advise given there. I ditched Lirc and got a keytable that corresponds to the remote – dib0700_rc5. This table gives the correct key codes when I run 'ir-keytable -t' Still no dice with Kodi.

The funny thing – and what puzzles me – is that Kodi does not use Lirc and apparently not the loaded keytable either. I discovered that Kodi did respond to a few (Up, Down, Left, Right, Exit/Back) keys on the remote whether or not lircd was started or not. Turning on debug in Kodi I have seen the following:

Code:
20:45:28 T:140573523589056   DEBUG: Keyboard: scancode: 0x6f, sym: 0x0111, unicode: 0x0000, modifier: 0x0
20:45:28 T:140573523589056   DEBUG: OnKey: up (0xf080) pressed, action is Up
20:45:30 T:140573523589056   DEBUG: Keyboard: scancode: 0x74, sym: 0x0112, unicode: 0x0000, modifier: 0x0
20:45:30 T:140573523589056   DEBUG: OnKey: down (0xf081) pressed, action is Down
20:45:32 T:140573523589056   DEBUG: Keyboard: scancode: 0x72, sym: 0x0113, unicode: 0x0000, modifier: 0x0
20:45:32 T:140573523589056   DEBUG: OnKey: right (0xf083) pressed, action is Right
20:45:34 T:140573523589056   DEBUG: Keyboard: scancode: 0x71, sym: 0x0114, unicode: 0x0000, modifier: 0x0
20:45:34 T:140573523589056   DEBUG: OnKey: left (0xf082) pressed, action is Left
20:45:36 T:140573523589056   DEBUG: Keyboard: scancode: 0xa6, sym: 0x00a6, unicode: 0x0000, modifier: 0x0
20:45:36 T:140573523589056   DEBUG: OnKey: browser_back (0xf0b0) pressed, action is Back

The codes listed here are nowhere to be found in the key table for the remote, where the corresponding keys are these: (found by grepping the output from 'ir-keytable -t')

Code:
scancode 0x1d14 = KEY_UP (0x67)
scancode 0x1e14 = KEY_UP (0x67)
scancode 0xeb10 = KEY_UP (0x67)
scancode 0x1d15 = KEY_DOWN (0x6c)
scancode 0x1e15 = KEY_DOWN (0x6c)
scancode 0xeb14 = KEY_DOWN (0x6c)
scancode 0x1d16 = KEY_LEFT (0x69)
scancode 0x1e16 = KEY_LEFT (0x69)
scancode 0xeb11 = KEY_LEFT (0x69)
scancode 0x1d17 = KEY_RIGHT (0x6a)
scancode 0x1e17 = KEY_RIGHT (0x6a)
scancode 0xeb13 = KEY_RIGHT (0x6a)
scancode 0x1d1f = KEY_BACK (0x9e)
scancode 0x1e1f = KEY_BACK (0x9e)
scancode 0xeb4d = KEY_BACK (0x9e)

So that leaves me with this question: From where does Kodi get the scancodes listed in the debug output??

I have tried to be as brief and concise as possible in the above. I know there is a lot of information (or is it just data?) available, but I have no idea what might be relevant in this connection.

So what tree should I bark up?
Reply
#2
Apparently I did not supply enough information in my first post in this thread so here is some additional information.

I ran this command to get the scan codes as seen by the kernel:
Code:
ir-keytable -t 2>&1 | tee keystrokes

and here is the output: Remote scan codes

Here is the corresponding log file: Kodi log file

I can find some of the key presses in the log file, but I cannot see the correspondence between what is recorded by ir-keytable and what appears in the Kodi log file.

I do hope somebody can enlighten me.

BentB
Reply
#3
You seem to miss an additional layer which is X11. X11 takes the low level codes from evdev and maps them to X11 keys. Kodi sees the same as xev displays. You may want to change some keys with xmodmap.
Reply
#4
Thank you so much. You certainly got a point there. I realize that I (again) stand at the foot of a learning curve - I have never had to look at the internals of X11 - but I believe that learning something new is the salt and pepper of life, so I'm rather optimistic right now.

BentB
Reply
#5
I think I have got my head around xev now. It appears that many of the buttons on my remote do produce events with the expected keycodes. However, several of the buttons do not produce events, in particular the "OK" button. This explains why I can maneuver around in the top window of Kodi but not get into any of the underlying windows.

The buttons that do not generate events in xev do create output when I use ir-keytable -t.

Is the any way of finding out why this is so? and how do you get the system to generate events?

BentB
Reply
#6
Read this article: http://atterer.org/mythtv-xmbc-remote-co...thout-lirc
Reply
#7
@FernetMenta: Your link was very helpful. I remapped the OK key on my remote from KEY_OK to KEY_ENTER in the keymap file in /etc/rc_keymaps/ (dib0700_rc5) and suddenly Kodi sprang to life!

It turned out that most of the keys did something useful (and at least well defined) in the various windows. All that remains now is to find some useful mapping for the remaining buttons, but that should only be a matter of time.

Thank you very much for taking the time to help me.

BentB
Reply

Logout Mark Read Team Forum Stats Members Help
From where does Kodi get the scan-codes from a remote control??0