MCE Keyboard input not detected

  • Hi, I'm trying to accomplish what this guy set out to do initially: Other thread. Unfortunately, he gave up and reverted to using an MCE Remote but I'd like to know if it's actually possible.

    I'm using an Intel NUC i3 34010WYB and the most recent Kodi 18 test build (#0425, 25-Apr-2018). I have a Logitech Harmony remote which is programmed to act as a hybrid MCE Remote/Keyboard. My ir-keytable output looks like this:

    Code
    NUCElec:~ # ir-keytable
    Found /sys/class/rc/rc0/ (/dev/input/event9) with:
            Driver: nuvoton-cir, table: rc-rc6-mce
            lirc device: /dev/lirc0
            Supported protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
            Enabled protocols: lirc rc-6
            Name: Nuvoton w836x7hg Infrared Remote
            bus: 25, vendor/product: 1050:00c3, version: 0x0033
            Repeat delay = 500 ms, repeat period = 125 ms

    I'm following the Infrared Remotes section of the Wiki and assumed when I set ir-keytable to use the mce-kbd protocol, I'd see some input being logged but it doesn't detect anything. I actually have a proper MCE Keyboard here too and that doesn't get detected either, not the letter, not the direction keys or any of the MCE specific keys. I don't mind going to the effort of creating a custom keymap but as I understand it, I can't unless ir-keytable actually sees something from the keyboard. Can anyone help?

    edit: ir-ctl -r does produce lots of pulses and spaces when tapping away on the MCE keyboard but the Wiki article doesn't go into any detail about how to proceed from there.

  • mce_kbd is a bit different than the other IR protocols, if it's enabled a separate input event device will be created.

    To check if signals are properly received and decoded it's best to install the system tools addon and then use "evtest" (with kodi and eventlircd stopped) instead of "ir-keytable -t". Just select the event device that reads "MCE IR Keyboard/Mouse".

    eg:

    so long,

    Hias

  • Thank you Hias, I've installed system tools and am seeing lots of lovely input from my MCE keyboard now. This method of detecting input is a little off piste from the Wiki article on setting up IR remotes though, would you mind telling me how I proceed or which sections of the Wiki article are still valid for me to follow?

    This is what it looks like if it helps:

    edit: wait, the output from evtest shows that the ir codes are already being translated to key presses (e.g. KEY_Q) so I don't need to create a keymap do I? I just need to get Kodi to switch to listening on the mce_kb protocol. How do I do that? Or am I completely misunderstanding the evtest output and Wiki article?

    Edited once, last by beeswax (April 26, 2018 at 5:17 PM).

  • For mce_kbd everything's a lot simpler: just enable the mce_kbd protocol and Kodi should automatically pick up the device and everything should work.

    So just running "ir-keytable -p mce_kbd" (while kodi is running) should be enough. If not, try restarting kodi (systemctl restart kodi).


    so long,

    Hias

  • Thanks Hias, yes simply running ir-keytable -p mce_kbd gets the MCE keyboard working. I've combined mce_kbd with rc-6 using:

    Code
    ir-keytable -p mce_kbd -p rc-6

    and this now works perfectly with my Harmony Remote which utilises both MCE keyboard and remote commands. The only problem: its getting reset every time the machine reboots - how to make it persist?

  • It's odd that enabling mce_kbd kills other input in kodi, this shouldn't happen. I haven't seen this on RPi yet and on x86 it also should work fine. Have you checked if restarting kodi helps?

    Combining MCE remote and MCE keyboard functionality is possible, and it's also rather easy to make that persistent.

    Copy the stock mce keymap from the system to .config/rc_keymaps, and give it a unique name so you later know what it's doing :)

    Code
    cp /usr/lib/udev/rc_keymaps/rc6_mce .config/rc_keymaps/mce_plus_keyboard

    then edit this file and add the "mce_kbd" protocol in the very first line - it should then look like this:

    Code
    # table rc6_mce, type: RC6,mce_kbd
    0x800f0400 KEY_NUMERIC_0
    0x800f0401 KEY_NUMERIC_1
    ...

    Now create a .config/rc_maps.cfg to activate that keymap. eg

    Code
    * * mce_plus_keyboard

    so long,

    Hias

  • It works! I really, really appreciate your help today Hias, you've been incredibly helpful and helped me in my first attempt to get away from a Windows-based Kodi solution to a Linux one. Thanks!

  • Great guys, was looking for this for hours.

    Thanks!

    Can I also use this to make this working as systemwide keyboard on Ubuntu?

    Update: yes, works fine.

    How can I adjust the frequency of keystrokes. It's a bit too much with the remote control...

    Edited once, last by novalis (September 3, 2018 at 11:18 PM).

  • Can I also use this to make this working as systemwide keyboard on Ubuntu?

    Haven't tested it myself but it should work, too. You need to place the config in /etc/ then, of course.

    Actually just running "sudo ir-keytable -p mce_kbd" should be enough to get input from your MCE keyboard working.

    so long,

    Hias

  • Sorry I edited my post before I read your answer...

    Do you know how to adjust the frequencies. The Keyboard sometimes lags a bit to much, so that some keys aren't coming. The remote control on the other side gives mutliple signals at once.

  • Which LE version are you using? LE 9 (alpha) contains significant improvements in IR remote handling that make them react a lot snappier.

    If sometimes button presses aren't recognized make sure you have good IR reception - try placing the IR somewhere else - and you have fresh batteries in your remote. Worn out buttons, interference from fluorescent lights or direct sunlight, and the type of IR receiver (there are better and not so good ones) can also cause issues.

    You can adjust the repeat delay (time until repeat kicks in) and repeat period ("frequency" of repeat) with the ir-keytable parameters -D (delay) and -P (period). eg add this to your autostart.sh to let repeat kick in after 750ms and then repeat 4 times a second:

    Code
    ir-keytable -D 750 -P 250

    so long,

    Hias

  • :)

    that question was actually directed to the Ubuntu tweak, in Libreelec I haven't had any problems so far. I use the config.txt entry to install the remote and that works just fine, out of the box.

    The ir-keytable parameters were just what I was looking for. Thanks again.