An update on the input stack
The input stack for Linux is an essential part of interacting with our systems, but it is also an area that is lacking in terms of developers. There has been progress over the last few years, however; Peter Hutterer from Red Hat came to the 2019 X.Org Developers Conference to talk about some of the work that has been done. He gave a status report on the input stack that covered development work that is going on now as well as things that have been completed in the last two years or so. Overall, things are looking pretty good for input on Linux, though the "bus factor" for the stack is alarmingly low.
High-resolution mouse scrolling
High-resolution mouse-wheel scrolling should be arriving in the next month or two, he said. It allows for a different event stream that provides more precision on the movement of the mouse wheel on capable devices. Instead of one event per 15-20° of movement, the mouse will send two or four events in that span. Two new event types were added to the 5.0 kernel (REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES) to support the feature. The old and new event streams may not correlate exactly, so they probably should not be used together, he cautioned.
Likewise, libinput has added a new event type (LIBINPUT_EVENT_POINTER_AXIS_WHEEL) for high-resolution scrolling; it should be handled with its own event stream as with the kernel events. That code is sitting on a branch; it works but it has not been merged into the master yet. For Wayland, a new event type was also added in a now-familiar pattern. He pointed to a mailing list post where all the gory details of high-resolution scrolling for Wayland was explained.
libinput user devices
Hutterer has been working on input devices simulated in user space for libinput in order to simplify testing the library. Instead of needing a real kernel device to provide evdev events to libinput, a program can pass a file descriptor to libinput as the place to read its evdev events from (instead of it opening /dev/input/event0 for example). Then the client can provide evdev events to itself, in some sense, that will be treated exactly the same as a regular evdev source by libinput. Diagrams on slides 15 and 16 in his slide deck [PDF] may help visualize the idea.
The libinput test suite takes around an hour to run and the only place it currently runs is on his laptop. The test failures are all based on timeouts that are tweaked for his system; beyond that, it needs to be run as root, has dependencies on udev and uinput, and it can mess up the login session when it is run. The test suite will not run in a container as it stands, so it is not part of the continuous-integration (CI) testing. User devices will make it easier to run the test suite in a container, but there are other use cases for the feature as well. He mentioned having a keyboard macro daemon for Wayland that would generate evdev events to be handled just as any other keyboard input. He is currently planning to put this new code in libinput-testing.so, rather than into libinput itself, but that may need to change down the road to support the other use cases.
ratbag-emu
Hutterer also mentioned ratbag-emu, which is a mouse firmware emulator that Filipe Laíns, an intern at Logitech, has been working on. When a gaming mouse needs to be configured, that is done by the ratbag daemon (ratbagd)—part of libratbag—which sends device-specific commands via a raw HID device (e.g. /dev/hidraw0). In order to test that, an actual mouse needs to be plugged in and removed multiple times.
Ratbag-emu will emulate the mouse so that the test suite can exercise ratbagd. There is a REST interface exposed by ratbag-emu that allows specific devices to be chosen for emulation and to check on the settings that were sent to them. The idea is to be able to emulate any mouse, but right now it is mostly for Logitech mice because they have full specifications for those, Hutterer said.
Tuhi
Moving on to things that had been done in the last year or two, Hutterer mentioned Tuhi, which is a GTK program to manage Wacom Smartpad devices (e.g. Bamboo Spark). These are notepads with paper that you can draw on with a pen, but underneath the device records all of the strokes made; using Bluetooth, you can retrieve the drawings. He has a recent blog post about Tuhi as well.
Tuhi does not need to be sophisticated, he said, it simply pulls down the images and provides a way to save them as SVG or PNG format files. The protocol had to be reverse engineered, but the project eventually did get some specifications from Wacom that helped untangle a few misunderstandings. The only way to get a drawing from the tablet is to get the oldest one stored there; if newer drawings are wanted, the older ones must be deleted. That makes it imperative that Tuhi not lose any drawings when it is pulling down several; there are multiple safeguards in Tuhi to ensure that, Hutterer said.
Bus factor of one
The xf86-input-evdev driver is in maintenance mode at this point. The last commit was in May 2018 and, since the 2.10.0 release four years ago, there have been a total of 19 commits. It is still shipped in RHEL 8 in order to support "crazy devices" that don't work otherwise. Similarly, xf86-input-synaptics had a 1.9.0 release in 2016 and has had nine commits since. It is effectively dead and all touchpads should be working with libinput at this point. Since libinput took over from xf86-input-synaptics three years ago, no one has stepped up to say they want to continue maintaining it, Hutterer said.
"Libinput is good and has a problem at the same time", he said. Since the 1.9.0 release roughly two years ago, it has had 1100 commits—980 of those were by Hutterer. "The bus factor is one. The input stack you are all relying on has one developer." Over those two years, there have been 50 other developers, but only four of them have more than five commits.
The move to GitLab has given him the ability to add tags to bugs, but he found that adding the "help needed" tag to libinput bugs was a reliable way to never hear anything about that bug again. Moving to GitLab has been a mixed blessing, he said. He is more efficient and the CI integration will make things even better, but, as far as he can tell, libinput changes are getting no code review. When he used to post patches to the mailing list, he would get the occasional "drive-by review", but that doesn't seem to happen when the patches are "seven clicks away in the GitLab web interface".
The story with libratbag is somewhat familiar. It was meant to be the "one true mouse-configuration API" when it was introduced four or five years ago, Hutterer said. For a year or so, that was going well but it fell by the wayside as he and others ran out of time to work on it—and no one else stepped up. There are a lot of people who want their mouse to work correctly, he said, but there are not a lot who are willing to help make that happen. Given that, he is not sure what the future holds for libratbag.
libinput quirks
Around a year and a half ago, the "libinput quirks" feature was added. There are a lot of devices that are broken in some fashion, so there needs to be a way to indicate that. For example, some devices claim to have buttons they don't have, don't claim buttons they do have, are upside down, and so on. Back in 2014, these quirks were stored in the udev hardware database (hwdb), which is a simple-to-use key/value store that is available on every system.
Over time, though, the hwdb approach became unmaintainable; libinput started using hierarchical and nested quirks that were essentially unable to be debugged. In addition, depending on how the hwdb was updated, quirks would seemingly randomly be applied or overridden. For those reasons, over the last two years the project switched to using .ini files to describe the quirks in one place that should be easy for users to find and work with.
libinput-record
The evemu utilities to record and replay event streams have been replaced with libinput-record and libinput-replay. The custom format used by evemu was not extensible, so the new tools use a YAML format. Most importantly, Hutterer said, the new tools are in the libinput repository and are released at the same time as libinput, which should eliminate the version mismatch problems that have plagued debugging efforts in the past.
Hold gestures
Something that he has been thinking about adding to libinput is "hold" gestures. It already has "swipe" and "pinch" gestures, so adding a hold gesture, where you place three fingers, for example, down on the touchpad without moving them, would make sense. There could be hold gestures for one, two, and three fingers.
The hold event might simply be the start of a pointer movement, though, so some kind of "hold cancel" event would be needed before the pointer movement events. If the fingers are placed down again, another hold event would be reported. This would allow a two-finger flick to start kinetic scrolling, which is implemented in the applications, and then to be able to detect when to stop the scrolling because the user has touched down as they saw what they were interested in scroll by. There is no code for hold gestures as yet, he said, so he encouraged those interested to get in touch to discuss how it should all work.
Hutterer covered some other topics in the talk (YouTube video) as well, including adding support for the Dell Canvas Dial totem device, which is meant as a secondary input device for menu selection on a drawing tablet. While it is now supported in libinput, he was not optimistic that any applications would actually add functionality for it. There were also some changes to simplify XKB configuration. In truth, it all sounds like quite a bit was accomplished with a really small base of developers. We need to hope that changes—and that Hutterer steers clear of buses.
[I would like to thank the X.Org Foundation and LWN's travel sponsor, the Linux Foundation, for travel assistance to Montréal for XDC.]
| Index entries for this article | |
|---|---|
| Conference | X.Org Developers Conference/2019 |
Posted Oct 9, 2019 22:50 UTC (Wed)
by flussence (guest, #85566)
[Link] (1 responses)
I know my hardware's already capable, `cat /dev/input/foo|xxd` sends several updates before the window scrolls one notch. (is there a better way to figure that out?)
Posted Oct 10, 2019 11:27 UTC (Thu)
by grawity (subscriber, #80596)
[Link]
evemu-record will show you what the kernel recognizes and sends to userspace (raw data). Then libinput-debug-events will show you how libinput interprets these events (after applying smoothing, acceleration, etc).
Then xinput test-xi2 will show if Xorg and XInput2-using programs can see those events...I think? (Some programs, such as Firefox, still need an envvar to start using xi2 and not legacy events, and the same applies to smooth touchpad scrolling.)
Posted Oct 10, 2019 9:42 UTC (Thu)
by nix (subscriber, #2304)
[Link] (1 responses)
Maybe this really means "utterly stable evdev is perfect for me, stick with it until I get a gaming mouse with 48 buttons and a wheel that spins in four dimensions"? I was going to say "there is no obvious hint what differences there might be from a user perspective between evdev and libinput" but really it was just that I hadn't looked for them and the one is mostly a drop-in replacement for the other.
I was kept away from the libinput X driver in the past because my mouse is this weird rebadged ergonomic thing from a now-dead company (Maplin) with a broken usb id of "1234:1234" (really) and almost all the other properties blank so you can't reliably identify it: so quirking it in a generic fashion was basically hopeless and I was relying on the resolution option, which is missing in libinput. But maybe what this is telling me is that I should exploit the fact that unlike laptop users I can actually change mouse, and try to find an ergonomic mouse with hardware not designed by crazy people, since that USB interface has more problems and sometimes messes up other things connected to the same hub as well. Anker seem to do one that looks basically identical and costs £13, and Anker actually understand USB (they're the only people out there doing USB 3 hubs that actually work reliably), so I think I'll try that, and then try switching to libinput.
I would probably be saying something different if this mouse was built into a £4000 laptop. (I *would* say something different if my keyboard had this sort of problem, since it too is quirky as hell with buggy firmware but very expensive and has no real replacement, not even from the same manufacturer.)
Input: utterly crucial, everyone ignores it until suddenly it doesn't work any more and then they can't send emails whining about how they can't badger someone else into fixing it because their input layer is broken. :)
Posted Oct 18, 2019 2:38 UTC (Fri)
by pabs (subscriber, #43278)
[Link]
Posted Oct 10, 2019 11:45 UTC (Thu)
by patrakov (subscriber, #97174)
[Link] (1 responses)
I have also asked a professional psychologist to improve my CV. Result: "Your CV is OK, the problem is that you apply to open-source companies, and they won't hire you unless you work for them full-time for free already, in which case they will obviously have no motivation to hire you either. Just stop wanting to be an open-source developer."
P.S. CV for those interested: http://pc.cd/PLz7
Posted Oct 17, 2019 13:43 UTC (Thu)
by pas (subscriber, #126462)
[Link]
And it's sort of a reasonable decision on part of OSS orgs that they want someone that is really "passionate" about open source (meaning if the funding runs out they can still reach the developer and get a few goodwill/bonus hours for free per week, maybe to review the work of the new guy, or whatever).
That said, it's really hard to contribute to the classic Linux desktop software stack. It's absolutely arcane and byzantine at the same time. It's old, yet some strange pathways work very reliably, but any small change can perturb the music of the spheres, and new pathways have to be divined and sacrifices have to be made. (So, I'm currently trying to figure out Xfce4's screensaver. It's set to disabled yet it very dutifully activates after 5 minutes of inactivity. But there's also the bug that the password dialog is invisibe, but only after lid-close without sleep. ¯\_(ツ)_/¯ )
Posted Oct 11, 2019 1:22 UTC (Fri)
by timrichardson (subscriber, #72836)
[Link]
Posted Oct 11, 2019 10:01 UTC (Fri)
by ballombe (subscriber, #9523)
[Link] (1 responses)
Posted Oct 11, 2019 14:12 UTC (Fri)
by nix (subscriber, #2304)
[Link]
An update on the input stack
An update on the input stack
An update on the input stack
distros removing Xorg keyboard/mouse drivers
An update on the input stack
An update on the input stack
An update on the input stack
An update on the input stack
<https://salsa.debian.org/consolation-team/consolation>
An update on the input stack
