<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto">Thanks a lot for your detailed response, that blog post was amazing and it made some things much more clearer.<br />
<br />
At the end, I managed to write a kernel driver that receives input through a character device and sends raw input events, without ever knowing the existence of evdev. It still need a lot of tweaking regarding resolution and which events I should send and which not. (e.g. should I communicate the pressure if my data does not contain information about it? What about tool_width/major-axis and such?)<br />
<br />
Anyway, with some trial and error the driver kinda works and I got to see 1:1 multitouch gesture on GNOME 40 :)<br />
<br />
Regarding performance: I use a userspace process to write to a character device which talks to my kernelspace code, maybe using evdev directly avoids some layers of abstraction? And in this way I don’t have to write any kernelspace code right?<br />
<br />
Repo with my code: https://github.com/thegoldgoat/toccami_driver<br />
<br />
Thank you so much,<br />
Andrea</div>
</div>
<div name="messageReplySection">Il 11 mag 2021, 03:09 +0200, Peter Hutterer <peter.hutterer@who-t.net>, ha scritto:<br />
<blockquote type="cite" style="border-left-color: grey; border-left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left: 10px;">On Sat, May 08, 2021 at 12:45:24PM +0200, Andrea Somaini wrote:<br />
<blockquote type="cite">Hello,<br />
I was thinking about creating a virtual touchpad device for Linux<br />
I never worked on such low level software, so I feel kinda lost<br />
Can someone please point me where should I start?<br /></blockquote>
<br />
The best option you have at this point is to emulate an evdev node that<br />
behaves like a touchpad. That's both straightforward and complicated at the<br />
same time. The code itself is trivial (use python-libevdev, check the<br />
examples directory) but getting touchpads right in evdev can be a bit<br />
tricky - you really need to know the details of the evdev protocol.<br />
<br />
If you look at the libinput test devices (e.g.<br />
test/litest-device-synaptics-rmi4.c) you get a **rough** idea of the events<br />
you need to send for a finger down event and a finger move event.<br />
You still need to handle BTN_TOOL_DOUBLETAP, etc.<br />
What I recommend is: use libinput record to record 1, 2, 3... finger<br />
interactions on your normal touchpad to get the set of data sent, then<br />
emulate that device. Axis ranges and coordinates can generally be changed<br />
at-will, but the set of events within each frame has to be correct (or<br />
correct enough) to be processed as expected.<br />
<br />
https://who-t.blogspot.com/2016/09/understanding-evdev.html has some<br />
explanations too.<br />
<br />
Cheers,<br />
Peter<br />
<br /></blockquote>
</div>
</body>
</html>