Commit graph

56 commits

Author SHA1 Message Date
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
Peter Hutterer
400e52c6a2 tools: pass -rc to strerror, not rc
rc is a negative errno

Found by Coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-22 11:50:15 +10:00
Emmanuele Bassi
84d2d5034c tools: Fix compiler warning
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 07:24:46 +10:00
Emmanuele Bassi
b215120e39 Fix the include directives when building in tools/
We need to add top_srcdir to fix the build when srcdir != builddir.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 07:23:45 +10:00
Peter Hutterer
5250243b6f tools: add a tool to print the actual range provided by a touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-25 13:18:18 +10:00
Gaetan Nadon
4f0f1ca68c Review/update .gitignore files
Merge potentially useful patterns taken from other projects.

Some application specific patterns were move to their respective directories.

The only noticeable change is that *.patch is ignore to prevent accidental
checkin of patches. The pattern "test-driver" could not be found and was
removed.

The test directory had not been updated since the move of all test cases
in a single binary.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-11-19 09:34:23 +10:00
Peter Hutterer
2a3219f55d Add a copy of linux/input.h
This avoids a number of otherwise required ifdefs when building on older kernels

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-23 09:04:34 +10:00
Peter Hutterer
d9fcbd563a Mark three deprecated functions as such
These are deprecated, but were missing the deprecated attribute.
And fix up the tests that were still using those deprecated calls.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-04 16:02:22 +10:00
Peter Hutterer
ab2ab19ca3 tools: make to function calls static
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-17 20:11:38 +10:00
Colin Walters
34fc7ee425 tools: Honor GCC_CFLAGS
So we get compiler warnings from tools/ too.

Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-17 20:11:32 +10:00
Peter Hutterer
661602fe3b Name-space the read flags better
Rename from LIBEVDEV_READ_foo to LIBEVDEV_READ_FLAG_foo to differentiate
better from LIBEVDEV_READ_STATUS_foo.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-09-11 12:10:15 +10:00
Peter Hutterer
5d2fc78138 Enumerate libevdev_next_event() return codes
Improved readability in callers, changing magic numbers 0 and 1 to

rc = libevdev_next_event();
if (rc == LIBEVDEV_READ_STATUS_SUCCESS)
    do_something();
else if (rc == LIBEVDEV_READ_STATUS_SYNC)
    do_something_else()

No ABI changes, the enum values are the previously documented values,
this is just a readability improvement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-09-11 12:10:12 +10:00
Peter Hutterer
ab2f20bfd6 Revamp the API once again
Another look at the current API showed some inconsistencies, rectified
in this commit:

libevdev_kernel_*: modify the underlying kernel device
libevdev_event_type_*: something with an event type
libevdev_event_code_*: something with an event code
libevdev_event_*: struct input_event-related functions (i.e. not device-related)
libevdev_property_*: something with a property
libevdev_*: anything applying to a device

Hopefully that's the last API change. Current symbols deprecated and aliased.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-09-10 11:25:09 +10:00
Peter Hutterer
c9bc2a9e39 Rename ID getters to have a consistent naming scheme
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-01 13:53:05 +10:00
Peter Hutterer
00528f27d5 Rename a few getters for consistency
Deprecated:
* libevdev_get_abs_min, libevdev_get_abs_max
* libevdev_get_input_prop_name

Will be removed in one or two versions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-01 13:53:05 +10:00