rvaiya / keyd

A key remapping daemon for linux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keyd mangles touchpad events from integrated Trackpad

jottr opened this issue · comments

On my Macbook Pro 11,3, with keyd enabled, tap events are interpreted as keyboard events instead of click events, specifically kpminus up/down and numlock up/down:

# keyd monitor -t
device added: 0fac:1ade keyd virtual pointer (/dev/input/event2)
device added: 0fac:0ade keyd virtual keyboard (/dev/input/event1)
device added: 05ac:0262 bcm5974 (/dev/input/event8)
device added: 05ac:0262 Apple Inc. Apple Internal Keyboard / Trackpad (/dev/input/event0)
+759199167 ms	keyd virtual keyboard	0fac:0ade	enter up
+0 ms	keyd virtual keyboard	0fac:0ade	kpminus down
+0 ms	keyd virtual keyboard	0fac:0ade	numlock down
+8 ms	keyd virtual keyboard	0fac:0ade	kpminus up
+0 ms	keyd virtual keyboard	0fac:0ade	numlock up

This renders the touchpad unusable. It does not matter if tap-to-click is enabled or disable in Gnome Shell.

I'm unsure if this is a configuration error or caused by keyd's implementation.

$ cat /etc/keyd/internal.conf
[ids]
05ac:0262

[capslock]
h=left
j=down
k=up
l=right

[main]
capslock=overload(capslock, esc)
esc=capslock
$ uname -rsm 
Linux 6.1.82 x86_64

$ keyd --version
keyd v2.4.3 ()

# lshw -numeric -sanitize -class input: lshw.txt

Maybe this issue is related?

Additional info:
Finger-taps with multiple fingers are interpreted/emitted as: kp1 down/up, kp6 down/up, kp8 up/down, kpplus up/down.

My issue seems to be related to #676 or even a duplicate.
The maintainer in a comment:

However, laptops will often group other keys into the touchpad device which can cause keyd to misidentify them as keyboards.

In my case, the keyboard and the touchpad have the same ID. So it seems that it is impossible to simply ignore the tap events by ignoring the relevant ID of the touchpad via -<id>.

journalctl -u keyd.service 

Apr 12 00:02:03 titan keyd[1043]: Starting keyd v2.4.3 ()
Apr 12 00:02:03 titan keyd[1043]: DEVICE: ignoring 0fac:1ade  (keyd virtual pointer)
Apr 12 00:02:03 titan keyd[1043]: DEVICE: match    05ac:0262  /etc/keyd/internal.conf        (bcm5974)
Apr 12 00:02:03 titan keyd[1043]: DEVICE: match    05ac:0262  /etc/keyd/internal.conf        (Apple Inc. Apple Internal Keyboard / Trackpad)

As a temporary workaround, try this:

[id]
 *

it works on my mbp9,2.

My issue seems to be related to #676 or even a duplicate.

Indeed. I've added a note about this to the man page.

In my case, the keyboard and the touchpad have the same ID.

Try the latest commit, it should now allow you to distinguish between device nodes with the same product and vendor id pairs. keyd monitor should produce unique ids for each pseudo device that gets created that can then be used in your config.

commented

@rvaiya please excuse the delayed response.
I just got around to testing your commit (on a different Mac model mind you).
keyd indeed distinguishes between internal keyboard and mouse on Apple devices.
The internal keyboard is identified as:
Apple SPI Keyboard 0000:0000 v down
while the internal touchpad is identified as
Apple Inc. Magic Trackpad 05ac:0265 v up

Can I assume that the id of 0000:0000 is to be expected here? Thanks!