← Back to list

Numpad linux driver — implementation of multitouch

1. Multitouch

Lukáš Drahník · 2022-04-28 15:28 · 0 claps · 1.5 min read
#linux #asus-zenbook #usa #driver #numberpad
Open on Medium ↗
Wiki topics: 🔓 · Open Source 🧘 · Spirituality

Numpad linux driver — implementation of multitouch

1. Multitouch

One of the most challenging features for correct numpad’s behaviour is multitouch implementation. That means the situation when you hold some key and then another one is pressed. It can be done with the same finger and then is key immediately released and pressed current one or not. The second, third, fourth, and fifth finger can be added gradually. Previously fingers persist.

In a multitouch case, the first key should stop doing action and another should start doing an action. Different between crossing over keys with only one finger is keys are not immediately released because fingers persist on them. How is that done in the event system and how can be clear which finger has been removed?

In the great article Undestanding evdev Who-T describes how should be multitouch implemented, with using slots. Every block of events starts with an event with number of slot EV_ABS.ABS_MT_SLOT. That means which “finger” continuing events affect. When a block starts without this event, no slot number is specified that means a slot number is 0. So event list is used alternately with multiple fingers using slots. When is finger disconnected, is fired EVENT EV_ABS.ABS_MT_TRACKING_ID with -1 value. When is connected new finger, numeric value is > 0. New slot is canceled (finger is untouched) or is created new one.

First finger touch fires EV_KEY.BTN_TOOL_FINGER, when is added second is fired BTN_TOOL_DOUBLETAP etc. (BTN_TOOL_TRIPLETAP, BTN_TOOL_QUADTAP, BTN_TOOL_QUINTTAP). Event BTN_TOUCH is triggered with value 1 when is first finger used and 0 when is last one left. No much helpful for multitouching.

Y and X axis you want read from are EV_ABS.ABS_MT_POSITION_Y and ABS_MT_POSITION_X, slot specific. For back-compatibility (only one finger) are still for axis used events ABS_X/Y, you can ignore them.

2. Implementation of numpad multitouch compared to physical keyboard multitouch

When I compared behavior with keyboard implementation i discovered keyboard send event EV_KEY.<key> with value 2 when is key send repeatedly (u hold that key). Numpad driver could do it too, could be calculated from time span how long is key pressed. But I do not know why.

Otherwise is the behavior the same. Event key with value 1 is sent when is key pressed and with value 0 when is unpressed.

[Understanding evdev] (http://who-t.blogspot.com/2016/09/understanding-evdev.html)

[Numpad linux driver] (https://github.com/asus-linux-drivers/asus-touchpad-numpad-driver)


메타데이터
post_id
bd8ae76a8d6c
slug
numpad-linux-driver-implementation-of-multitouch-bd8ae76a8d6c
url
https://medium.com/@ldrahnik/numpad-linux-driver-implementation-of-multitouch-bd8ae76a8d6c
canonical_url
https://medium.com/@ldrahnik/numpad-linux-driver-implementation-of-multitouch-bd8ae76a8d6c
author_url
https://medium.com/@ldrahnik
status
ok
fetched_at
2026-07-27 04:54:57