OSMC remote control under other distributions with Kodi

Hello everybody,

I have the “old” OSMC Remote Control. (The version without volume keys). I try to get it running under Arch Linux & Kodi.

Only the arrow keys, the OK key and the back key works. Unfortunately, all other buttons do not work. I found the file “osmc-remote-lircd.conf” on GitHub, unfortunately I couldn’t get it to work with this one either

I hope I can get help here

Can you run it as a keyboard instead of using lircd? I would then expect all the keys to work with that remote other than the info and menu buttons. That is how OSMC is currently configured to use that remote. We remapped those last two buttons with udev to get them working as well.

I think the hwdb file would look like this (with home switched over to a better mapping for Kodi)…

evdev:input:b0003v2252p1037*
 KEYBOARD_KEY_7004a=esc
 KEYBOARD_KEY_c0060=i
 KEYBOARD_KEY_10084=c

@darwindesign We should probably produce an evdev modification which works with the standard Kodi keyboard layout, then I can build a small installation script.

I was adding a hwdb as you were posting that. I think that is all that should be needed for a decent Kodi default mapping. The home button would already work without a remap but it maps to a function that brings you to the top of a list, which is not particulary useful. This is also assuming that the system is not running a non-english keyboard layout that requires funky workarounds to make Kodi happy.

I don’t have that remote or Arch installed on anything to actually test it though.

I’m sure OP will be willing to test.
Can we produce some maps for all iterations of the remote?

I’m not sure it’s needed. The only change useful would be to change the home button mapping in the 1688 remote, but that could be done with Keymap Editor. Unless you want to add the volume remap to help with language support.

evdev:input:b0003v2017p1689*
 KEYBOARD_KEY_7002e=volumeup
 KEYBOARD_KEY_7002d=volumedown

evdev:input:b0003v2017p1688*
 KEYBOARD_KEY_7004a=esc
 KEYBOARD_KEY_7002e=volumeup
 KEYBOARD_KEY_7002d=volumedown

evdev:input:b0003v2252p1037*
 KEYBOARD_KEY_7004a=esc
 KEYBOARD_KEY_c0060=i
 KEYBOARD_KEY_10084=c

@gigopt88 Please put the above contents in a file called /etc/udev/hwdb.d/osmcrf.db
Then run: sudo systemd-hwdb update

Sam

If it is like OSMC that command might not work and it may require one, or perhaps two, system reboots from the remap to actually work.

The reboot is needed because there’s a systemd unit which detects changes in the include.d directory and triggers a rebuild. Using sudo systemd-hwdb update and udevadm trigger should definitely work.

I’ll add that to our postinst.

First of all thank you. Unfortunately, this doesn’t work

It would be good to get a bit more specific description of the issue.

Did you get any errors when running the systemd-hwdb command?
Have you tried rebooting?

Only the arrow keys, the OK key and the back key works. The others still don’t work

I get this symbol when I press the other buttons
symbol

No errors when running the systemd-hwdb command. I have also restarted

Can you turn on debug logging in Kodi, press the buttons, and then share the Kodi log. You can use https://paste.osmc.tv/

Sorry for the late reply

Here is the Kodi log Output

https://paste.osmc.tv/amefihoxej.md

Are you using a non-english keyboard layout?

The home button is actually working, just not doing anything useful as I expected…

2020-06-11 09:57:32.944 T:140414769291840   DEBUG: HandleKey: home (0xf088) pressed, action is FirstPage

…but that is also telling me that it didn’t remap to the esc key. Can you double check the hwdb file you made to make sure it is exactly as what was posted above. In particular there must be exactly one space before each of the remapping lines. Also make sure there is not an execution permission set on that file as that will keep it from working as well.

Sorry for the very late reply.

The “i” key and the key right of the back key are working now. Play/Pause, Stop, Forward and backward still do not work

I copied the file /usr/share/kodi/system/keymaps/osmc_classic.xml from an OSMC test installation to /usr/share/kodi/system/keymaps/ and /home/kodi/.kodi/userdata/keymaps/.

@darwindesign Yes, i have double check the hwdb file, it is exactly as what was posted above. But the filename was wrong. The file must be named osmcrf.hwdb

Any Ideas? Thanks!

I don’t have an answer to that one. They should be getting picked up as regular multimedia keys but instead they are displaying as something I can’t explain…

2020-06-11 09:57:32.361 T:140414769291840   DEBUG: HandleKey: long-0 (0x100f200, obc-16838913) pressed, action is
2020-06-11 09:57:41.960 T:140414769291840   DEBUG: HandleKey: leftctrl (0xf0d0) pressed, action is
2020-06-11 09:57:41.994 T:140414769291840   DEBUG: HandleKey: ctrl-space (0x1f020) pressed, action is
2020-06-11 09:57:42.079 T:140414769291840   DEBUG: HandleKey: ctrl-leftalt (0x1f0d4) pressed, action is
2020-06-11 09:58:15.778 T:140414769291840   DEBUG: HandleKey: 0 (0xf200, obc-61697) pressed, action is
2020-06-11 09:58:25.661 T:140414769291840   DEBUG: HandleKey: leftalt (0xf0d4) pressed, action is

