Commit graph

1883 commits

Author SHA1 Message Date
Peter Hutterer
83840fb0bc Merge branch 'master' of gitlab.freedesktop.org:libinput/libinput 2018-07-20 08:37:47 +10:00
Greg V
db2dd43c86 Add versionsort test
And make local versionsort testable even when the native one is present.
2018-07-19 22:29:00 +03:00
Peter Hutterer
23d5f2a590 touchpad: don't NONE or HOVERING touches towards the touch
To trigger this, we'd need 1, 2, 3 fingers down, release fingers 1 and 2 but
keep 3 down. Then put finger 1 down again. Touches 1 and 3 are alive now,
touch 2 is in state NONE.

During the thumb detection we took the first touch not in BEGIN and assigned
it to "first" - this would now be the second touch in state NONE.

Real effect is relatively minimal since we only use the coordinates here.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/89

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-19 14:52:44 +10:00
Peter Hutterer
af97fbb86a evdev: fix the trackpoint multiplier info message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-17 10:51:46 +10:00
Greg V
0e03784e47 Fix include portablity (xlocale, stdlib) 2018-07-16 13:44:15 +03:00
Greg V
f8b412052e Import versionsort implementation from musl for systems without versionsort
versionsort is a GNU extension, not available on *BSD systems.
2018-07-16 13:44:11 +03:00
Peter Hutterer
8362031064 fallback: remove some if 0 code
Looks like a development leftover.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-16 12:16:18 +10:00
Peter Hutterer
c013112406 evdev: whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-16 12:16:18 +10:00
Peter Hutterer
e6cad92005 Rename data/ to quirks/
A better, less ambiguous name than just "datadir"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-13 13:30:54 +10:00
Peter Hutterer
3cae73a7b5 tap: log a tap bug for release on MULTITAP_PALM
If we get here, the finger may only triger a PALM_UP but not a RELEASE event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-13 11:08:56 +10:00
Peter Hutterer
847e0b68bc tap: remove unnecessary TAP_STATE_DEAD assignment
All palm touches are set to DEAD anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-13 10:56:51 +10:00
Peter Hutterer
f4dc296247 quirks: remove the leftovers of the trackpoint range attribute
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:49:02 +10:00
Peter Hutterer
27f7a66de4 filter: add a trackpoint multiplier factor
Measuring the trackpoint range has not shown to be sufficient or precise
enough to be used as an ingredient for trackpoint acceleration. So let's just
switch back to a generic multiplier that we can apply to the input deltas do
undo any device-specific lack of scaling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:04:59 +10:00
Peter Hutterer
1cc9f44e93 quirks: add quirks_get_double()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:04:59 +10:00
Peter Hutterer
6dca5df806 filter: make the trackpoint accel profile func the same prototype as the others
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:04:59 +10:00
Peter Hutterer
831ce3c0d3 filter: replace the trackpoint accel with a velocity-based one
This gets rid of the trackpoint range propery that we've been parsing until
now and instead just opts for a basic curve with some deceleration for low
pressure. The speed range is taken from the touchpad and should be wide enough
for most trackpoints that fall within the expected range.

Trackpoints like the new ALPS ones need to be configured through a hwdb (this
part is currently missing).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:04:59 +10:00
Peter Hutterer
1f3f681fa7 fallback: cancel the debounce timers during device remove, not destroy
destroy isn't called until the last libinput_device_unref(), so we may trigger
a debounce timer after the device was removed. The same fix is neded for the
touchpad interface.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/72

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-29 13:52:17 +10:00
Peter Hutterer
237ebb7cc4 touchpad: don't disable tapping on MT_TOOL_PALM
The tapping code can handle palm states now, so there is no need to disable
tapping altogether when a tool-based palm is detected.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/65

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-26 01:37:28 +00:00
Peter Hutterer
55d2890aae quirks: free the dt string
Not sure how that got through the valgind test before...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-25 11:08:37 +10:00
Peter Hutterer
5354226e59 util: use assert() instead of abort() for testing for size limits
This way we can send a message to the user, a simple abort() isn't informative
enough.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/54

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-22 09:37:20 +10:00
Konstantin Kharlamov
061e504261 libinput-private: constify inline helpers
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-06-21 23:26:41 +00:00
Sergiusz Michalik
9873d68bf1 zalloc limit fix for libinput-record 2018-06-20 19:34:28 +02:00
Peter Hutterer
c9cc785612 quirks: drop the JUMPING_SEMI_MT model
Removed from the udev properties in a55693f87c
but survived here while the branch was in process.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-20 11:59:20 +10:00
Peter Hutterer
793c8d51e8 util: abort if we try to allocate more than a MB
The ssize_t cast upsets coverity for some reason but we can be a lot more
restrictive here anyway. Quick analysis of the zalloc calls in the test suite
show the largest allocation is 9204 bytes.

