|
|
Subscribe / Log in / New account

An update on input

By Jake Edge
October 11, 2016

X.Org Developers Conference

Peter Hutterer gave an update on the input stack at the 2016 X.Org Developers Conference (XDC). A lot has been accomplished, but there is, naturally, more to do—especially as more and more quirky (or buggy) input hardware is released. But, overall Hutterer painted a picture of a mature subsystem that is largely feature-complete at this point.

Touchpads

Hutterer started with touchpads, saying that too many of them are still using the PS/2 protocol in the kernel. That protocol is limited to two touches and has limited bandwidth for reporting events. Over time the PS/2 firmware in those devices has gotten less and less testing as well.

The way forward is the RMI4 [129-page PDF] protocol for Synaptics touchpads for hardware that supports it. RMI4 is roughly six years old, so Linux is a bit behind the curve by not supporting it yet. The protocol allows for multiple fingers and has more accurate axis ranges and resolutions. The RMI4 core is in the mainline for I2C and SPI transport layers. RMI4 over HID devices is a work in progress that is just waiting for review, though some are already using RMI4 on HID over I2C. SMBus support is slated for 4.10.

Someone in the audience wondered how you would know if you need RMI4 support. Hutterer said that if you have a Synaptics touchpad, you will likely want RMI4 support. One side effect of these changes is that the touchpad device names will change. Anything that matches on the touchpad name in user space will end up with a "mute touchpad", he said.

Some new udev properties have been added for touchpads; one to identify trackball/touchpad combinations and another to identify touchpads that are integrated with the keyboard (as in a laptop), which are called "internal", versus those that are external. One use of the property is that only the internal touchpads will be disabled while the user is typing.

There have also been updates to the udev hardware database to make axis range corrections for some devices. The resolution in the database sometimes "does not match the real world". RMI4 will invalidate some of the database entries, as well, which he hopes is not a problem since RMI4 is much better protocol.

The goal for touchpad support in libinput is for it to be better than the xf86-input-synaptics driver. This is not universally true yet. One of the areas that needs work is pointer acceleration. Another is to make libinput responsive without using SIGIO, as had been done in the server in the past; more details about that would come later in the talk, he said.

The libinput developers tried to remove the touchpad hysteresis feature, which requires that a finger move a minimum distance before deciding that it actually is a movement, but that led to a whack-a-mole exercise trying to eliminate wobbly cursors for various devices. So hysteresis was eventually turned on again by default.

Another problem was that libinput would have cursor jumps that did not occur with the Synaptics driver. It turns out that changing between gestures (from two fingers to one for example) would cause the hardware to terminate the wrong finger "slot" so it would appear that the remaining finger jumped. The Synaptics driver is single-touch, so it did not experience the problem. Libinput was effectively penalized for trying to do something fancier.

Hutterer listed some quirky hardware that libinput has had to work around. Some Lenovo trackpoints send random events that trigger palm detection. Other Lenevo hardware randomly filters slower motions, which causes the cursor to stall. That was fixed by setting the acceleration slower on those devices so that users move their fingers faster and don't hit the firmware problem. It is one way to "train the users", an audience member said.

Tablets

Wacom still provides good support for its new tablets, he said. Other tablet support is "more random". It will not help that the DIGImend project, which targets better graphics tablet support for Linux, is shutting down because the maintainer doesn't have time to work on it.

The Wacom kernel driver (wacom.ko) has undergone a massive cleanup, Hutterer said. The biggest change that is visible to user space is that the LEDs are now controlled by the kernel through the LED subsystem. The driver used to require changes to support new devices, but it has switched to using HID descriptors. That allows integrated touch devices (screens and pads) to work out of the box. With luck, it will also allow future Wacom tablets to simply be plugged in and work, without needing an updated kernel for driver changes.

For libinput, tablet support is pretty much feature-complete these days. There is support for the tools, pads, and pad modes (including reporting the modes via the LEDs). Touch support has been changed so that the tablet is either treated as a giant touchpad or touchscreen. Tablet tools (e.g. stylus) are tracked with a serial number, which would allow them to be used on multiple tablets if the application supports it. The pads get their own event nodes, as do the various "rings", "strips", and buttons that are available on tablets.

