Skip to content

HID: bpf: Fix Rapoo M50 Plus Silent side buttons

José Expósito requested to merge JoseExposito/udev-hid-bpf:rapoo-m50 into main

The Rapoo M50 Plus Silent mouse has 2 side buttons in addition to the left, right and middles buttons. However, its original HID descriptor has a Usage Maximum of 3, preventing the side buttons to work.

This HID-BPF driver changes that usage to 5.

Link: libinput/libinput#1015 (closed)


@jussi.lahtinen here is the fix for your mouse. Following the tutorial: https://libevdev.pages.freedesktop.org/udev-hid-bpf/getting-started.html

You should be able to install the HID-BPF program for your device executing these commands:

$ git clone --branch rapoo-m50 https://gitlab.freedesktop.org/JoseExposito/udev-hid-bpf.git
$ cd udev-hid-bpf
$ meson setup builddir
$ meson compile -C builddir
$ meson install -C builddir

Disconnect and connect your mouse and the side buttons should work.

I couldn't test it properly because the program refuses to load:

$ ninja -C builddir && \
   sudo ./builddir/udev-hid-bpf --verbose add --replace \
   /sys/bus/hid/devices/0003:24AE:2015.* - \
   $(pwd)/builddir/src/bpf/10-Rapoo__M50-Plus-Silent.bpf.o
ninja: Entering directory `builddir'
ninja: no work to do.
[sudo] password for jexposit: 
DEBUG - loading BPF object at "/home/jexposit/Devel/udev-hid-bpf/builddir/src/bpf/10-Rapoo__M50-Plus-Silent.bpf.o"
DEBUG - libbpf: elf: skipping unrecognized data section(7) .hid_bpf_config
DEBUG - Using HID_BPF_STRUCT_OPS
WARN - libbpf: struct_ops init_kern: struct bpf_struct_ops_hid_bpf_ops is not found in kernel BTF
WARN - libbpf: failed to load object '/home/jexposit/Devel/udev-hid-bpf/builddir/src/bpf/10-Rapoo__M50-Plus-Silent.bpf.o'
WARN - Failed to load "/home/jexposit/Devel/udev-hid-bpf/builddir/src/bpf/10-Rapoo__M50-Plus-Silent.bpf.o": No such file or directory (os error 2)

$ ls /home/jexposit/Devel/udev-hid-bpf/builddir/src/bpf/10-Rapoo__M50-Plus-Silent.bpf.o
/home/jexposit/Devel/udev-hid-bpf/builddir/src/bpf/10-Rapoo__M50-Plus-Silent.bpf.o

Maybe @bentiss knows why I'm getting a no such file or directory error when the file is present?

Merge request reports