Q3 Linux touchpad update: Multitouch gesture test packages now ready
bill.harding.blog
bill.harding.blog
Like you stated, the big problem is very fine movements just don't work in libinput. On X11/synaptics I can make movements as fine as rolling my fingertip in place on the touchpad, or drawing a minuscule circle, and it will pick it up. Libinput on the same touchpad does nothing, it's like it's stuck in molasses. And libinput has almost no configuration options so there's nothing I can even tweak.
I really hope they address this soon, or I'll be stuck on X11 forever!
Edit: I'm using a Thinkpad P1 Gen2, a top-tier recent-gen workstation laptop, and this is a big enough problem where it's forcing me to use X11 on Ubuntu 20.04.
I just timed myself doing it on a fresh vagrant VM, and it took me less than two minutes. One full minute was downloading and installing build dependencies, and that would normally be a few seconds as most people already have gcc.
The steps I took were:
sudo apt build-dep libinput
sudo apt install fakeroot
apt source libinput
cd libinput-1.12.6/
grep -r tp_detect
vim src/evdev-mt-touchpad.c
dpkg-buildpackage -b
sudo dpkg -i -O ../libinput*.deb
Oh and I'm tempted to argue that this is, in fact, a user experience we deserve. ThinkPads are used by many developers worldwide. Most of my friends at Red Hat have it. Last time I could check (2011), Google gave developers ThinkPads with Linux as one of the options. Any single one of us could have fixed this bug in one day, and then spend maybe another full day communicating with Peter to get the fix in shape and merged. Yet it still isn't fixed.Free software often is free as in beer, but the real point is that we can, and we should, participate. Throwing money through GitHub Sponsors is one option, but often the best way is to just roll your sleeves up and do the work.
Without the reference you've provided here I would estimate about three hours for me to do all of that, and that might be pretty optimistic. From figuring out what to search for, to understanding the code that needs to change, to making the change, to building it, to determining what's ~~best practice~~ at least not worst practice for installing it.
And I'm someone who's fairly confident in my abilities, has been using linux for about 15 years, and is comfortable in C and familiar with other packaging systems.
I'm sure I could come up with at least a dozen exercises like this that would take me under a minute but would take the average HN reader hours if not days to complete.
My point is that it's incredibly unfair to take something with which you're obviously quite familiar with and claim it takes less time than buying an app online, just because with experience you can do it that fast.
You're kind of right and kind of not. It is indeed incredibly unfair to claim that anyone can do it in 2 minutes if I could, especially considering that I did it this fast after mentally preparing to do it fast to demonstrate that it can be done fast.
But also remember that I really do believe that we should all participate in the development of the software that we get to use for free. Fixing a bug in some piece of software should, in my opinion, be the most normal thing you do every once in a while. Just like everyone can use a screwdriver at home, every programmer should be able to modify, build and run the software they use. If we did live in such a world, this wouldn't be specialized knowledge, this would really be something most people could do under 10 minutes.
Yeah, I realize that we don't live in a such a world. But please don't take away my hope that if we all try hard enough, one day we just might. :-)
I thought that there were like a billion ways to do this -- pbuilder, debootstrap, fakeroot, sbuild, ./debian/rules, probably a few others I'm forgetting. Every time I've interacted with this over the last decade it's given me a headache.
In 2020, is `dpkg-buildpackage` the official way to do this? It seems very easy!
The other options are good if you need to ensure the package will build elsewhere, or if you need to cross build for a different architecture (which you might need if you're running a multiarch system and you need to patch a library like Mesa that's still needed by some 32 bit apps), or if you don't want to clog your system with build deps or something like that.
Last time I needed to do that, I used cowbuilder, but I'm not really an expert in this area, I'm just a Debian power user, not involved with the project directly.
Just to provide one anecdotal example, I have a Asus Zenbook Windows 10 laptop (OEM installed), where the touchpad just randomly breaks after some Windows updates every few years.
Right now my laptop isn't recognizing any multi touch gestures, which makes scrolling a pain in the ass.
I can't exactly remember what I did to fix it the last time, but it involved downloading some drivers from the touchpad manufacturers website (not the laptop vendor), which looked really dodgy. A non-technical user would have zero chance of getting it to work.
For a technical user such as myself, it would be much easier to recompile libinput with some patch I grabbed from their issue tracker.
As a bonus, there's less chance of getting malware from the latter than going to some Asian hardware manufacturer's poorly translated website in search of a compatible driver download.
(I'm referring to "Press the lower right corner of the touchpad to right-click" box. The Dells that the school I teach at has are near unusable with this clicked, but improve significantly with it off and using two-fingers to right click instead).
I've not had any problem before with clicks being misinterpreted this way, though.
All software is broken in some way, so everyone says yes to shipping something that's broken. All things considered, it's not an important feature, especially considering it has a work-around. They have have the ticket for the issue and it's on a backlog. As with all software projects, they have to triage bugs, prioritize their work and allocate resources. The awesome thing about open source is that anyone can create a patch for the fix, and resolve it for everyone.
Compare this to some Apple Radar bugs that are old enough to vote, but only Apple employees can fix.
Key word here is community - it's not just up to the maintainers and regular contributors (who may already be overtaxed with both their day jobs and managing the software project for no pay). Users who have a particularly urgent itch to scratch have to step up - if they're not technical, perhaps put a bounty on the fix so someone else is financially motivated to fix it. Abusing (IMO) maintainers by screaming at them to hurry-up-and-fix-it is not helpful, especially since they are volunteering their free time.
See this discussion: libinput's bus factor is 1, https://news.ycombinator.com/item?id=23254871
My best guess is that it just isn't annoying enough to most people. Another way to understand this is to imagine what happens when you put someone with bad visual acuity in charge of font rendering: they'll think it's good enough, and you can't blame them. It _is_ good enough, as far as they can see (pun intended).
In any case, a non-kernel developer fixing it in a day of coding is IMHO wildly unrealistic. While I have 20 years of programming experience, I have zero experience with kernel development--which some of the most complex software in existence--let alone input stack development. I don't even have the domain vocabulary to describe the problem. A lumberjack might know how to cut wood, but that doesn't automatically make him a carpenter.
You get the entire GNU/Linux desktop for free, so you aren't in a position to complain. If you value your precious spare time, part with some of your money. Pay someone to fix this for you. Ask your employer to pay someone so that your "tool" works. Whatever.
> In any case, a non-kernel developer fixing it in a day of coding is IMHO wildly unrealistic.
Please... at least read the linked issue to see what the problem really is. This isn't kernel development. This is a userspace library, and the problem in question is isolated to a single C function that spans one or two screens. This really isn't rocket science. I wouldn't hesitate to ask students to fix an issue like this in a followup programming course.
I would buy that argument if we were talking about some new technology that still has some warts. But we're talking about trackpads here. Technology deployed on the scale of billions of units over many decades. At some point users must demand a basic standard of quality for technology that is not only old, but ubiquitous. If libinput shipped a version that randomly duplicated keystrokes on a keyboard, I'd be the one on the hook to fix it and I'm not allowed to complain because it's free? Really?
> This isn't kernel development.
This perfectly illustrates my point. My day job is not in this sector and I don't even know the right place to start looking. And I'm supposed to fix this in just a day, like any old amateur student supposedly could, otherwise it's my fault? Give me a break.
Edit: In this very thread we have one user who submitted a kernel patch that possibly might solve this (but who knows), and another user who points to a year-old libinput bug that possibly might be what I'm talking about (but who knows). Not even the experts agree on where the problem even lies, but I'm supposed to fix it in a day. OK, right.
Likewise, there's no established, dependable, working-at-all way to sell something like this. You can sell things like BetterTouchTool on macOS (a small utility that makes the Touchbar more configurable), because closed-source is fine on mac and people are ready to open their wallets in exchange for a better UX. That's simply not possible on Linux, everything meaningful must be open source and free as in beer (and, for drivers, probably free in all other ways, too), or it either can't work structurally or won't because the philosophy behind Linux and its ecosystem is incompatible with that sort of thing. Hence, it won't happen unless someone really enjoys doing this, or does it for their own needs and gives it away and maybe even supports it long-term despite of the negative experience that can be (entitled people etc.)
As for companies with employees using Linux, I guess quite a few shops would probably be kinda happy if the UX got so crappy it became unusable, because office IT for an an all-Windows shop is easier and cheaper to run – network printing just works for everyone, ActiveDirectory works for everyone out of the box, IT can ensure everyone is on the latest Windows update, security solutions run everywhere, everyone can use all productivity tools you could ever buy and you can roll them out easily using policies, no weird graphics issues that prevent people from presenting, no expensive "exactly this laptop with exactly that configuration" hardware purchases, one-size-fits-all tech support, etc. pp. This is also one of the reasons why WSL2 is such a clever move – make Windows the best (corporate) Linux around and get another large swath of developers to use Windows. It's also probably going to solve a lot of the Linux UX issues, but not in a way that benefits Linux in the least.
I'm also on a P1gen2. I just added support for the Trackpoint/Thinkpad through the more advanced RMI4 interface in the kernel, instead of going through PS/2 emulation mode:
https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.g... https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.g...
This will be in Linux 5.10 and should improve things quite a bit.
Also you said Trackpoint/Thinkpad. Did you mean Trackpoint/Trackpad?
Just tried that on my Dell XPS on sway (wayland, thus libinput), and rolling the tip of my finger on the touchpad allows me to move the cursor in single-pixel increments on an unscaled 4k display. :/
Maybe this is a libinput issue specific to your touchpad type?
Sure windows has better gesture support but I've always felt them sluggish and controlling sway through the keyboard is lightning fast so I really have not missed gestures much. However for browser etc 2-finger swipe to go back would be nice to see
You may want to experiment with your desktop environment's mouse settings, and if that doesn't help, you should consider providing a detailed report to the libinput folks and see if they can address it.
I suspect this is more a hardware issue than software.
I would've assumed this was a hardware issue - what else do we have set up differently?
Tried it on the integrated 13" FHD screen as well as on an external 24" FHD screen. I can move the cursors easily along the branches of the Y in page header.
I believe there is also a tweaks dB to set better values for known hardware.
Holy shit, you're right! I never noticed! There goes my plan to play old FPS games (like Wolfenstein: Enemy Territory) on Linux without any major hassle…
† N=1, but it worked fine before libinput (using 'xset m 1 0').
Summary for those interested:
- flat profile didn't actually work on touchpads.
- a fix was merged into master on 2020-05-27. [0]
- judging by the merge date and tag dates, the fix is included in libinput 1.15.6 (released 2020-06-18) [1]
- Ubuntu 20.04 reports libinput 1.15.5. I hope they upgrade it so I can use Ubuntu on my laptop.
- My Arch install reports libinput 1.16.2
[0] https://gitlab.freedesktop.org/libinput/libinput/-/commit/03...
[1] https://gitlab.freedesktop.org/libinput/libinput/-/tags/1.15...
Glad to see movement about this. Was just considering converting my XPS 9560 into a full Linux machine next week (I will miss fingerprint sensor support, which brings up another point about just upgrading to a model that supports it). Going to use it as a testing ground for switching over my main rig to Linux and seeing progress like this is really encouraging that I’m making the right decision.
I will gladly install these test packages and help out.
As a resident of a non-USD country, my bank shafts me for foreign currency payments, which is partly a fixed fee and partly driven by the total amount. Therefore lots of small payments ends up paying a much larger portion to the bank, money that I'd otherwise prefer the project got!
I'm Povilas, the developer from the linked blog post.
If the donation is less than $100 you could setup a monthly donation on GitHub and then cancel it after the first payment.
Otherwise, you can contact me at "povilas@radix.lt". To verify the authenticity of this email address you can view my GitHub profile at https://github.com/p12tic, or check out https://github.com/p12tic/xorg-xorgproto/tree/p12-gestures branch and verify the author email of the last commit in the branch.
I'm serious. It sounds crazy because it is crazy.
Full details: https://news.ycombinator.com/item?id=24006703
You can simply start a monthly plan, then cancel it once the first payment is gone. It's a bit more overhead, but if you believe in it, it's worth it. (edit: never mind, this is not possible apparently, GitHub charges you for a whole year)
Also, slightly off-topic, and this entirely depends on where you live. Regarding your bank, you may be able to look into start up banks (also called Neo banks), they often have zero foreign currency fees and exchange at the Master Card or Visa base exchange rate. This has in the past saved me a huge amount, mostly for travel to foreign countries, but also for purchases, however, receiving money is the same.
As examples, in the UK we have Starling, Monzo and some others that all give you zero foreign exchange transaction fees. In many European countries Revolut is available (also in the UK), but I closed my account with them for ethical reasons. There is undoubtedly more neo banks available especially in the development world but you will need to do research for your country.
I always got decent multitouch on linux (when the touchpad is even recognized, but that's another problem).
Raise funds, basically.
Getting too specific about their development plans would interfere with that. People spend money based on emotion and shiny things. Yes, even Linux users.
As evidenced by the fact that they've basically just resorted to doing tons of retrofit to bring benefits that already exist in Wayland to a legacy, deprecated, aging stack. (literally every single change listed). Also, it's no longer just about improving the touchpad (since libinput is already pushing the envelope there), and instead ... X11 Gestures? Okay? (Good luck to those brave enough to install a patched X11 from a PPA!)
I feel sorry for the people who thought there was enough substance to donate. How this project progresses with increasingly less clarity and continues to be celebrated here deeply confuses me.
The reasons why we chose the current path were explained in detail in the blog posts.
Touchpad gestures was the most popular feature to implement. In order to do that we needed a good reason why all the other project maintainers would want to spend time discussing a feature with us. Wayland is the future, yes, but currently a lot of users are still on X which makes our argument much less convincing. Now we can say that touchpad gestures will soon be available everywhere and get their attention this way.
I agree that X is legacy platform. Unfortunately it may still be used for quite some time. Core functionality such as screenshots and input record/replay is not universally available on Wayland. So X will still be used for significant amount of time.
Please tell me what else I could explain to increase the transparency of the project and I'll try my best to do so. Thanks!
This is exactly my case. For me it's the difference between earning money or not working: I do some screen sharing with my customers every day. Wayland is not an option for me yet.
At this moment I'm not really sure if I would go the same path had I knew all the information I know now. Having said that, we've only spent around a single man-month of effort working on this. In the grand scheme of things this detour is tiny.
A total waste because the latest Pixelbook Go is both really cheap and high quality.
Apple got it right a long time ago, ChromeOS is good, and Windows is too. What's different about Linux?
That's the difference.
What prevents Linux from picking ONE touchpad to optimize for? After all, both Lenovo and Dell are now shipping certain laptop models with official Linux support.
Casting a wide net is necessary if you don't want just a niche audience.
A "jack of all trades, master of none" approach would only condemn everyone to mediocrity.
Hardware manufacturers care a lot about the Linux market. But that Linux is Android, not desktop machines. Yes, the linux desktop segment is a tiny fragment of the market, but that market itself is shrinking and has been for almost a decade.
I'd argue that mediocre on most hardware and excellent on a few particular models is better than mediocre everywhere.
For example: https://www.phoronix.com/scan.php?page=news_item&px=Linux-5....
The point was, that the other OSes picked specific hardware and they provide great experience only on that hand-picked hardware and nothing else. I specifically noted, that Apple touchpads do not work under Bootcamp as nicely as the Precision ones do, as an example.
Linux hasn't got it right because there is still no unified api, even if there was, all apps must implement it to be useful.
This is where OP push comes in. To make all of this possible through donations. You should read his older blog posts. They're worth a read.
frankly even in 2020 I have yet to find one non-mac-hardware which is 50% as good as the apple touchpad experience
This seems like great progress. I'll be donating a bit!
I assume you'd get more donations if you had regular updates like this.
I would love for them to progress enough so this extension is no longer necessary. Making great progress!
There's plenty of work just implementing the basic handling of touchpad gestures, not even talking about any kind of polish. So at this moment we just assume that libinput handles touchpad gestures well and don't test at all. Once the basic parts are done we'll start polishing and this is when we'll test on as much hardware as possible.
[1]: https://bill.harding.blog/2020/06/22/linux-touchpad-project-...
I wonder about this though. To me it seems this is very important to get to work for alternative Linux-based smartphone OSes such as SFOS, pmOS, UT, PureOS, etc etc.
############################################################################### # You can set a timeout on gestures from start to end. The default is # the value commented below. It can be any value in float secs >= 0. # 0 = no timeout. E.g. set it to 2 secs with "timeout 2". timeout 0
IMHO the most egregious offender is libinput because everyone and their pet fish seem to be in a massive hurry to drop the proprietary synaptics driver and replace it with libinput; you're not allowed to ask for synaptics support because all distro and project maintainers will lecture you about "upgrading" to libinput which has "superior" touch and multitouch support... except libinput absolutely does not, even if it is theoretically architectured in a way that would enable superior touch/multitouch support someday.
The biggest problem is that the acceleration curves libinput uses are vastly inferior to those that ship out-of-the-box with other operating systems or the proprietary solutions from the manufacturers. When you read about the TrackPoint and the research that went into developing acceleration curves/profiles for input devices [0], it is hubris to think you can throw it all away and expect to still have a superior product.
Anyway, long story short, if you're using a synaptics or synaptics-compatible trackpad, the old synaptics drivers have the best (by far) acceleration profiles and feel the most natural to use, but they are not supported by multitouch plugins for the desktop environments. That's not to say the drivers don't have multitouch support: they do, and they accurately report all motions, but only as raw events.
I wrote this simple program to read the raw input from the synaptics driver and recognize two-, three-, four-, and five-finger tap and swipe gestures from the raw event stream generated by the synaptics driver per the kernel multi-touch protocol [1]. I initially wrote it in an evening after studying the protocol to get just simple back/forward swipe navigations working with the only actually good touchpad drivers for Linux I could find (the synaptics one), and intended to clean it up before throwing it on GitHub for anyone else that might find it interesting but realized I wasn't sufficiently motivated to clean it up anytime soon so decided to just upload it as-is.
sygesture [2] is written in rust and processes the raw MT protocol events generated by the trackpad in real-time to recognize multitouch gestures. Currently it spawns an `evtest` instance rather than opening the input device directly, that was a hack to not have to deal with translating the binary protocol but adds a dependency on the `evtest` utility (should be in your package manager). The path to device is also hard-coded in `main.rs` (and currently it only supports a single input device), but all that is separated from the actual parsing logic because I planned on making that modular from the start, but never got around to it. The mapping of gesture to action is also hard-coded in `main.rs` and isn't currently configurable. (It's all very easy to change even if you don't know rust, as all it does is spawn a program with certain arguments in response to each motion.) I'll throw an MIT license in the repo as soon as I get a chance.
The utility is pretty bulletproof, even though the heuristic is fairly simple (the rationale behind the consensus algorithm is documented in the comments). It's extremely fast (don't have a reliable way to measure lag, but I'm extremely sensitive to it and don't detect any) and has low memory usage (CPU usage is basically zero except for the duration of a gesture, if you're polling at a high-enough frequency to pick up on that).
Something not accounted for at all in the code is support for non-swipe gestures such as pinch-to-zoom and (has anyone ever used it?) "circle gesture" that can be apparently be used for weird things.
[0]: https://www.microsoft.com/buxtoncollection/detail.aspx?id=60
[1]: https://www.kernel.org/doc/html/v4.18/input/multi-touch-prot...
In what way is it proprietary? xf86-input-synaptics is MIT and the kernel driver is GPL.
I updated my PopOS packages today. My touchpad accel changed, my two-finger scroll broke, and I am left with a bunch of debugging to do and an urge to switch to Guix full-time. I came back to this HN thread and was delighted to find your post.
> Also please consider posting this on relevant mailing lists.
I’m beginning to accept that I’m terrible when it comes to evangelizing. Suggestions?
Today I restarted my, decidedly small, contribution. Even if I'm frustrated with the amount of work there is to do, I'd rather the project be thorough and really attempt to be a unifying solution to this problem.
Indeed this is a valid point, thanks. On the X server applications will get touchpad gestures regardless of whether one is running Plasma or GNOME. However, workspace-wide gestures are not implemented in either on X yet.
On Wayland the display server is the one which handles workspace-wide gestures. Additionally, all events go through it to the applications. Perfect touchpad gesture support needs support in both. As far as I know Mutter (GNOME) handles both parts already and KWin (Plasma) currently handles neither.
Implementing touchpad gestures on Plasma would fall within this initiative, I will most likely work on that at some point in the future. Please vote in the poll so that we know this is important to you.
The poll: :)
This is why the web has won. Chrome on Linux is the same as Chrome on Windows.