Skip to content

Do not rely on polling, but on a udev rules

Benjamin Tissoires requested to merge wip/kill-poll into main

The current udev-hid-bpf relies on active udev polling. This means that we need to keep that program around as a daemon, for the few devices that might use it.

Add a new udev rule, and load this program only when there is an add or remove event.

Install with:

cargo install --path . && \
    sudo cp ~/.cargo/bin/udev-hid-bpf /usr/local/bin/ && \
    sudo cp 99-hid-bpf.rules /etc/udev/rules.d && \
    sudo udevadm control --reload

Then start the hid-recording from libinput/libinput#884:

curl -LO https://gitlab.freedesktop.org/libinput/libinput/uploads/385bc0c4ba8b2aff852191780ffe8af7/hid-recorder_event4.log
sudo hid-replay hid-recorder_event4.log

Things missing:

  • also install the bpf .o files somewhere in the filesystem
  • add a new parameter to add with the directory of the bpf objects (or add a default one)
  • test if we don't bind twice to the device (which should not be the case because the hid device is added just once, but bound multiple time)
  • tests? what can we have for tests?

Cc: @whot

Edited by Benjamin Tissoires

Merge request reports