Open ces42 opened 1 year ago
This is by design. keyd passively monitors all input events, including those of ungrabbed devices in order to accommodate things like clearing oneshot modifiers on click. Trackpads in particular will produce a lot of extraneous ABS events which are mostly ignored (at the moment). This should only be observable when moving the mouse and should still constitute a tiny fraction of CPU usage. Is this causing a real world issue? What caused you to notice this?
I wanted to make sure that keyd wouldn't add any unnecessary battery drain so I checked htop and saw that keyd was using more cpu than I was used from interception-tools / caps2esc. 0.3% of one core is probably not a "real world issue" although I always that these things could add up, especially on older hardware.
I noticed that
keyd
will have a small amount of cpu usage while I'm using my touchpad (~0.3% on my i7-1065G7). Indeed, runningKEYD_DEBUG=2 keyd
show several hundred lines of output like this per second:This is even though I have restricted
ids
in/etc/key/default.conf
to what should be only my keyboard.It seems like the issue is that https://github.com/rvaiya/keyd/blob/4a86057943ed594ca384d88047411979bac643d0/src/device.c#L323 doesn't prevent keyd from reading from the device because if I add
dev->fd = -1;
at the top of the definition ofdevice_ungrab()
https://github.com/rvaiya/keyd/blob/4a86057943ed594ca384d88047411979bac643d0/src/device.c#L318-L325 the issue goes away.I assume that a better way of fixing this would be to remove unwanted devices from
device_table
.