Commit graph

70 commits

Author SHA1 Message Date
Stephen Kitt
066d9caf55
Add a manpage for mouse-dpi-tool
Signed-off-by: Stephen Kitt <steve@sk2.org>
2021-11-15 08:58:11 +01:00
Peter Hutterer
d03f9b6616 tools: add a helper tool to list all currently known codes
A non-installed tool to make it easy to check if newly added codes are
indeed supported correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-09 09:46:16 +10:00
Peter Hutterer
60d4f1b2ae Change to the (always intended) MIT license
Due to what must've been a copy/paste error many years ago, the license text
for libevdev wasn't actually the MIT license. Let's rectify this, it was
always MIT intended anyway.

To make this more obvious and reduce the chance of copy/paste mistakes, use
the SPDX license identifier in the various source files. The two installed
public header files have the full license text.

All contributors with copyrightable contributions have ACKed the license
change to MIT, either in the MR directly [1] or privately in reply to an
email.

[1] https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/69

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Alexander Dahl <ada@thorsis.com>
Acked-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Acked-by: Armin K <krejzi@email.com>
Acked-by: Benjamin Tissoires <btissoir@redhat.com>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Deepa Dinamani <deepa.kernel@gmail.com>
Acked-by: Emmanuele Bassi <ebassi@gnome.org>
Acked-by: Gaetan Nadon <memsize@videotron.ca>
Acked-by: George Thomas <georgefsthomas@gmail.com>
Acked-by: Michael Forney <mforney@mforney.org>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Acked-by: Niclas Zeising <zeising@daemonic.se>
Acked-by: Owen W. Taylor <otaylor@fishsoup.net>
Acked-by: Peter Seiderer <ps.report@gmx.net>
Acked-by: Ran Benita <ran234@gmail.com>
Acked-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Scott Jann <sjann@knight-rider.org>
Acked-by: Thilo Schulz <thilo@tjps.eu>
Acked-by: polyphemus <rolfmorel@gmail.com>
2021-01-25 13:46:55 +10:00
Peter Hutterer
f6c0a048c5 tools: add a man page for the touchpad-edge-detector tool
Requires some .gitignore pattern removal too and an autotools fix to actually
dist the man pages.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-06 09:56:33 +10:00
Niclas Zeising
6ea230bc72 tools: Remove signalfd.h include again
Remove the includsion of sys/signalfd.h again, it hasn't been needed
since cca90938 and was accidentally re-added, probably as a mismerge,
in a40e014e.

Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2020-09-19 12:13:12 +02:00
Peter Hutterer
44b5c9bd9f include: sync event codes with kernel 5.8
And fix the script to sync the headers up so it syncs event codes for both bsd
and linux, but only syncs input.h for linux.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-11 12:13:13 +10:00
Rosen Penev
fb6a84a52a
[clang-tidy] do not use else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-27 00:42:20 -07:00
Rosen Penev
a40e014eca
libevdev: sort includes alphabetically
Found with clang-tidy's llvm-include-order

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-27 00:29:54 -07:00
Rosen Penev
cd8bde522f libevdev: remove pointless return in void function
Found with clang-tidy's readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-27 07:15:28 +00:00
Niclas Zeising
1bf2b41d3f tools: use basename(argv[0]) for program name
Use baename(argv[0]) to get the program name (for usage), instead of
using program_invocation_short_name, which only exists on Linux, not
FreeBSD.

Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2020-08-14 17:50:56 +02:00
Niclas Zeising
cca9093887 tools: Remove signalfd() use
Remove signalfd() use from the mouse-dpi-tool and touchpad-edge-detector
tools, in favor of using plain old signals.
FreeBSD does not have signalfd() without pulling in external libraries,
and with this change these tools can be compiled on FreeBSD.
Instead of providing two implementations, one using signalfd() and one
using signal(), just use the signal() implementation everywhere as it is
more portable.

Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2020-08-14 17:50:56 +02:00
Niclas Zeising
db01b2d606 Don't hardcode /bin/bash
Don't hardcode /bin/bash, use /usr/bin/env bash instead, since not all
platforms install bash as /bin/bash.
FreeBSD, as an example, installs bash in /usr/local/bin/bash by default.

Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2020-08-13 13:11:33 +02:00
Peter Hutterer
2e41b6778b tools: specify width by height in the edge-detector help
Fixes #13

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-07 07:56:57 +10:00
Peter Hutterer
521edcba27 tools: rename the example device in the touchpad-edge-detector
In the hope that people don't blindly type event0 from now on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-28 07:15:53 +10:00
Peter Hutterer
223909ed0b tools: fix the include path for local includes
Make sure we use the local include files, and correct the path accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-17 17:42:32 +10:00
Peter Hutterer
3d03038d78 tools: drop explicit GNU_SOURCE define
It's defined globally through AC_USE_SYSTEM_EXTENSIONS

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-14 12:03:23 +10:00
Peter Hutterer
4c8a7a265d config.h is a local include path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-14 12:03:23 +10:00
Peter Hutterer
0a66de813e tools: drop use of HAVE_CONFIG_H
There's no case where we don't have a config.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-14 12:03:23 +10:00
Deepa Dinamani
3c6766c862 Update struct input_event
The struct input_event is not y2038 safe.
Update the struct according to the kernel patch:
https://lkml.org/lkml/2018/1/6/324

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-12 15:23:22 +10:00
Peter Hutterer
eefaca6f9f tools: add a script to sync the kernel header files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-03 10:13:40 +10:00
Peter Hutterer
1ec01b1310 tools: print an error if we don't have any matching events in the dpi tool
Beats crashing by dereferencing a null-pointer (when we access
m->frequencies[idx])

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-01-17 14:50:29 +10:00
Peter Hutterer
a155a977b7 tools: move udev printf into the print_summary() helper
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-01-17 14:42:13 +10:00
Peter Hutterer
61f0a0f9ad tools: print the mean frequency together with the max frequency
And if they're 30% out, print a warning. On the ThinkPad X1 Wireless Touch
Mouse (when connected via bluetooth) we get a bunch of events at the start of
the movement, all less than 1ms apart. Best guess is that the device goes to
low-power, then notices the movement and buffers the event until the BT
connection is back up. Then it sends all events at once. Usually they're less
than 1ms apart, but at one recording showed a 37ms delay before we go back to
the normal 70ms (~15Hz) the mouse has otherwise.

