summaryrefslogtreecommitdiff
path: root/tools/shared.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed a grammar errorpixl2019-07-051-1/+1
|
* tools: add --apply-to to debug-events and debug-guiPeter Hutterer2019-05-271-9/+22
| | | | | | | | | | All configuration options will only apply to the device with the given match mattern. This makes it easier to test things like tapping on one device but not on the other. Exception is the sendevents pattern which applies independently. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: move the builddir lookup function out to a separate filePeter Hutterer2019-03-141-53/+8
| | | | | | | | | We want to use this from the tests as well soon, so let's move it to a more generic location. This also changes the API to be slightly more sensible, a free() is the same cost (and safer) than passing a static buffer in and hoping we didn't get the size wrong. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: make the tools exit with exit code 2 on usage issuesPeter Hutterer2018-11-071-1/+1
| | | | | | This makes it easier to test for usage issues Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: drop a superfluous linebreak in the list-quirks outputPeter Hutterer2018-11-051-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: handle the EventCodeDisable quirk in the quirks toolPeter Hutterer2018-11-051-0/+29
| | | | | | This caused an assertion Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* quirks: replace the manual enumation of all quirks with a loopPeter Hutterer2018-09-201-127/+64
| | | | | | Reduces the places we need to update bits for new quirks. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* quirks: sort the quirks model flags in alphabetical orderPeter Hutterer2018-09-201-11/+11
|
* tools: fix a bunch of format conversion complaintsPeter Hutterer2018-09-121-1/+1
| | | | | | Fixes #137 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* quirks: add a quirk to monitor MSC_TIMESTAMP for pointer jumpsPeter Hutterer2018-08-311-0/+2
| | | | | | | 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>
* touchpad: add support for size-based thumb detectionPeter Hutterer2018-08-291-0/+2
| | | | | | Fixes #97 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add quirk to control velocity averaging, disable it by defaultKim Lindberger2018-08-221-0/+5
| | | | | | | | | | | 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.
* tools: always set the log handler for debug-events and debug-guiPeter Hutterer2018-07-191-3/+2
| | | | | | This way errors are highlighted in red even without --verbose Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: setenv the quirks dir when running from the build directoryPeter Hutterer2018-07-171-0/+9
| | | | | | Fixes #84 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: change prototype of the builddir lookup functionPeter Hutterer2018-07-171-17/+31
| | | | | | | 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>
* quirks: remove the leftovers of the trackpoint range attributePeter Hutterer2018-07-111-2/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* filter: add a trackpoint multiplier factorPeter Hutterer2018-07-111-0/+6
| | | | | | | | | 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>
* quirks: add quirks_get_double()Peter Hutterer2018-07-111-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: don't add the debug behavior for release buildsPeter Hutterer2018-07-091-0/+5
| | | | | | | | | | 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>
* tools: if the execdir is the builddir, add it to the pathPeter Hutterer2018-07-091-1/+34
| | | | | | | | | | | | | | | 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>
* tools: move printing device quirks to the shared tools libPeter Hutterer2018-06-261-0/+135
| | | | | | | | 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>
* tools: pass a valid grab parameter to list-devicesPeter Hutterer2018-06-201-1/+1
| | | | | | | | | | | | | | 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 0a13223c39fdf0f079715bf83d498c0dcd9cf4f8 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: fix grab argument passing for libinput debug-eventsPeter Hutterer2018-06-141-5/+5
| | | | | | | | | | | | | | | 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>
* Revert "Expose a custom acceleration profile"Peter Hutterer2018-05-211-21/+0
| | | | | | | | | | | | | | | 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 d8bd650540e68e8b648e76180c5eee0f19a3b893. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Expose a custom acceleration profilePeter Hutterer2018-04-261-0/+21
| | | | | | | | | | | | | | | | | | | | | | 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>
* tools: fix switch case-statement indentationPeter Hutterer2018-04-121-130/+130
| | | | | | We don't indent the 'case FOO:' lines in libinput Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Silence coverity warning about uninitialized entryPeter Hutterer2018-02-161-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: when the command isn't installed, print thatPeter Hutterer2017-11-091-5/+14
| | | | | | | 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>
* tools: add --disable-sendevents option to the debug-events/debug-gui toolsPeter Hutterer2017-09-181-0/+19
| | | | | | Makes it possible to debug issues with sendevents. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add safe_strdup()Peter Hutterer2017-07-121-1/+1
| | | | | | | 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>
* Fix a few things scan-build complains aboutPeter Hutterer2017-07-101-4/+5
| | | | | | | Uninitialized variables, potential NULL dereferences, dead assignments and an unused return value. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: split the configuration option parsing outPeter Hutterer2017-06-261-208/+64
| | | | | | | | | | | | | | | 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>
* tools: shorten the --help output for the commandsPeter Hutterer2017-06-221-35/+0
| | | | | | | 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>
* tools: add "libinput measure touchpad-tap"Peter Hutterer2017-06-021-0/+131
| | | | | | | | | | | | | | | | 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>
* tools: make the libinput tool usage staticPeter Hutterer2017-06-021-1/+0
| | | | | | This now makes the header obsolete too Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: tidy up the usage() for the tools a bitPeter Hutterer2017-06-021-17/+21
| | | | | | | 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>
* tools: switch the libinput tool to be an exec-ing toolPeter Hutterer2017-06-021-15/+5
| | | | | | | | | | | | | | | | | | 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>
* tools: fix minor coding style issuePeter Hutterer2017-05-261-1/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: hook libinput-debug-events into the libinput toolPeter Hutterer2017-05-181-10/+26
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: add color to litest verbose outputPeter Hutterer2017-03-281-3/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: use 'required_argument'/'no_argument' for getopt_longPeter Hutterer2017-03-241-27/+27
| | | | | | See the getopt_long example, makes the code more obvious Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: add "--quiet" option to only log libinput messagesPeter Hutterer2017-02-241-0/+6
| | | | | | | | | | | | 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>
* tools: print errors as red, info as highlightedPeter Hutterer2017-02-151-0/+18
| | | | | | | 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>
* tools: hide key codes by defaultPeter Hutterer2017-02-141-0/+7
| | | | | | | | | | | | | | | | 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>
* tools: add allowed range to --set-speed help outputPeter Hutterer2017-01-031-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: fix signed/unsigned comparison warningsPeter Hutterer2016-12-061-3/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: fix prototype for tools_usagePeter Hutterer2016-12-061-1/+1
| | | | | | | ../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>
* tools: don't define GNU_SOURCE if were including config.h anywayPeter Hutterer2016-12-011-1/+0
| | | | | | 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>
* tools: change --speed to --set-speed for consistencyPeter Hutterer2016-11-291-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Mark some internal log functions as printf-style functionPeter Hutterer2016-10-251-0/+1
| | | | | | | | 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>