Posts by KabelX84

    Body:

    Hardware / software

    • HP t430 thin client (Celeron N4000), LibreELEC 12.2.1 (Generic x86_64)
    • Remote: G20BTS Bluetooth air mouse (Bluetooth only, no USB dongle), ID 1d5a:c081

    Problem
    The remote paired fine via Bluetooth, but only the air mouse and the OK button worked. Arrows, Back, Home and the other buttons were ignored by Kodi.

    Diagnosis
    The remote shows up as three input devices: G20BTS Keyboard, G20BTS Mouse and G20BTS. The keyboard device reports a huge key range including BTN_0–BTN_9 plus an ABS_VOLUME axis, so udev classifies it as a tablet:


    Code
    udevadm info /dev/input/eventX | grep ID_INPUT
    E: ID_INPUT_TABLET=1
    E: ID_INPUT_TABLET_PAD=1

    Air mouse and OK work because they come from the G20BTS Mouse device, which is classified correctly.

    evtest (from the System Tools add-on, with Kodi stopped) showed the remote sends correct key codes: KEY_UP, KEY_DOWN, KEY_BACK, KEY_HOMEPAGE. Removing the tablet classification alone was not enough, though. Kodi opened the device, but debug logging showed no key events from it reaching Kodi.

    Fix
    A udev rule that removes the tablet classification and hands the device to eventlircd:


    Code
    cat > /storage/.config/udev.rules.d/70-g20bts.rules << 'EOF'
    ACTION=="add|change", KERNEL=="event*", \
      ATTRS{name}=="G20BTS Keyboard", \
      ENV{ID_INPUT_TABLET}="", \
      ENV{ID_INPUT_TABLET_PAD}="", \
      ENV{ID_INPUT_JOYSTICK}="", \
      ENV{eventlircd_enable}="true", \
      ENV{eventlircd_evmap}="default.evmap"
    EOF
    reboot

    After the reboot all buttons work.

    Notes / pitfalls

    • The rule number matters. It must sort before 98-eventlircd.rules, otherwise eventlircd isn’t started for the device. My first attempt used 99- and didn’t work.
    • Reboot instead of restarting eventlircd manually. A manual systemctl restart eventlircd made the service exit with status 1, while at boot it starts fine.
    • Check the rule with udevadm test /sys/class/input/eventX. My first version got broken by line-wrapping when pasted over SSH, and udev silently ignored it (Invalid key 'NV'). Short lines with \ continuation avoid this.

    Maybe this could be added to the default rules, since the G20BTS is a very common cheap remote.