Peter Hutterer, the maintainer of the X.Org input subsystem at Red Hat, introduced a new utility, udev-hid-bpf, designed to automatically load BPF programs that fix issues with HID (Human Input Device) interface input devices or modify their behavior based on user preferences. The HID-BPF subsystem, which appeared in Linux kernel 6.3, is used to create handlers for HID devices such as keyboards and mice, allowing the development of input device drivers in the form of BPF programs or handling various events in the HID subsystem.
The udev-hid-bpf utility can be used with the udev mechanism to automatically activate BPF programs when new input devices are connected or to manually load BPF programs. There are two main categories of BPF programs designed for use with udev-hid-bpf: programs for troubleshooting hardware or firmware issues, and programs for modifying device behavior based on user preferences.
In the first case, it addresses the resolution of shortcomings and bugs in devices, such as inverted coordinate axes, incorrect value ranges (e.g., reporting 8 buttons instead of 5), and illogical event sequences. In the second case, it's about changing device settings; for example, BPF programs can swap button functions. It is anticipated that BPF programs with fixes will eventually be included in the main kernel and eliminate the need for adding patches or separate drivers to the kernel.
Source: opennet.ru
