Fix for Xiaomi bluetooth remote with nonworking button.

  • Hi,

    Wanted to report a incorrect configuration for a Xiaomi remote and a fix for it. Documenting this fairly detailed to assist anyone else that may have a similar issue.

    This is a guide on how to remap this invalid keycode. See "70-local-keyboard.hwdb" part for what should be added to libreelec's defaults.

    # cat /proc/bus/input/devices

    I: Bus=0005 Vendor=2717 Product=32b9 Version=4a4c

    N: Name="Xiaomi RC Consumer Control"

    P: Phys= ......................

    S: Sysfs=/devices/virtual/misc/uhid/0005:2717:32B9.0003/input/input8

    U: Uniq= ......................

    H: Handlers=kbd event1

    B: PROP=0

    B: EV=13

    B: KEY=50 0 0 0 0 0 38200 2 0 0 0 0 0 3000 d8011001 1c1680 0 0 0

    B: MSC=10

    I: Bus=0005 Vendor=2717 Product=32b9 Version=4a4c

    N: Name="Xiaomi RC Keyboard"

    P: Phys= ......................

    S: Sysfs=/devices/virtual/misc/uhid/0005:2717:32B9.0003/input/input10

    U: Uniq= ......................

    H: Handlers=sysrq kbd leds event2

    B: PROP=0

    B: EV=120013

    B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff fff80f80 3c00f002

    B: MSC=10

    B: LED=1f

    Default mapping of the button.

    # systemctl stop kodi

    # /storage/.kodi/addons/virtual.system-tools/bin/evtest

    ....

    Event: time 1668034708.559812, -------------- SYN_REPORT ------------

    Event: time 1668034708.717304, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0041

    Event: time 1668034708.717304, type 1 (EV_KEY), code 28 (KEY_SELECT), value 0

    Event: time 1668034708.717304, -------------- SYN_REPORT ------------

    But to work with kodi this needs to be mapped to KEY_ENTER and it defaults to KEY_SELECT.

    # udevadm test /devices/virtual/misc/uhid/0005:2717:32B9.0003/input/input8 2>&1 | grep ^MODALIAS

    MODALIAS=input:b0005v2717p32B9e4A4C-e0,1,4,k72,73,74,80,8C,90,9B,9C,9E,9F,AC,AD,161,189,18F,190,191,244,246,ram4,lsfw

    Create, or update, the file /storage/.config/hwdb.d/70-local-keyboard.hwdb with the following entry. Device-identifier (red) you get from udevadm and the keycode (green) comes from evtest.

    evdev:input:b0005v2717p32B9e4A4C*

    KEYBOARD_KEY_c0041=enter

    Reload udev rules, or just reboot.

    # udevadm hwdb --update
    # udevadm trigger -s input

    and now i got a working Xiaomi remote.

  • Go to Best Answer
  • Thanks for solving this problem. I used your instructions to do the same for my G20BTS remote. However; "70-local-keyboard.hwdb" didn't work for me so I added the lines to the existing "99-osmcrf.hwdb". The README file in that folder states that "

    your files must be named 99-xxxxx.hwdb", so I don't know if that's why it didn't like it? I am on 11 nightly (Dec1).

    It's this one, if anyone else need to do the same

    G20BTS

    evdev:input:b0005v2B54p1600e0000*

    KEYBOARD_KEY_c0041=enter

    Edited once, last by Glennza (December 2, 2022 at 12:44 AM).

  • Just did this for a BT remote from a "Nvidia Shield TV" (from around ~2015) and it works as expected with latest LibreELEC.

    chewitt

    It seems like multiple Android-box remotes use KEY_SELECT for the "ok" button while Kodi expects "Enter" for selecting things.

    Maybe LibreELEC should add a default config for BT remotes so c0041 gets mapped "enter"?

    Code
    LibreELEC:~ # cat /storage/.config/hwdb.d/70-local-keyboard.hwdb
    evdev:input:b0005v0955p7213e0002*
     KEYBOARD_KEY_c0041=enter
  • Maybe LibreELEC should add a default config for BT remotes so c0041 gets mapped "enter"?

    It's not possible (and wrong) to assume all devices have the same mapping. That said, I'll have a scout on the interwebs for other distro's lists of BT remotes and see if we can increase coverage in our default/embedded list.

  • Thanks for the thread guys, the same issue has been driving me nuts ever since buying a G20.

    I picked up a similar WeChip G20.

    Couldn't get evtest working, but got enough information from running cat /proc/bus/input/devices

    Created the 70-local-keyboard.hwdb file with the code below and it worked OK <3

    Code
    evdev:input:b0003v4842p0001*
     KEYBOARD_KEY_c0041=enter

    Edited once, last by Juiceycow (January 4, 2023 at 3:21 AM).

  • OK, so where does this file need to be on Pi4, struggling to find location. Just bought a new G20 and have this issue, strange thing is I have an existing G20 I've had for a couple years and it's OK

  • Hi,

    I recently got a sofabaton u1 universal remote, it works kinda o.k with IR mode with my libreelec 10.0.4 and a MCE IR receiver.

    It also supports Bluetooth , so i paired it with the RPI 4 Bluetooth and partially working.

    Navigation , volume and few more buttons works great, but as mentioned here OK button does not work.

    I followed the instruction here and added the following lines to the hwdb files :

    evdev:input:b0005v00C0p0000e0000*

    KEYBOARD_KEY_c0041=enter

    And it still did not work.

    I think that the remote does not send c0041 , evtest shows nothing when i press OK (it shows for other working buttons like navigation or volume).

    Does it mean the remote indeed sends nothing for those buttons ? or evtest shows only registered mapping and i need to use something else to show raw commands ? (like IRW for IR commands)

    Thanks in advance.

  • Just an update.

    Did more digging and found out that the sofabaton app can remap every button on the remote to a keyboard button so i just mapped the OK button as enter button (and the other remote keys) and so far it is working great.

  • Hi,
    i've connected an air mouse (G10 Pro) via Bluetooth to my Chromebook running Kodi 20 (installed from google play).
    The air mouse works great without any configuration, EXCEPT that the OK button doesn't work.
    Same behaviour as mentioned above for the G20BTS


    i couldn't find any .hwdb file under Android.

    i was wondering if anybody can help me to get the mapping done under ChromeOS (Android)

    THX

  • can you tell me where is this file located 99-osmcrf ?

  • It was located in /storage/.config/hwdb.d but I did some searching on the internet among other distros and consolidated all the ok button hwdb entries I could find into a single file; including the OSMC remote changes. Once that was merged the 99-osmcef.hwdb file wasn't needed anymore. You can still create your own files there.