Xiaomi Mi Box BT remote and Raspberry Pi

Hi team,

Hope I’ve done my homework well before posting Big Grin

Been googling for days to find out a way to get the Xiaomi Mi Box bluetooth remote working with Kodi (Krypton) on a Raspberry Pi (2 + bluetooth dongle). It’s a simple and cheap BT remote, pretty close to the Apple TV one, so I gave it a try. Oh boy, what a ride so far …

The remote can be paired with Kodi. I can see it in /proc/bus/input/devices.

I can use evtest to see what codes it sends :

Code:
Event: time 1498063117.174288, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70081
Event: time 1498063117.174288, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 1498063117.174288, -------------- SYN_REPORT ------------
Event: time 1498063117.354399, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70081
Event: time 1498063117.354399, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 1498063117.354399, -------------- SYN_REPORT ------------

So I’ve used this thread to try to get the remote to work. No luck.

I’ve created the evmap file (how exciting … KEY_VOLUMEUP = KEY_VOLUMEUP and so on). No luck (yes, the 99-eventlircd.rules is created, and the directory is mounted properly).

There are a few things that seem weird … maybe it has nothing to do though. Xiaomi being a Chinese company, the name of the device is in Chinese :

From dmesg :

Code:
[   93.437676] input: 小米蓝牙遥控器 as /devices/virtual/misc/uhid/0005:2717:32B1.0001/input/input0
[   93.441379] hid-generic 0005:2717:32B1.0001: input,hidraw0: BLUETOOTH HID v10.0b Keyboard [小米蓝牙遥控器] on 00:19:86:00:0B:C1

So my 99- file contains this name, in Chinese. Not sure if there’s a problem there (plus it says keyboard here, while Kodi shows it as a gamepad).

Code:
OpenELEC:~/.config/udev.rules.d # more 99-eventlircd.rules
SUBSYSTEMS=="bluetooth", GOTO="begin-bluetooth"
GOTO="end-bluetooth"
LABEL="begin-bluetooth"

ATTRS{name}=="小米蓝牙遥控器", \
  ENV{eventlircd_enable}="true", \
  ENV{eventlircd_evmap}="miboxremote.evmap"

LABEL="end-bluetooth"

Second, the codes sent by the remote seem to use a different BT protocol ?

Code:
> ACL data: handle 64 flags 0x02 dlen 15
    ATT: Handle notify (0x1b)
      handle 0x0030
      value 0x00 0x00 0x52 0x00 0x00 0x00 0x00 0x00
> ACL data: handle 64 flags 0x02 dlen 15
    ATT: Handle notify (0x1b)
      handle 0x0030
      value 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

This is totally different from the (working) BT keyboard I’ve used for comparison (sends L2CAP codes instead).

I’ve tried the keymap editor, but nothing happens when I press the buttons …

I also wanted to create a small eventclient to mimic what happens with the PS3 BD remote, but I’m stuck with some python libs that can’t be installed. So no luck this way either.

Would anyone have other pointers to things I could try ? Debug settings to turn on to monitor the BT status in Kodi ?

Cheers,
Petzi