problem with "longpress" actions in keymap.xml under LibreELEC (Leia) v8.90.009 ALPHA

  • I've upgraded from KODI v17.6 to KODI v18 (RC2) using LibreELEC (Leia) v8.90.009 ALPHA and ran into the problem that my previous modified "keymap.xml" located in the "userdata" folder/"keymaps" subfolder does not work anymore with the remote control which was shipped with the WETEK PLAY 2 :(

    Gy0oeZB.png

    I found out that the codes of the remote control buttons did change from KODI v17.6 to 18, so I had to determine them all again with the help of the "Keymap Editor" AddOn. Unfortunately, the "longpress" actions are not working anymore and also prevent the "normal" behaviour of the short pressed key.

    Example 1:

    Code
    <keymap>
      <global>
        <keyboard>
          <key id='232'>ActivateWindow(TVRecordings)</key>
        </keyboard>
      </global>
    </keymap>

    When pressing the remote control button 30 in this example it works as it should (-> the window with the TV recordings pops up).

    Debug log: 03:36:06.438 T:4091061024 NOTICE: --------------------------------------------- - Pastebin.com

    At 03:36:17.816 I did press remote control button 30 for the first time

    Example 2:

    Code
    <keymap>
      <global>
        <keyboard>
          <key id='232'>ActivateWindow(TVRecordings)</key>
          <key id='232' mod="longpress">ActivateWindow(Favourites)</key>
        </keyboard>
      </global>
    </keymap>

    When long pressing the remote control button 30 in this example it does not work as it should (-> the window with the favourites does not pop up), and when short pressing the remote control button 30 the window with the TV recordings also does not pop up....

    Debug log: 03:53:18.669 T:4089094944 NOTICE: --------------------------------------------- - Pastebin.com

    At 03:53:30.332 I did press remote control button 30 for the first time

    Please fix it with a new build!

    Thank you in advance!

  • Kodi recevies the remote button presses as LIRC events, not keyboard events, and Kodi doesn't support longpress with those.

    I'm not exactly sure how it was handled in LE 8.2 but if you got keyboard events from the remote it was most likely a bug. The LIRC translation by eventlircd is needed because Kodi doesn't support a lot of the buttons on remotes in keyboard mode - see the wiki for details Infrared Remotes [LibreELEC.wiki]

    You can disable the LIRC translation via a custom 98-eventlircd.rules udev rule file but keep in mind that this is not officially supported and you might have to change the remote keymap as well so it contains only keycodes that kodi can handle. If you are prepared to go this route you can completely disable LIRC translation by eventlircd by creating an empty udev rule file:

    Code
    : > /storage/.config/udev.rules.d/98-eventlircd.rules

    so long,

    Hias

  • @Hias: Thank you very much for your response!

    I've done what you said and disabled the LIRC translation via the command you gave, and after that, "mod=longpress" is working again! With the help of the "Keymap Editor" addon it turned out that the KeyIDs which I have to write into my "keymap.xml" still differ from the ones at the time when I was using KODI 17.6, so I had to determine them all once again.

    But the really bad news is: now there are different buttons on the remote control where the "Keymap Editor" addon displays the same KeyID, for example button 7, 11 and 32 all are identified with "61952", button 22, 23, 24, 25 with "16839168" and so on :(

    I don't understand how this is possible, I mean, it's the same piece of hardware as before the upgrade from KODI 17.6 to 18...

    Regarding other configuration file(s) you mentioned ("remote keymap"), I would like to point out that under KODI v17.6 I only had to cope with "keymap.xml" and this way all was good to go, as KODI 17.6 actually recognized the remote control as a "keyboard" and not a "real" remote control.

    I'm a bit confused: has KODI 18 dropped the support for the usage of this kind of device?

    And I'm totally clueless what I would have to write into any other configuration file(s) other than "keymap..xml"...

    Could you please help me a little further with it?

  • I completely forgot that LibreELEC 8 still used the old, proprietary amremote / remote.conf mechanism on Amlogic devices. In LE 9 this was switched to ir-keytable so the same mechanism like on all other Linux devices can be used. This is probably the reason why you got keyboard events on LE8 and the keycodes are a bit different.

    As for the non-working buttons: quite probably the keytable contains problematic KEY_ values that Kodi can't handle.

    To find out which ones they are stop kodi and eventlircd and run "ir-keytable -t", then look at the KEY_xxx values of the non-working buttons.

    Then copy the wetek_play_2 keytable from /usr/lib/udev/rc_keymaps to .config/rc_keymaps and change the problematic KEY_xxx entries to something kodi can handle - KEY_F1..KEY_F15 should work for example (any other keys that you'd typically find on a normal keyboard should work fine, too).

    Then activate and test the keytable as described on the wiki page.

    I had a quick look at the wetek_play_2 keytable and found a few odd entries like KEY_COMPOSE or KEY_CAPSLOCK. These could be problematic.

    so long,

    Hias

  • @Hias; Thank you again for helping me!

    As I'm considering myself a "NOOB" following suggestons like "stopping KODI and eventlircd" (whereby I don't have an idea how to prevent LibreELEC from starting KODI, or closing KODI but staying in LibreELEC) and am a little afraid of breaking a running system, let me please ask some questions first:

    I stumbled about a posting in the section "LE9.0 remote configs ir-keytable Amlogic devices" where an user has published his config for the Wetek Play 2 remote control with detailed instructions, see here: LE9.0 remote configs ir-keytable Amlogic devices

    Would that procedure also work under "LibreELEC (Leia) v8.90.009 ALPHA" or are some other steps needed?

    And if "yes": would the problem with the not supported longpress actions be solved this way or are there any other "work-arounds" for it?

  • Read through the IR remote wiki page Infrared Remotes [LibreELEC.wiki] , it contains detailed descriptions and examples which commands to use and how. eg to stop kodi and eventlircd you have to use

    Code
    systemctl stop kodi
    systemctl stop eventlircd

    The posting you linked to includes the same keytable file as we already include in LibreELEC - so that won't help. Also better don't follow the instructions from that post, thinks have change a bit since then and blindly copying udev rule files may make things worse.

    It could be that your old configuration settings are somehow interfering so it's best to drop them. Delete all files in .kodi/userdata/keymaps/ and then reboot so you can start from scratch.

    Before you start tweaking kodi's keymap file verify that kodi is receiving all buttons correctly. Enable debug logging, ssh in and run the following command to get a "live view" on kodi's logfile:

    Code
    tail -f .kodi/temp/kodi.log

    Now press buttons on your remote. For each button press you should see 2 lines logged like these:

    Code
    12:54:03.957 T:1936904864 DEBUG: Keyboard: scancode: 0x66, sym: 0x0116, unicode: 0x0000, modifier: 0x2000
    12:54:03.957 T:1936904864 DEBUG: HandleKey: home (0xf088) pressed, action is FirstPage

    The first line tells you which keycode kodi received, the scancodes should be different for all buttons on your remote. If it's not something's wrong with the ir-keytable configuration.

    The second line tells you the resulting action after kodi applied it's keymap.xml files - you can use this info to verify if you got your keymap.xml file right after you started tweaking it.

    so long,

    Hias

  • @Hias:

    Yesterday I had enough time to look thoroughly through your suggestions - and finally I can say it is working with "longpress" actions, too.

    Now me and my family are happily using again our remote control :)

    Thank you very much and have a merry Xmas :)