For Wayland, the tablet protocol is now up to version 2. It is large, just because there is a lot of different kinds of data that is received from the tablets, but it is fairly straightforward, Hutterer said. The GTK+ tablet support is feature-complete at this point. There are still some GNOME configuration pieces that are partially missing, but otherwise there is nearly a full stack for tablets on GNOME.

Mice

He then turned to mice. The battery status handling for Logitech unifying receiver devices is being moved into the kernel. That will standardize the interface for GUIs. It is a work in progress at this point.

Libinput now provides the physical angle for mouse wheels as part of the event data. There is at least one mouse out there that has a different click angle for the horizontal wheel than it does for the vertical one—the horizontal wheel does not even have a way to do a click, but still sends those events at times. As with other devices, mice require some fixes for hardware quirks.

For Wayland, relative pointer information has been added to the protocol that provides both accelerated and unaccelerated motion data. It is something that was wanted for games, particularly "shooter games". There is also a protocol addition for pointer confinement—restricting the pointer to a particular surface (window). Both of those are not yet stable and need more testing. For XWarpPointer() support, which can't be done using the core Wayland protocol, there is a proposal to add it into XWayland.

The libratbag library, which was introduced at XDC 2015 as a library to configure gaming mice, has taken a back seat over the last year, he said. It supports quite a few different devices, with profile support so that configurations can be saved on the devices. As a follow-up to a question from last year, Hutterer told Keith Packard that the most expensive mouse the project has worked with cost $159 (up from roughly $100 last year, which Packard was incredulous about).

There is now a D-Bus daemon for libratbag (ratbagd), which will allow applications to configure these mice through the library. There is a GUI application called Piper, which is a standalone program, not part of GNOME Control Center or any other settings application. It is a rather specialized function that shouldn't be required frequently, he said. It doesn't store the configuration locally, it only changes the settings on the device itself.

One side effect of the libratbag work is a library to access Logitech unifying receivers called liblur. The idea is to hopefully replace the various home-cooked solutions out there, Hutterer said. There are "five, six, or even ten or more" of those available and there is really only a need for one library to handle operations like pairing a mouse or keyboard with a receiver.

Keyboards

The slide said "page intentionally left blank". Hutterer added: "We didn't do anything for keyboards because nothing needed to be done."

X server

Up through X server 1.18, all input events were handled using SIGIO. The user-space drivers would register a file descriptor with the server and install a SIGIO handler. Events would then trigger the signal, which would be processed in the signal handler. But there are lots of operations that cannot be done from a signal handler, memory allocation in particular.

This signal approach would not work for libinput as it needs to be able to allocate memory at times. For example, graphics tablet drivers cannot preallocate memory for all of the tools that might appear. Handling cursor movement, pointer acceleration, and other operations in the signal handler made event processing seem responsive. Not using that approach meant that libinput event handling would sometimes stall when the server was busy, which was especially noticeable when scrolling.

Thanks to Packard, there is a new input thread in the server. It simply waits for one of the input file descriptors to be ready, which makes libinput feel much more responsive. It did lead to some race conditions that needed to be tracked down, but most have been fixed at this point. The libinput test suite helped to find many of those, Hutterer said.

There is a plan to retire various specialized input drivers (e.g. Synaptics, Wacom) in favor of libinput. Traditionally, the evdev driver has been the catch-all driver and there have been some specialized drivers loaded for specific types of devices. Now, though, libinput is also a catch-all driver, but should be preferred over the specialized drivers. The X.Org configuration mechanism (xorg.conf.d) is not flexible enough to support this, however. It is based solely on the sort order of the files in the directory.

So, in server 1.19, there is now support for a new NoMatch directive that will only match a specialized driver if libinput has not already been attached to the device. In addition, the X server now has a built-in fallback driver to use if the driver module chosen is not available. In hindsight, he said, that should have been added in "2007 or so".

There has been some reshuffling of the entries in xorg.conf.d so they sort differently, as well. Instead of being near the bottom priority-wise (i.e. 98), libinput has been moved to 40, which puts it just below evdev and above all of the other specialized drivers. He noted that caused problems for desktop environments that do not support libinput (e.g. Cinnamon and MATE) and he strongly recommended that desktops move to support the library.

In summary, Hutterer said, input developers "are reaching peak boredom". There are mostly just little tweaks for hardware quirks and so on; there are no major features on the horizon. "That's a good thing", he said, since most "sane people" don't want their touchpads, mice, and other input devices to be exciting. For more details, interested readers can consult the slides or YouTube video from the talk.