This is unpredictable enough that we can't just work around it so instead
print a warning to the user so they can go investigate.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-09-21 16:57:29 +10:00
Peter Hutterer
55c43b19cf tools: rename frequency to max_frequency in the dpi tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-19 10:55:51 +10:00
Peter Hutterer
94385480ff tools: use uint64_t, not doubles for the µs parameters
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-16 07:26:42 +10:00
Peter Hutterer
2a612997ab tools: fix kernel-announced width/height
Side-effect of 240ba34ebd was that "touchpad size as listed by the kernel"
was now dependent on the values we got. This one is a static one based on the
axis info.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-15 11:57:52 +10:00
Peter Hutterer
240ba34ebd tools: fix the touchpad resolution calculation
Previous ones used the absinfo from the kernel but since we never updated that
from within the tool, the output was always the same.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-26 11:43:54 +10:00
Peter Hutterer
761687e995 tools: require a minimum size for touchpads
This mostly aims to catch users trying to specify the size in inches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-01 07:47:46 +10:00
Peter Hutterer
911106230a tools: change touchpad-edge-detector to require physical size
Almost no-one does the calculations for me to update the udev rules (and some
rules were submitted with the <x resolution> placeholders left in).
Require the user to specify the physical size so we just copy/paste the actual
udev rule.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-08-01 06:48:04 +10:00
Peter Hutterer
4943f2895f tools: allow numeric axis values in tweak-device
Not all axes a device may have are assigned a semantic name.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-22 10:10:39 +10:00
Peter Hutterer
a95ca2c821 tools: fix tweak-device option parsing
https://bugs.freedesktop.org/show_bug.cgi?id=92880

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-22 09:45:22 +10:00
Peter Hutterer
3c85fcb62f tools: shut up coverity about a potential close(-1)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-04 07:39:24 +10:00
Peter Hutterer
5b13ffb78f tools: fix coverty "may be used uninitialized" warnings
tools/libevdev-tweak-device.c:390: uninit_use_in_call: Using uninitialized
value "changes" when calling "parse_options_abs".

tools/libevdev-tweak-device.c:376: warning: 'led' may be used uninitialized in
this function

