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


    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.



    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




    Edited once, last by Glennza ().

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


    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"?

    LibreELEC:~ # cat /storage/.config/hwdb.d/70-local-keyboard.hwdb

    • Best Answer

    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


    Edited once, last by Juiceycow ().

  • 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 :



    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.