linux/drivers/hid/bpf/progs
muhammed Rishal 30fb45cc2e bpf: Add fix for Trust Philips SPK6327 (145f:024b) modifier keys
The Trust Philips SPK6327 keyboard (USB ID 145f:024b) has a broken HID
descriptor on interface 1. Byte 101 is 0x00 (Input Array) but should be
0x02 (Input Variable), causing LCtrl, LAlt, Super, RAlt, RCtrl and
RShift to all report as LShift on Linux.

This BPF fix patches byte 101 at runtime fixing all affected modifier
keys.

Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/234
Signed-off-by: muhammed Rishal <muhammedrishal7777777@gmail.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2026-04-08 21:47:02 +02:00
..
FR-TEC__Raptor-Mach-2.bpf.c HID: bpf: convert in-tree fixes into struct_ops 2024-06-14 11:20:20 +02:00
Generic__touchpad.bpf.c HID: bpf: add a BPF to get the touchpad type 2026-04-08 21:46:00 +02:00
hid_bpf_async.h HID: bpf: hid_bpf_helpers: provide a cleanup functions 2026-04-08 21:46:00 +02:00
hid_bpf_helpers.h hid: bpf: hid_bpf_helpers: add helper for having read/write udev properties 2026-04-08 21:46:00 +02:00
hid_bpf.h HID: bpf: Add Huion Dial 2 bpf fixup 2024-07-01 14:48:39 +02:00
hid_report_descriptor_helpers.h HID: bpf: handle injected report descriptor in HID-BPF 2026-04-08 21:46:00 +02:00
hid_report_helpers.h HID: bpf: fix typo in HID usage table 2025-11-20 16:45:59 +01:00
hid_usages.h HID: bpf: handle injected report descriptor in HID-BPF 2026-04-08 21:46:00 +02:00
HP__Elite-Presenter.bpf.c HID: bpf: convert in-tree fixes into struct_ops 2024-06-14 11:20:20 +02:00
Huion__Dial-2.bpf.c HID: bpf: drop use of Logical|Physical|UsageRange 2024-10-18 14:37:33 +02:00
Huion__Inspiroy-2-M.bpf.c HID: bpf: Add support for the Inspiroy 2M 2025-11-20 16:45:58 +01:00
Huion__Inspiroy-2-S.bpf.c HID: bpf: add heuristics to the Huion Inspiroy 2S eraser button 2025-11-20 16:45:59 +01:00
Huion__Kamvas-Pro-19.bpf.c HID: bpf: add the Huion Kamvas 27 Pro 2025-11-20 16:45:59 +01:00
Huion__Kamvas13Gen3.bpf.c HID: bpf: add support for Huion Kamvas 13 (Gen 3) (model GS1333) 2025-11-20 16:45:58 +01:00
Huion__Kamvas16Gen3.bpf.c HID: bpf: support for Huion Kamvas 16 Gen 3 2025-11-20 16:45:58 +01:00
Huion__KeydialK20-Bluetooth.bpf.c HID: bpf: Add support for the Huion KeyDial K20 over bluetooth 2026-04-08 21:46:00 +02:00
Huion__KeydialK20.bpf.c HID: bpf: fix some signed vs unsigned compiler warnings 2026-04-08 21:46:00 +02:00
IOGEAR__Kaliber-MMOmentum.bpf.c HID: bpf: fix some signed vs unsigned compiler warnings 2026-04-08 21:46:00 +02:00
Logitech__SpaceNavigator.bpf.c HID: bpf: Add fixup for Logitech SpaceNavigator variants 2025-11-20 16:45:58 +01:00
Makefile HID: bpf: fix bpf compilation with -fms-extensions 2026-01-07 15:03:48 +01:00
Microsoft__Xbox-Elite-2.bpf.c hid: bpf: Fix grammar 2024-06-27 09:21:40 +02:00
Mistel__MD770.bpf.c HID: bpf: Fix NKRO on Mistel MD770 2024-10-18 14:37:33 +02:00
Rapoo__M50-Plus-Silent.bpf.c HID: bpf: Fix Rapoo M50 Plus Silent side buttons 2024-10-18 14:37:33 +02:00
README
Thrustmaster__TCA-Yoke-Boeing.bpf.c HID: bpf: Thrustmaster TCA Yoke Boeing joystick fix 2024-07-01 14:48:44 +02:00
Trust__Philips-SPK6327.bpf.c bpf: Add fix for Trust Philips SPK6327 (145f:024b) modifier keys 2026-04-08 21:47:02 +02:00
TUXEDO__Sirius-16-Gen1-and-Gen2.bpf.c HID: bpf: Suppress bogus F13 trigger on Sirius keyboard full fan shortcut 2025-02-24 09:25:33 +01:00
Wacom__ArtPen.bpf.c HID: bpf: fix some signed vs unsigned compiler warnings 2026-04-08 21:46:00 +02:00
WALTOP__Batteryless-Tablet.bpf.c HID: bpf: Add support for the Waltop Batteryless Tablet 2025-11-20 16:45:58 +01:00
XPPen__ACK05.bpf.c HID: bpf: fix BTN_STYLUS for the XP Pen ACK05 remote 2025-04-24 11:36:53 +02:00
XPPen__Artist24.bpf.c HID: bpf: move the BIT() macro to hid_bpf_helpers.h 2024-07-01 14:48:33 +02:00
XPPen__ArtistPro16Gen2.bpf.c HID: bpf: add support for the XP-Pen Artist Pro 19 (gen2) 2025-02-24 09:25:34 +01:00
XPPen__Deco01V3.bpf.c HID: bpf: Add support for the XP-Pen Deco 01 V3 2025-11-20 16:45:58 +01:00
XPPen__Deco02.bpf.c HID: bpf: Add support for XP-Pen Deco02 2025-11-20 16:45:59 +01:00
XPPen__DecoMini4.bpf.c HID: bpf: fix some signed vs unsigned compiler warnings 2026-04-08 21:46:00 +02:00