tools/libevdev-tweak-device.c:375: warning: 'axis' may be used uninitialized
in this function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-04 07:39:24 +10:00
Peter Hutterer
33d51dbaa4 tools: fix touchpad-edge-detector udev rule output
off-by-one error on the ABS_ axes printed. ABS_X/Y are 0 and 1.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-10 13:07:10 +10:00
Peter Hutterer
fa3c5622de tools: print out evdev override udev rule from touchpad edge detector
We're starting to collect overrides for custom devices, making this easier for
users and saves us time. Once we measured everything, print out a
guesstimated udev rule and instructions on how to calculate the resolution.
Extra output now is:

	Touchpad size as listed by the kernel: 132x111mm
	Calculate resolution as:
		x axis: 6076/<width in mm>
		y axis: 5021/<height in mm>

	Suggested udev rule:
	# <Laptop model description goes here>
	evdev:input:b0005v05ACp030E*
	 EVDEV_ABS_01=-2694:2862:<x resolution>
	 EVDEV_ABS_02=-20:121:<y resolution>
	 EVDEV_ABS_35=-2694:2862:<x resolution>
	 EVDEV_ABS_36=-20:121:<y resolution>

The ABS_MT_ axes are only printed if the device have them, if the device isn't
bluetooth/usb we print the dmi modalias instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 08:16:09 +10:00
Peter Hutterer
8b9c47a7cb tools - tweak-device: add a --resolution command
So far, 100% of the usages for tweak-tool was to set the x/y resolution of a
device. Make --resolution a shortcut for this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-07-01 11:59:20 +10:00
Peter Hutterer
4d058bc2b0 tools - tweak-device: revamp to reduce use of globals
Make the code base a bit more modular so it's easier to add new commands.
Main change here is: options are parsed twice now, first time for the mode
(abs/led) and the device path, then again for the mode-specific options.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-07-01 11:59:04 +10:00
Peter Hutterer
c8a557fc9b tools - tweak-device: fix wrong error message if the LED doesn't exist
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-29 12:12:39 +10:00
Peter Hutterer
269584b1b5 tools - tweak-device: close the fd on exit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-29 12:12:39 +10:00
Peter Hutterer
f54656ecc1 tools: complain about devices that don't have abs x/y axes in the edge detector
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-10 14:53:40 +10:00
Peter Hutterer
e1d87fa6df tools: widen frequency resolution to µs in the DPI tool
The Microsoft Arc Touch Mouse claims 8000fps which is higher than we can
measure in the current milliseconds resolution.
http://www.cnet.com/products/microsoft-arc-touch-mouse-black-series/specs/

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-21 11:52:40 +10:00
Peter Hutterer
d26973216c tools: fix help string for manual DPI calculation
https://bugs.freedesktop.org/show_bug.cgi?id=90143

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-23 10:36:55 +10:00
Peter Hutterer
4160d94baf cosmetic: fix a couple of duplicate/missing empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-04 08:41:33 +10:00
Peter Hutterer
3bf7d50230 tools: add a tool to change kernel devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-04 11:02:02 +10:00
Peter Hutterer
f4cc76d96f tools: note that the mouse frequency measured is the highest frequency
Some devices scale the frequency based on the input and will provide
recordings with different frequencies each time. Recommend to measure multiple
times since we can only know what the highest frequency is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-07 13:39:55 +10:00
Peter Hutterer
59c824ebc0 tools: fix clang compiler warning
mouse-dpi-tool.c:213:39: warning: missing field 'frequency' initializer
[-Wmissing-field-initializers]
        struct measurements measurements = {0};

Annoying, but a low-cost fix.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-07 08:33:10 +10:00
Peter Hutterer
e897f6f821 tools: print the formula to calculate resolutions
And encourage users to move at least 25cm, makes it a lot easier to pick the
resolution.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-12 08:37:24 +10:00
Peter Hutterer
9923b06e71 tools: zero-pad PID/VID in the dpi tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 14:17:27 +10:00
Peter Hutterer
6ce23c6d79 tools: print the hwdb match line from the dpi tool
Let's make this as easy as possible

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-02 09:39:14 +10:00
Peter Hutterer
bb406fe411 tools: add a tool to estimate the resolution of a mouse
Relative devices don't provide a physical resolution to the host. For things
like pointer acceleration, the physical amount of movement is better as
baseline than the movement in device units.

Alas, many devices don't come with any information at all, so the users have
to guess. Help that guesswork by providing a tool that does the calculations
for them.

This tool measures the device units covered, then prints the frequency and an
lookup table for various resolutions (in dpi) to match to the physical
movement of the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-11-21 09:42:12 +10:00