Help writing a virtual touchpad

Peter Hutterer peter.hutterer at
Tue May 11 01:09:22 UTC 2021

On Sat, May 08, 2021 at 12:45:24PM +0200, Andrea Somaini wrote:
> Hello,
> I was thinking about creating a virtual touchpad device for Linux
> I never worked on such low level software, so I feel kinda lost
> Can someone please point me where should I start?

The best option you have at this point is to emulate an evdev node that
behaves like a touchpad. That's both straightforward and complicated at the
same time. The code itself is trivial (use python-libevdev, check the
examples directory) but getting touchpads right in evdev can be a bit
tricky - you really need to know the details of the evdev protocol.

If you look at the libinput test devices (e.g.
test/litest-device-synaptics-rmi4.c) you get a **rough** idea of the events
you need to send for a finger down event and a finger move event. 
You still need to handle BTN_TOOL_DOUBLETAP, etc.
What I recommend is: use libinput record to record 1, 2, 3... finger
interactions on your normal touchpad to get the set of data sent, then
emulate that device. Axis ranges and coordinates can generally be changed
at-will, but the set of events within each frame has to be correct (or
correct enough) to be processed as expected. has some
explanations too.


More information about the wayland-devel mailing list