Leveraging BPF Programs for Input Device Issue Resolution

Peter Hutterer, X.Org input subsystem maintainer at Red Hat, presented new utility udev-hid-bpf, intended to automatically load BPF programs that fix problems in HID (Human Input Device) input devices or change their behavior depending on user preferences. To create handlers for HID devices such as keyboards and mice, the subsystem is used HID-BPFwhich appeared in the Linux kernel 6.3 and allows you to create input device drivers in the form of BPF programs or handle various events in the HID subsystem.

The udev-hid-bpf utility can be used in conjunction with the udev mechanism to automatically activate BPF programs when new input devices are connected, or to load BPF programs manually. There are two main categories of BPF programs for use with udev-hid-bpf: programs for troubleshooting problems in hardware or firmware, and programs for changing the behavior of devices at the request of the user.

Advertisement

In the first case, the problems of eliminating defects and errors in devices are solved, such as inverted coordinate axes, incorrect value ranges (for example, a statement that there are 8 buttons instead of 5) and illogical sequences of events. In the second case, we are talking about changing device settings, for example, using BPF programs you can swap buttons. It is expected that BPF programs with fixes will eventually be included in the main kernel and will make it possible to do without adding patches or separate drivers to the kernel.

Thanks for reading:

Advertisement