Let's put a cap on for one MB, anything above that is likely some memory
corruption and should be caught early.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Matheus Santana <embs@cin.ufpe.br>
2018-06-20 11:41:48 +10:00
Peter Hutterer
17c4609645 quirks: add more assertion to avoid API misusage (v2)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-19 13:07:24 +10:00
Peter Hutterer
14b7bb4726 Revert "quirks: add more assertion to avoid API misusage"
Ooops, this clearly didn't get tested and now aborts libinput list-quirks

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/47

This reverts commit 2c4f963b18.
2018-06-18 20:55:27 +10:00
Peter Hutterer
2c4f963b18 quirks: add more assertion to avoid API misusage
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-18 13:35:34 +10:00
Peter Hutterer
8aef361062 quirks: explicitly cast the log priority
The values are the same and this is ABI so they will never change. Make the
cast explicit for coverity's benefit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-18 13:29:23 +10:00
Peter Hutterer
653beca662 quirk: remove unused variable
Also fixes a coverity complaint about incrementing an uninitialized variable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-18 13:25:02 +10:00
Peter Hutterer
a57d35a1aa quirks: add MatchVersion in addition to VID/PID
Needed for the ALPS firmware detection in #39

https://gitlab.freedesktop.org/libinput/libinput/issues/39

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-18 10:34:16 +10:00
Konstantin Kharlamov
734496d972 touchpad: ignore motion on finger-up
Ignore motion when pressure/touch size fell below the threshold, thus
ending the touch.

Real world significance: subjectively scrolling/cursor positioning with
a touchpad now a bit better on SAMSUNG NP305V5A laptop.

https://gitlab.freedesktop.org/libinput/libinput/merge_requests/4

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-06-15 10:10:13 +10:00
Peter Hutterer
0d6dea5d8f quirks: use realloc instead of reallocarray
The latter requires libbsd and for that one call it's not worth it

https://gitlab.freedesktop.org/libinput/libinput/issues/40

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-15 08:01:53 +10:00
Konstantin Kharlamov
a23414dd1f touchpad: replace last_point with history.samples
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-06-14 08:31:30 +10:00
Peter Hutterer
000ac14c27 Merge branch 'wip/config-files' 2018-06-11 13:45:50 +10:00
Peter Hutterer
8865d4a29d util: abort for a negative zalloc() size
Nothing in libinput needs large buffers, so if we ever get something that
large, we probably passed a negative number to zalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-11 13:43:40 +10:00
Peter Hutterer
24a19dd167 util: put limits on how many strings we join
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-11 13:43:37 +10:00
Peter Hutterer
6ad928a1b6 util: add null string test handling to strv_join
Make it return NULL for a string array in the form of [ NULL ], like the docs
say. This also adds an extra safety check for the joiner to be of a reasonable
length to avoid overflows.

Found in
https://gitlab.freedesktop.org/libinput/libinput/issues/26#note_6320

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-11 13:43:15 +10:00
Peter Hutterer
46b64c7363 touchpad: don't pair external touchpads with lid/tablet mode switches
https://gitlab.freedesktop.org/libinput/libinput/issues/29

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-11 00:34:03 +00:00
Peter Hutterer
b926497cc6 quirks: add the devicetree implementation
Using the compatible string

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:37:22 +10:00
Peter Hutterer
639ed0b641 Switch from udev property parsing to the quirks system
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:37:22 +10:00
Peter Hutterer
33341ddd20 libinput: initialize the quirks subsystem
A bit quirky (haha), because we cannot do this during context creation - we
really want any parsing error messages to show up in the right log file and
the log handler isn't set up during context creation. So we do it on the first
real call to the backend - path_add_device or udev_assign_seat.