# HID-BPF programs

This directory contains various fixes for devices. They add new features or
fix some behaviors without being entirely mandatory. It is better to load them
when you have such a device, but they should not be a requirement for a device
to be working during the boot stage.

The .bpf.c files provided here are not automatically compiled in the kernel.
They should be loaded in the kernel by `udev-hid-bpf`:

https://gitlab.freedesktop.org/libevdev/udev-hid-bpf

The main reasons for these fixes to be here is to have a central place to
"upstream" them, but also this way we can test them thanks to the HID
selftests.

Once a .bpf.c file is accepted here, it is duplicated in `udev-hid-bpf`
in the `src/bpf/stable` directory, and distributions are encouraged to
only ship those bpf objects. So adding a file here should eventually
land in distributions when they update `udev-hid-bpf`

## Compilation

Just run `make`

## Installation

### Automated way

Just run `sudo udev-hid-bpf install ./my-awesome-fix.bpf.o`

### Manual way

- copy the `.bpf.o` you want in `/etc/udev-hid-bpf/`
- create a new udev rule to automatically load it

The following should do the trick (assuming udev-hid-bpf is available in
/usr/bin):

```
$> cp xppen-ArtistPro16Gen2.bpf.o /etc/udev-hid-bpf/
$> udev-hid-bpf inspect xppen-ArtistPro16Gen2.bpf.o
[
  {
    "name": "xppen-ArtistPro16Gen2.bpf.o",
    "devices": [
      {
        "bus": "0x0003",
        "group": "0x0001",
        "vid": "0x28BD",
        "pid": "0x095A"
      },
      {
        "bus": "0x0003",
        "group": "0x0001",
        "vid": "0x28BD",
        "pid": "0x095B"
      }
    ],
...
$> cat <EOF > /etc/udev/rules.d/99-load-hid-bpf-xppen-ArtistPro16Gen2.rules
ACTION!="add|remove", GOTO="hid_bpf_end"
SUBSYSTEM!="hid", GOTO="hid_bpf_end"

# xppen-ArtistPro16Gen2.bpf.o
ACTION=="add",ENV{MODALIAS}=="hid:b0003g0001v000028BDp0000095A", RUN{program}+="/usr/local/bin/udev-hid-bpf add $sys$devpath /etc/udev-hid-bpf/xppen-ArtistPro16Gen2.bpf.o"
ACTION=="remove",ENV{MODALIAS}=="hid:b0003g0001v000028BDp0000095A", RUN{program}+="/usr/local/bin/udev-hid-bpf remove $sys$devpath "
# xppen-ArtistPro16Gen2.bpf.o
ACTION=="add",ENV{MODALIAS}=="hid:b0003g0001v000028BDp0000095B", RUN{program}+="/usr/local/bin/udev-hid-bpf add $sys$devpath /etc/udev-hid-bpf/xppen-ArtistPro16Gen2.bpf.o"
ACTION=="remove",ENV{MODALIAS}=="hid:b0003g0001v000028BDp0000095B", RUN{program}+="/usr/local/bin/udev-hid-bpf remove $sys$devpath "

LABEL="hid_bpf_end"
EOF
$> udevadm control --reload
```

Then unplug and replug the device.

## Checks

### udev rule

You can check that the udev rule is correctly working by issuing

```
$> udevadm test /sys/bus/hid/devices/0003:28BD:095B*
...
run: '/usr/local/bin/udev-hid-bpf add /sys/devices/virtual/misc/uhid/0003:28BD:095B.0E57 /etc/udev-hid-bpf/xppen-ArtistPro16Gen2.bpf.o'
```

### program loaded

You can check that the program has been properly loaded with `bpftool`

```
$> bpftool prog
...
247: tracing  name xppen_16_fix_eraser tag 18d389353ed2ef07  gpl
	loaded_at 2024-03-28T16:02:28+0100  uid 0
	xlated 120B  jited 77B  memlock 4096B
	btf_id 487
```