I think the o and long-o where probably the keys you have working now but why the others would be getting picked up as dead keys I have no answer for. On the testing in OSMC none of the languages had any issue picking up the multimedia keys so I didn’t have to change any mapping on them.

In order to work around language issues in Kodi I remapped i and c to ( and ) with udev. That osmc_classic.xml keymap just adds mapping for that with a slight tweak to make it map similar to our old remote (If they choose to disable our custom keymap). As the hwdb file posted in this thread maps directly to i and c, which line up with stock Kodi keymaps for info and context menu, that file doesn’t really do anything for you.

If you were looking to get to where you were emulating the current OSMC function the keymap you would be looking for is /usr/share/kodi/system/keymaps/osmc/osmc_remote.xml but you would not be able to load it from the same location without modifying peripherals.xml. You could just copy it to .kodi/userdata/keymaps/ and it should load.

I would guess the next step would be to run evtest and see what it reports when you press the keys that are not working. If it is reporting them as something odd then perhaps you could add them to your (I believe your saying now working) hwdb file to map them correctly. It should look something like this…

Summary
osmc@kodi_cave:~$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:      OSMC Remote Controller  USB Keyboard Mouse
/dev/input/event1:      OSMC Remote Controller  USB Keyboard Mouse Mouse
/dev/input/event2:      OSMC Remote Controller  USB Keyboard Mouse Consumer Control
/dev/input/event3:      OSMC Remote Controller  USB Keyboard Mouse System Control
/dev/input/event4:      Logitech K400
Select the device event number [0-4]: 2
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x2017 product 0x1689 version 0x110
Input device name: "OSMC Remote Controller  USB Keyboard Mouse Consumer Control"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 28 (KEY_ENTER)
    Event code 74 (KEY_KPMINUS)
    Event code 78 (KEY_KPPLUS)
    Event code 103 (KEY_UP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 108 (KEY_DOWN)
    Event code 110 (KEY_INSERT)
    Event code 111 (KEY_DELETE)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 116 (KEY_POWER)
    Event code 119 (KEY_PAUSE)
    Event code 120 (KEY_SCALE)
    Event code 128 (KEY_STOP)
    Event code 130 (KEY_PROPS)
    Event code 131 (KEY_UNDO)
    Event code 133 (KEY_COPY)
    Event code 134 (KEY_OPEN)
    Event code 135 (KEY_PASTE)
    Event code 136 (KEY_FIND)
    Event code 137 (KEY_CUT)
    Event code 138 (KEY_HELP)
    Event code 139 (KEY_MENU)
    Event code 140 (KEY_CALC)
    Event code 142 (KEY_SLEEP)
    Event code 144 (KEY_FILE)
    Event code 150 (KEY_WWW)
    Event code 152 (KEY_SCREENLOCK)
    Event code 155 (KEY_MAIL)
    Event code 156 (KEY_BOOKMARKS)
    Event code 158 (KEY_BACK)
    Event code 159 (KEY_FORWARD)
    Event code 161 (KEY_EJECTCD)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 167 (KEY_RECORD)
    Event code 168 (KEY_REWIND)
    Event code 169 (KEY_PHONE)
    Event code 171 (KEY_CONFIG)
    Event code 172 (KEY_HOMEPAGE)
    Event code 173 (KEY_REFRESH)
    Event code 174 (KEY_EXIT)
    Event code 176 (KEY_EDIT)
    Event code 177 (KEY_SCROLLUP)
    Event code 178 (KEY_SCROLLDOWN)
    Event code 181 (KEY_NEW)
    Event code 182 (KEY_REDO)
    Event code 206 (KEY_CLOSE)
    Event code 207 (KEY_PLAY)
    Event code 208 (KEY_FASTFORWARD)
    Event code 209 (KEY_BASSBOOST)
    Event code 210 (KEY_PRINT)
    Event code 212 (KEY_CAMERA)
    Event code 216 (KEY_CHAT)
    Event code 217 (KEY_SEARCH)
    Event code 219 (KEY_FINANCE)
    Event code 223 (KEY_CANCEL)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 228 (KEY_KBDILLUMTOGGLE)
    Event code 229 (KEY_KBDILLUMDOWN)
    Event code 230 (KEY_KBDILLUMUP)
    Event code 231 (KEY_SEND)
    Event code 232 (KEY_REPLY)
    Event code 233 (KEY_FORWARDMAIL)
    Event code 234 (KEY_SAVE)
    Event code 235 (KEY_DOCUMENTS)
    Event code 240 (KEY_UNKNOWN)
    Event code 241 (KEY_VIDEO_NEXT)
    Event code 244 (KEY_BRIGHTNESS_ZERO)
    Event code 256 (BTN_0)
    Event code 353 (KEY_SELECT)
    Event code 354 (KEY_GOTO)
    Event code 358 (KEY_INFO)
    Event code 362 (KEY_PROGRAM)
    Event code 366 (KEY_PVR)
    Event code 370 (KEY_SUBTITLE)
    Event code 372 (KEY_ZOOM)
    Event code 374 (KEY_KEYBOARD)
    Event code 376 (KEY_PC)
    Event code 377 (KEY_TV)
    Event code 378 (KEY_TV2)
    Event code 379 (KEY_VCR)
    Event code 380 (KEY_VCR2)
    Event code 381 (KEY_SAT)
    Event code 383 (KEY_CD)
    Event code 384 (KEY_TAPE)
    Event code 386 (KEY_TUNER)
    Event code 387 (KEY_PLAYER)
    Event code 389 (KEY_DVD)
    Event code 392 (KEY_AUDIO)
    Event code 393 (KEY_VIDEO)
    Event code 396 (KEY_MEMO)
    Event code 397 (KEY_CALENDAR)
    Event code 398 (KEY_RED)
    Event code 399 (KEY_GREEN)
    Event code 400 (KEY_YELLOW)
    Event code 401 (KEY_BLUE)
    Event code 402 (KEY_CHANNELUP)
    Event code 403 (KEY_CHANNELDOWN)
    Event code 405 (KEY_LAST)
    Event code 407 (KEY_NEXT)
    Event code 408 (KEY_RESTART)
    Event code 409 (KEY_SLOW)
    Event code 410 (KEY_SHUFFLE)
    Event code 412 (KEY_PREVIOUS)
    Event code 416 (KEY_VIDEOPHONE)
    Event code 417 (KEY_GAMES)
    Event code 418 (KEY_ZOOMIN)
    Event code 419 (KEY_ZOOMOUT)
    Event code 420 (KEY_ZOOMRESET)
    Event code 421 (KEY_WORDPROCESSOR)
    Event code 422 (KEY_EDITOR)
    Event code 423 (KEY_SPREADSHEET)
    Event code 424 (KEY_GRAPHICSEDITOR)
    Event code 425 (KEY_PRESENTATION)
    Event code 426 (KEY_DATABASE)
    Event code 427 (KEY_NEWS)
    Event code 428 (KEY_VOICEMAIL)
    Event code 429 (KEY_ADDRESSBOOK)
    Event code 430 (KEY_MESSENGER)
    Event code 431 (KEY_DISPLAYTOGGLE)
    Event code 432 (KEY_SPELLCHECK)
    Event code 433 (KEY_LOGOFF)
    Event code 439 (KEY_MEDIA_REPEAT)
    Event code 442 (KEY_IMAGES)
    Event code 576 (KEY_BUTTONCONFIG)
    Event code 577 (KEY_TASKMANAGER)
    Event code 578 (KEY_JOURNAL)
    Event code 579 (KEY_CONTROLPANEL)
    Event code 580 (KEY_APPSELECT)
    Event code 581 (KEY_SCREENSAVER)
    Event code 582 (KEY_VOICECOMMAND)
    Event code 583 (?)
    Event code 592 (KEY_BRIGHTNESS_MIN)
    Event code 593 (KEY_BRIGHTNESS_MAX)
    Event code 608 (KEY_KBDINPUTASSIST_PREV)
    Event code 609 (KEY_KBDINPUTASSIST_NEXT)
    Event code 610 (KEY_KBDINPUTASSIST_PREVGROUP)
    Event code 611 (KEY_KBDINPUTASSIST_NEXTGROUP)
    Event code 612 (KEY_KBDINPUTASSIST_ACCEPT)
    Event code 613 (KEY_KBDINPUTASSIST_CANCEL)
  Event type 2 (EV_REL)
    Event code 6 (REL_HWHEEL)
  Event type 3 (EV_ABS)
    Event code 32 (ABS_VOLUME)
      Value      0
      Min        0
      Max      896
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1592686292.603164, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0226
Event: time 1592686292.603164, type 1 (EV_KEY), code 128 (KEY_STOP), value 1
Event: time 1592686292.603164, -------------- SYN_REPORT ------------
Event: time 1592686292.619171, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0226
Event: time 1592686292.619171, type 1 (EV_KEY), code 128 (KEY_STOP), value 0
Event: time 1592686292.619171, -------------- SYN_REPORT ------------
Event: time 1592686297.083142, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1592686297.083142, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
Event: time 1592686297.083142, -------------- SYN_REPORT ------------
Event: time 1592686297.099108, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1592686297.099108, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1592686297.099108, -------------- SYN_REPORT ------------

Output of evtest: (i pressed all keys)
https://paste.osmc.tv/torujuwatu.coffee
https://paste.osmc.tv/vuyosunewi.coffee

Hope it helps

That output from evtest is showing the keys being picked up correctly by the OS. Unless @sam_nazarko or someone else has any clue on why Kodi on another distro wouldn’t pick up the multimedia keys (out of my depth) I think I would try switching the buttons over to alternatives with…

 evdev:input:b0003v2252p1037*
 KEYBOARD_KEY_7004a=esc
 KEYBOARD_KEY_c0060=i
 KEYBOARD_KEY_10084=c
 KEYBOARD_KEY_c00cd=p
 KEYBOARD_KEY_c0226=x
 KEYBOARD_KEY_c00b4=r
 KEYBOARD_KEY_c00b3=f

Except for Play/Pause, all buttons now work