HID: bpf: add in-tree HID-BPF fix for the XBox Elite 2 over Bluetooth
authorBenjamin Tissoires <bentiss@kernel.org>
Wed, 10 Apr 2024 17:19:27 +0000 (19:19 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Tue, 7 May 2024 13:39:12 +0000 (15:39 +0200)
commit1c046d09c6ba4ff5fb959b2d195cacadb2ae6977
tree5943b580af384322d3373b1203d38a6fadc302df
parentd9e78973921d215a6453b609a6326dab9dbc5a60
HID: bpf: add in-tree HID-BPF fix for the XBox Elite 2 over Bluetooth

When using the XBox Wireless Controller Elite 2 over Bluetooth,
the device exports the paddle on the back of the device as a single
bitfield value of usage "Assign Selection".

The kernel doesn't process those usages properly and report KEY_UNKNOWN
for it.

SDL doesn't know how to interprete that KEY_UNKNOWN and thus ignores the
paddles.

Given that over USB the kernel uses BTN_TRIGGER_HAPPY[5-8], we
can tweak the report descriptor to make the kernel interprete it properly:
- we need an application collection of gamepad (so we have to close the
  current Consumer Control one)
- we need to change the usage to be buttons from 0x15 to 0x18

Link: https://lore.kernel.org/r/20240410-bpf_sources-v1-7-a8bf16033ef8@kernel.org
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/bpf/progs/Microsoft__XBox-Elite-2.bpf.c [new file with mode: 0644]