Also, failure to initialize the quirks subsystem just means we continue as
normal. This shouldn't be a hard failure, it just means a lot of devices won't
work properly.

If the LIBINPUT_DATA_DIR environment variable is set, that directory is used
for the data file. Only that directory, no custom override file in that case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:37:22 +10:00
Peter Hutterer
3ce70cfa91 quirks: allow for in-line comments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:33:35 +10:00
Peter Hutterer
fc6e6aad36 quirks: use an empty dmi modalias string for the test suite
We don't want any of the test devices to match the local machine's DMI
modalias. This was a major drawback in the previous test suite, hacking the
dmi modalias string was nontrivial but a wrong string could cause false
positives or negatives.

The quirks system is internal, so rather than having some fancy API we just
hook it off the environment variable that the test suite always sets. Hacky,
but a lot easier than the other options.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:33:35 +10:00
Peter Hutterer
5792af9a5f Implement a quirks system to replace the udev property parsing
Previously, we had all extra device information ("This is an Apple Touchpad",
"This touchpad causes pointer jumps", etc.) in the udev hwdb. The problem with
the hwdb is that updating it is nontrivial for the average user and debugging
when things go wrong is even harder. Plus, the hwdb has a matching scheme that
is unpredictable unless one is familiar with the implementation.

This patch set moves the hwdb entries into .ini style text files, with a
simple line-based parser. A new libinput list-quirks tool can list the quirks
applied to any given device, in --verbose mode it prints all matches as they
apply or not apply.

The data files are currently unused by libinput, that comes in a later patch.
They're installed though, the defaults point to the /usr/share/libinput
directory and for *temporary* local overrides the single file
/etc/libinput/local-overrides.quirks.

Failure to parse any file is a hard failure for the quirks system, but if the
local override file doesn't exist that's fine.

THIS IS NOT A CONFIGURATION INTERFACE! None of these settings are exposed via
the libinput_device_config_* calls. There is no API guarantee for these files,
think of them as source code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:33:35 +10:00
Peter Hutterer
be647fbb0d util: add a safe_atou() as unsigned equivalent to safe_atoi()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 13:47:33 +10:00
Peter Hutterer
e05fa8444a util: add a list_append()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 13:47:33 +10:00
Peter Hutterer
483123d490 filter: cap trackpoint scale factor at 1.0
Otherwise we scale up lower-resolution trackpoints' movements, resulting in a
jumpy cursor.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-05 10:45:07 +10:00
Peter Hutterer
085a33d545 Revert "udev: copy the trackpoint sensitivity directly from sysfs"
The lenovo compact keyboard with trackpoint has a sensitivity of 5, which
causes the trackpoint range to be 0. This in turn causes inf/NaN during
pointer acceleration as we divide by 0 and makes the cursor go unpredictably
somewhere it probably shouldn't be.

This is part of a wider problem in that the current sensitivity handling
doesn't work well for values well below the default of 128. Any such values
are scaled up to multiples of pixels instead of just working as-is.

Reverting the automatic sensitivity parsing, any systemd udev property set to
change the sensitivity increases it, so we don't run into this bug.

https://bugzilla.redhat.com/show_bug.cgi?id=1583324

This reverts commit a4036a33ca.
2018-06-04 08:44:11 +10:00
Peter Hutterer
d62118ac56 evdev: don't allow a trackpoint range of 0
https://bugzilla.redhat.com/show_bug.cgi?id=1583324

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-04 08:44:05 +10:00
Peter Hutterer
a55693f87c udev: drop the JUMPING_SEMI_MT quirk, no-one uses it
Obsolete since 342bc51016 when we disabled MT on
all semi-mt touchpads.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-31 13:09:37 +10:00