[I would like to thank the X.Org Foundation for sponsoring my travel to Helsinki for XDC.]

Index entries for this article
ConferenceX.Org Developers Conference/2016


to post comments

An update on input

Posted Oct 11, 2016 21:59 UTC (Tue) by ballombe (subscriber, #9523) [Link] (1 responses)

Plug: if you want to use libinput in the linux console (for copy paste) see consolation

An update on input

Posted Oct 11, 2016 23:55 UTC (Tue) by jfebrer (guest, #82539) [Link]

+1
Great advice!

An update on input

Posted Oct 12, 2016 1:23 UTC (Wed) by flussence (guest, #85566) [Link] (9 responses)

libinput's pretty awesome. My laptop touchpad is noticeably less "jumpy" with it; the pointer no longer jumps around when I'm trying to middle-click things which used to be a huge annoyance in synaptics. Now I'm just waiting on bug 92015 to be fixed... :-)

An update on input

Posted Oct 12, 2016 11:42 UTC (Wed) by mathstuf (subscriber, #69389) [Link] (7 responses)

Agreed. The only issue I've had is difficulty reliably doing middle click on a touchpad, but that's not a new problem. Is that something worth a tweak, or is my technique just bad (I get about 5 or 6 of each left and right click before a moddle click finally gets generated).

An update on input

Posted Oct 12, 2016 12:53 UTC (Wed) by ballombe (subscriber, #9523) [Link]

There is a very simple fix (that really should have been the default with two-buttons touchpad under X):

tap -> button 1
left button -> button 2
right button -> button 3

An update on input

Posted Oct 12, 2016 17:10 UTC (Wed) by flussence (guest, #85566) [Link] (5 responses)

You're not holding it wrong; I'm pretty sure multi-finger timing depends on the firmware. My normal laptop's really easy to do 2/3-tap movements on (hence why I noticed they were missing in libinput — I was using them all the time), but on the touchpad on my old eee701 it's nearly impossible.

An update on input

Posted Oct 13, 2016 1:28 UTC (Thu) by whot (subscriber, #50317) [Link] (4 responses)

it's not (usually) a libinput bug. we obviously rely on the touchpad to tell us when 3 fingers are down but on my T440s, I struggle to get it to register three finger tapping correctly. The majority of the time it detects 2 fingers. I'm hoping that this problem goes away with RMI4, until then there isn't much we can do, unfortunately.

An update on input

Posted Oct 13, 2016 9:22 UTC (Thu) by mathstuf (subscriber, #69389) [Link] (2 responses)

I've been trying to click both right and left at the same time. Three fingers should work better?

An update on input

Posted Oct 13, 2016 10:06 UTC (Thu) by whot (subscriber, #50317) [Link] (1 responses)

are you using software buttons or clickfinger behaviour?

https://wayland.freedesktop.org/libinput/doc/latest/click...

when using software buttons, the middle button emulation needs to be explicitly enabled

An update on input

Posted Oct 13, 2016 17:07 UTC (Thu) by mathstuf (subscriber, #69389) [Link]

Ah, that page helped a lot. It's an XPS 13 which has a small line at the bottom of the pad for right and left "buttons". I did not realize that libinput was making a third button between them :) . Using this is *way* more consistent, thanks.

An update on input

Posted Oct 15, 2016 21:39 UTC (Sat) by flussence (guest, #85566) [Link]

Sorry, I should have been more explicit what I meant there. Not implying it was a bug in libinput, only an unimplemented feature:

Touchpad functions reasonably well --> became used to relying on 2 & 3 finger middle/right drag gestures (because Openbox uses them by default, and they're easy to get to) --> switched to libinput and found out it didn't support those.

I mentioned the bug number for it a few posts up. Not in any hurry to get it back though.

An update on input

Posted Oct 12, 2016 13:12 UTC (Wed) by lkundrak (subscriber, #43452) [Link]

+1 here. I've never had a laptop without a trackpoint before and only after my distro updated to libinput I figured out it how is it actually possible to use it. :)

An update on input

Posted Oct 12, 2016 3:43 UTC (Wed) by pabs (subscriber, #43278) [Link]

> input developers "are reaching peak boredom"

I wonder if they have looked at the various keyboards with open source firmware:

https://github.com/jackhumbert/qmk_firmware
https://asylum.madhouse-project.org/blog/tags/ergodox/
https://github.com/algernon/ergodox-layout

Or keyboards with eink displays on each key (only at crowdfunding stage):

https://www.sonderdesign.com
https://jaasta.com/

Or AR/VR input stuff.

Or various smartphone sensors.

An update on input

Posted Oct 12, 2016 9:42 UTC (Wed) by tao (subscriber, #17563) [Link]

TTBOMK some of the Logitech gaming keyboards still aren't fully supported, notably the G-series with various extra keys intended for programming with macros. But I suspect that's an issue on the kernel side rather than the libinput side.

An update on input

Posted Oct 12, 2016 15:26 UTC (Wed) by prometheanfire (subscriber, #65683) [Link] (10 responses)

I tried it out recently and had to switch back because it's currently missing inertial scrolling. Other then that it does look good.

An update on input

Posted Oct 13, 2016 1:20 UTC (Thu) by whot (subscriber, #50317) [Link] (9 responses)

see https://wayland.freedesktop.org/libinput/doc/latest/faq.h..., short answer: it's not something that should be in the driver but in the client (GTK already handles it)

An update on input

Posted Oct 13, 2016 3:26 UTC (Thu) by prometheanfire (subscriber, #65683) [Link] (8 responses)

Well, that sucks. It means that I'm going to have to set it in qt, gtk, whatever else separately :(

An update on input

Posted Oct 13, 2016 5:41 UTC (Thu) by bronson (subscriber, #4806) [Link] (7 responses)

And gtk and qt apps will always feel uncannily different.

An update on input

Posted Oct 13, 2016 13:30 UTC (Thu) by quotemstr (subscriber, #45331) [Link]

Or fork! The libinput people also want to disallow arbitrary soft-button remapping, so I'm going to have to run a patched version locally anyway.

An update on input

Posted Oct 13, 2016 14:18 UTC (Thu) by raven667 (subscriber, #5198) [Link] (5 responses)

That's just a consequence we have to accept due to there not being a single "official" toolkit that can define what "correct" behavior is for the platform. Mucking up drivers to try and work around this fundamental fact is probably not good software engineering, if the toolkits want to be different, let them be different.

An update on input

Posted Oct 13, 2016 19:17 UTC (Thu) by hmh (subscriber, #3838) [Link] (4 responses)

That leads to an extremely horrible user experience. It is quite normal to have applications built on several toolkits in use at the same time.

An update on input

Posted Oct 13, 2016 21:27 UTC (Thu) by raven667 (subscriber, #5198) [Link]

Those toolkits already provide different user experience, they aren't horrible, they are just different from one another, as they should be. If the toolkit makers want to get together and form a consensus and standard for behavior, they are free to do so, many of the best standards on the *nix desktop have come through toolkit cooperation, and some of the worst behavior has come from the toolkits and the underlying environment fighting one another to provide their own idea of forced "consistency", breaking each other, breaking on upgrade with crazy workarounds built on workarounds that make your head explode.

An update on input

Posted Oct 15, 2016 23:04 UTC (Sat) by flussence (guest, #85566) [Link] (2 responses)

Getting toolkits to cooperate to achieve consistency hasn't been a problem before. Everyone agreed GTK2 was the way to go: QT3, Qt 4, Qt 5, wxWidgets, Firefox and Chromium all support it to varying degrees.

For a lot of people that's been Good Enough. The problem now is that GTK2 is a fish out of water in the Wayland/libinput world, and there's no good replacement to hold the ecosystem together.

The *bare minimum* requirements for something to fill GTK2's shoes here are that it uses the C ABI (so that everyone can use it) and doesn't break downstream users every other week (so that everyone will *want* to use it). EFL is, AFAIK, the only thing that technically fits the bill there. I've heard it's no fun to write for though.

I hope some consensus happens on avoiding this problem while there's still room to maneuver. Right now it's looking like the future of Linux desktop apps is jQuery and Bootstrap, with all the subtle horror that entails.

An update on input

Posted Oct 16, 2016 2:38 UTC (Sun) by bronson (subscriber, #4806) [Link] (1 responses)

> Right now it's looking like the future of Linux desktop apps is jQuery and Bootstrap

This is horrifyingly true. Electron-based apps have really been picking up steam lately.

Gotta admit, I'm a fan of the Atom editor... but c'mon, 4 second boot and 500+ MB resident for a Slack or WhatsApp client?

An update on input

Posted Oct 16, 2016 4:06 UTC (Sun) by Cyberax (✭ supporter ✭, #52523) [Link]

Atom is the new Emacs. Perhaps it should start doing unexec...

An update on input

Posted Oct 13, 2016 1:35 UTC (Thu) by whot (subscriber, #50317) [Link]

Jake: a minor correction regarding " Anything that matches on the touchpad name in user space will end up with a "mute touchpad", he said."

That's not quite correct. We end up with 2 kernel devices anyway, one with the one with the new name and one with the old name. The old one is mute, it never sends events. Anything that matches on the old name will only apply to the device that never sends events, so your configuration options etc. won't get set on the device that's actually controlling the pointer. Apologies if that wasn't clear during the talk.

Also: "That was fixed by setting the acceleration slower on those devices so that users move their fingers faster and don't hit the firmware problem" - that's the plan, we haven't done it yet :)

An update on input

Posted Oct 13, 2016 19:06 UTC (Thu) by mb (subscriber, #50428) [Link] (4 responses)

Finally a dbus based gaming mouse configuration library/daemon. That's very nice.
Now it just needs to be able to talk to Razer mice.

An update on input

Posted Oct 13, 2016 23:46 UTC (Thu) by whot (subscriber, #50317) [Link] (3 responses)

Razer has a no reverse-engineering clause in their EULA, preventing us from figuring out the protocol.

https://libratbag.github.io/device-notes/

An update on input

Posted Oct 14, 2016 7:57 UTC (Fri) by cladisch (✭ supporter ✭, #50193) [Link]

In the US, the law does not mention reverse engineering as one of the exclusive rights in copyrighted works, so it is allowed by default. But if you have accepted the EULA, doing reverse engineering is a violation of that contract. (A contract violation does not have the same consequences as violating a law.)

(The DMCA forbids circumvention of copy protection measures, but has an explicit exception if it is necessary to achieve interoperability.)

As for the EU, the law forbids reverse engineering, but has an exception if it is "indispensable to obtain the necessary information to achieve the interoperability of an independently created program with other programs". And no EULA¹ can change that.
_____
¹ Even if it were valid².
² Most aren't because you cannot add restrictions after the purchase has been completed.

An update on input

Posted Oct 14, 2016 11:31 UTC (Fri) by kugel (subscriber, #70540) [Link]

NVIDIA has the same clause but nouveau doesn't care. And NVIDIA doesn't (or can't) do anything about it right?

IANAL but by violating the EULA you merely lose the right to use the software in question (the razer mice driver) but how does that matter to anyone? Besides that forbidding reverse engineering in EULAs is not legitimate in lots of countries anyway.

An update on input

Posted Oct 14, 2016 17:39 UTC (Fri) by mb (subscriber, #50428) [Link]

> Razer has a no reverse-engineering clause in their EULA, preventing us from figuring out the protocol.

Almost every EULA out there has that clause. That doesn't mean it prevents us from developing drivers. (In this thread people already explained why that is the case)

But it's your lucky day. You don't even need to reverse engineer the original software. The razercfg developers already did that for you.
https://bues.ch/h/razercfg
So you can use that as a documentation of the hw protocol.

Razer is not hostile against Open Source. They actively supported me developing the Deathadder GPL driver after I published the first reverse engineered version of it.

An update on input

Posted Oct 14, 2016 11:48 UTC (Fri) by amarao (guest, #87073) [Link] (1 responses)

After I start using Wacom Cintiq (wacom tabled glued inside monitor, so you see line you drawing directly under you cursor) I found that cursor (hardware cursor) is refreshed about 15 times per second or even less. This is very nannying because cursor on screen lagging behind actual pen. When one is doing cross hatching (quick moves to create many parallel strokes), it's very very annoying, because sometimes cursor have no time to display any movement at all, just showing at random spots across the pen path).

I checked windows & mac - they both have exactly same problem. I've tried to read about hardware cursor refreshing rate, and found almost nothing.

Any thoughts?

An update on input

Posted Oct 22, 2016 8:03 UTC (Sat) by Hi-Angel (guest, #110915) [Link]

Try reporting a bug.


Copyright © 2016, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds