Commit graph

117 commits

Author SHA1 Message Date
Peter Hutterer
973a895d39 quirks: sort the quirks model flags in alphabetical order 2018-09-20 11:53:48 +10:00
Peter Hutterer
d616218c9a tools: fix a bunch of format conversion complaints
Fixes #137

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-12 13:28:16 +10:00
Peter Hutterer
0e2f1babc5 quirks: add a quirk to monitor MSC_TIMESTAMP for pointer jumps
Currently enabled on all Dell i2c touchpads, these seem to be the ones that
needed it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-31 11:12:42 +10:00
Peter Hutterer
66ac659e36 touchpad: add support for size-based thumb detection
Fixes #97

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-29 16:35:14 -05:00
Kim Lindberger
99334e11bf
Add quirk to control velocity averaging, disable it by default
libinput applies averaging to the velocity of most pointer devices. Averaging
the velocity makes the motion look smooth and may be of benefit to bad input
devices. For good devices, however, it comes at the unfortunate price of
decreased accuaracy.

This change turns velocity averaging off by default (sets ntrackers to 2 instead
of 16) and allows for it to be turned back on via a quirk, for bad devices which
require it.
2018-08-22 12:12:55 +02:00
Peter Hutterer
a3cc5f3f64 tools: always set the log handler for debug-events and debug-gui
This way errors are highlighted in red even without --verbose

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-19 14:10:32 +10:00
Peter Hutterer
c7a9b2064d tools: setenv the quirks dir when running from the build directory
Fixes #84

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-17 10:36:08 +10:00
Peter Hutterer
ad5d2fef72 tools: change prototype of the builddir lookup function
Only one place really needs the return argument, so we might as well just pass
the memory to be returned in.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-17 10:36:08 +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
00fdbe3951 tools: don't add the debug behavior for release builds
When the meson build type is something other than the debug types, we don't
need the special behavior where we adjust executable paths and data dir
lookup for tools run directly from the builddir.

This avoids leaking the build dir into the final executables.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-09 13:27:15 +10:00
Peter Hutterer
7e7d657dab tools: if the execdir is the builddir, add it to the path
When running libinput tools from the builddir, look up the subtools in the
builddir as well. Otherwise, add the install prefix to the list of lookup
locations.

This ensures that a) we're running builddir stuff against builddir stuff, but
also b) that we're not running builddir stuff against installed stuff because
that may give us false positives.

The test was squashed in from a separate patch and was
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-09 11:28:41 +10:00
Peter Hutterer
07e93f077e tools: move printing device quirks to the shared tools lib
This way we can re-use this from libinput-record instead of having to
duplicate all this. Since the two tools use different printfs, just make the
actual printing a simple callback.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-26 13:59:30 +10:00
Peter Hutterer
7c51c881dc tools: pass a valid grab parameter to list-devices
My kingdome for a compiler warning. Or a scan-build warning. Or a coverity
warning. Or anything... But no, nothing.

Also make the open_restricted() more robust to a NULL userdata, because
effectively that's what we were passing here.

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

Introduced in 0a13223c39

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-20 11:26:57 +10:00
Peter Hutterer
0a13223c39 tools: fix grab argument passing for libinput debug-events
The &grab pointer we used to pass as userdata was the address of the function
argument which goes out of scope at the end of the function. This works fine
for devices immediately opened but when a device connects later, the address
may have been re-used since and it's content is undefined. If not NULL, we
end up grabbing the device.

Instead pass the grab option in which is guaranteed to live until the end of
main.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-14 09:50:29 +10:00
Peter Hutterer
33162632cb Revert "Expose a custom acceleration profile"
This looked good on paper but clearly no-one (including myself) ever tested this
in a real-life situation or they would've noticed that the constant factor is
missing, causing a segfault on the first two-finger scroll event, touchpad
gesture or button scrolling.

Adding the constant factor makes the API much worse and the benefit is
unclear, so out of the window it goes. We can revisit this for libinput 1.12
but this isn't going to make the next release.

This reverts commit d8bd650540.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-21 12:15:25 +10:00
Peter Hutterer
d8bd650540 Expose a custom acceleration profile
This adds a third profile to the available profiles to map device-specific
speed to an acceleration factor, fully defined by the caller.

There has been a consistent call for different acceleration profiles in
libinput, but very little specifics in what actually needs to be changed.
"faster horses" and whatnot (some notable exceptions in e.g. bug 101139).
Attempts to change the actual acceleration function will likely break things
for others.

This approach opens up the profile itself to a user-specific acceleration
curve. A caller can set an acceleration curve by defining a number of points
on that curve to map input speed to an output factor. That factor is applied
to the input delta.

libinput does relatively little besides mapping the deltas to the
device-specific speed, querying the curve for that speed and applying that
factor. The curve is device-specific, the input speed is in device units/ms.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-26 14:48:37 +10:00
Peter Hutterer
3ec8eb7f30 tools: fix switch case-statement indentation
We don't indent the 'case FOO:' lines in libinput

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-12 11:59:46 +10:00
Peter Hutterer
da94e4e603 Silence coverity warning about uninitialized entry
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16 16:57:30 +10:00
Peter Hutterer
92aa1d1418 tools: when the command isn't installed, print that
Makes it more user-friendly to be able to split the tools into multiple
packages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-09 15:17:37 +10:00
Peter Hutterer
5252fa5d88 tools: add --disable-sendevents option to the debug-events/debug-gui tools
Makes it possible to debug issues with sendevents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-18 17:00:57 +10:00
Peter Hutterer
2e4895b888 Add safe_strdup()
Return value is either NULL or a strdup'd string, depending on the input
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-12 15:39:31 +10:00
Peter Hutterer
7b5ca6204b Fix a few things scan-build complains about
Uninitialized variables, potential NULL dereferences, dead assignments and an
unused return value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-10 10:37:58 +10:00
Peter Hutterer
d1b7b6267c tools: split the configuration option parsing out
We had one shared parsing function for all config options so tools parse
options that don't actually make sense (e.g. --quiet or --show-keycodes for
libinput-list-devices).

This patch splits the actual libinput device configuration out and reshuffles
everything to make use of that. One large patch, because splitting this up is
more confusing than dumping it all.

This means the actual option parsing is partially duplicated between debug-gui
and debug-events but hey, not everything in life is perfect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-26 18:43:59 +10:00
Peter Hutterer
8728b5b38f tools: shorten the --help output for the commands
The full information is now in the man page, the usage() now just tells you
how to use it. This way there's only one place to maintain it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-22 17:48:12 +10:00
Peter Hutterer
328bc99d3b tools: add "libinput measure touchpad-tap"
This is the first tool of many more to come to enable users to gather
information aobut their devices and/or usage of these devices. Previously,
these required the users to record events, submit them to a bugzilla, have me
run various scripts over it and then decree that the scripts have spoken.
Push some of this into the hands of the users so they can query the numbers
locally and start investigating (or at least get an idea of what's happening).

This tool measures the time deltas between touch up and touch down and prints
a basic summary, together with the ability to print a dat file with the data
for visualization by e.g. gnuplot. Eventually, more of the current analysis
scripts will be moved into this or other helpers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
4508e29a47 tools: make the libinput tool usage static
This now makes the header obsolete too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
2d42e87deb tools: tidy up the usage() for the tools a bit
Now that the debug-gui is a user-visible tool, make sure the usage reflects
the right command name.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
e9fc59efc8 tools: switch the libinput tool to be an exec-ing tool
Chaining args together inside a single binary would be nice, but it gets nasty
quickly (as I found out adding 3, 4 extra commands). Switch over to using a
git-style exec-ing command where libinput merely changes argv[0] and then
executes whatever it assembled. And those binaries can hide in libexec so they
don't clutter up the global namespace.

This also makes it a lot easier to write man pages, adopt the same style as
git uses.

Compatibilty wrapper scripts are provided for libinput-list-devices and
libinput-debug events. These warn the user about the changed command, then
exec the new one. Expect these wrappers to be removed at some point in the
future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
d73f252f2a tools: fix minor coding style issue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-26 11:15:13 +10:00
Peter Hutterer
f3107a78e0 tools: hook libinput-debug-events into the libinput tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-18 09:24:22 +10:00
Peter Hutterer
0bd36f2542 test: add color to litest verbose output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00
Peter Hutterer
6ba530f2d8 tools: use 'required_argument'/'no_argument' for getopt_long
See the getopt_long example, makes the code more obvious

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-24 11:42:44 +10:00
Peter Hutterer
451c6913e5 tools: add "--quiet" option to only log libinput messages
Supresses any printf statements from the tool itself, i.e. it skips printing
any of the events.

Makes it easier to debug the internal state since it's not intermixed with a
whole lot of messages about the events that are generated. Best combined with
--verbose (yes, hilarious, isn't it...)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
2017-02-24 16:11:46 +10:00
Peter Hutterer
92196ce555 tools: print errors as red, info as highlighted
makes it easier to filter out debugging messages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-15 09:29:39 +10:00
Peter Hutterer
8c1aa1de00 tools: hide key codes by default
libinput-debug-events prints keycodes as they come in. This makes it dangerous
to be run by users (especially in the background) because it will leak
sensitive information as it is typed. Obfuscate the base set of keycodes
by default, require a --show-keycodes switch to show it.

The few times we actually need the keycodes, we can run the switch in the
debugging tool.

This does not affect keys outside of the main block on the keyboard (F-keys,
multimedia keys).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-14 07:53:22 +10:00
Peter Hutterer
16bf0deb23 tools: add allowed range to --set-speed help output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-03 09:35:40 +10:00
Peter Hutterer
952b562d0c tools: fix signed/unsigned comparison warnings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-06 11:02:13 +10:00
Peter Hutterer
6e1db369ee tools: fix prototype for tools_usage
../tools/shared.h:66:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
void tools_usage();

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-06 08:06:27 +10:00
Peter Hutterer
ea7026b7c1 tools: don't define GNU_SOURCE if were including config.h anyway
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-12-01 11:06:52 +10:00
Peter Hutterer
364621c001 tools: change --speed to --set-speed for consistency
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-29 12:13:23 +10:00
Peter Hutterer
ef2f95dfee Mark some internal log functions as printf-style function
Fixes the respective clang warnings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-25 10:00:58 +10:00
Peter Hutterer
59fac8e902 Add configurable button map to tappings
The previously hardcoded button map for tapping is 1/2/3 to LRM. But the
middle button is a common feature on the desktop (used for paste, most
prominently) and three-finger tapping is almost impossible to do reliably on
some touchpads (e.g. the T440 has a recognition rate of ~1 in 5).

Left and right buttons have a prominent physical position (either softbuttons
or physical buttons) so make the tap order configurable. Those that require
middle buttons reliably can use the [software] buttons for left/right and
2-finger tap for a middle button.

https://bugs.freedesktop.org/show_bug.cgi?id=96962

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-15 09:05:57 +10:00
Peter Hutterer
cba2278c3a touchpad: add a config option to disable tap-and-drag
There are a number of use-cases where tapping may be desirable, but
tap-and-drag is not, e.g. where tapping is used to select multiple items in a
list. Having tap-and-drag on hinders this, and the nature of the interaction
means it cannot be detected based on timeouts, movement thresholds, etc.

Provide an option instead to turn tap-an-drag off. Tap-and-drag remains
enabled by default (though tapping is disabled by default).

For the touchpad tap state diagram, the new option disables the transition
from state TOUCH to state TAPPED and releases the button immediately instead.
This means that multitap-and-drag is disabled too since we now just loop
around in the single-tap state for multitap.

It also makes tapping more responsive - we don't have to wait for the timeout
before we know whether it's a tap event. The first touch time is noted, we now
send the button press with the time of the first touch and the release with
the time of the release. This ensures a realistic time diff between the two
events.

https://bugs.freedesktop.org/show_bug.cgi?id=93502

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.netto>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-27 10:03:28 +10:00
Peter Hutterer
8d9e7a1bcf Add an API to change pointer acceleration profiles
The quartett of new config functions is:
	libinput_device_config_accel_get_profiles
	libinput_device_config_accel_get_profile
	libinput_device_config_accel_set_profile
	libinput_device_config_accel_get_default_profile

The profile defines how the pointer acceleration works, from a very high-level
perspective. Two profiles are on offer, "adaptive", the standard one we have
used so far and "flat" which is a simple multiplier of input deltas and
provides 1:1 mapping of device movement vs pointer movement.

The speed setting is on top of the profile, a speed of 0 (default) is the
equivalent to "no pointer acceleration". This is popular among gamers and
users of switchable-dpi mice.

The flat profile unnormalizes the deltas, i.e. you get what the device does
and any device below 800dpi will feel excruciatingly slow. The speed range
[-1, 1] maps into 0-200% of the speed. At 200%, a delta of 1 is translated
into a 2 pixel movement, anything higher makes it rather pointless.

The flat profile is currently available for all pointer devices but touchpads.

https://bugs.freedesktop.org/show_bug.cgi?id=89485

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-09-11 00:54:01 +10:00
Peter Hutterer
42f482b43d tools: fix switch statement indentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 07:57:03 +10:00
Peter Hutterer
55974dcac5 Add a configuration interface for enabling/disabling disable-while-typing
DWT can interfere with some applications where keyboard and touchpad use at
the same time is common, e.g. games but also anything that requires a
combination of frequent pointer motion and use of keyboard shortcuts.

Expose a toggle to disable DWT where needed.

https://bugs.freedesktop.org/show_bug.cgi?id=90624

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:49:23 +10:00
Peter Hutterer
f74769e77e tools: add --grab option
Issues an EVIOCGRAB on the openend devices, providing exclusive access. Makes
it easier for debugging, so moving the pointer doesn't accidentally trigger
other stuff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-24 15:19:33 +10:00
Peter Hutterer
b7c414558d tools: pass a context around as userdata
We need the options during open_restricted(), so instead of the caller just
passing in a custom userdata, let them wrap it into a tools_context.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-24 15:15:15 +10:00