Commit graph

538 commits

Author SHA1 Message Date
Peter Hutterer
52d52f320c libevdev 1.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-13 13:50:44 +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
e11662ac72 doc: reduce doxygen file to the non-default settings
Makes it easier to check what we changed from the defaults.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-22 08:32:10 +10:00
Peter Hutterer
60188f1c4d Fix typo in doc string
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-20 11:31:38 +10:00
Peter Hutterer
0b92e1ae5e uinput: support the new UI_DEV_SETUP/UI_ABS_SETUP ioctls
Available in kernel 4.5 and later (uinput version 5), these ioctls allow us to
set the absinfo correctly, i.e. including the resolution.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-04-07 11:06:19 +10:00
Peter Hutterer
7989eef759 uinput: split uinput device creation into a helper function
No functional changes. This is prep work for supporting the new
UIDEV_DEV_SETUP ioctl.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-04-07 11:05:00 +10:00
Peter Hutterer
345a1589a5 uinput: drop an unused argument
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-04-07 11:04:59 +10:00
Peter Hutterer
97fb972e41 include: update to v4.5 linux/uinput.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-04-07 10:43:11 +10:00
Peter Hutterer
5ea0a27ba6 Add parsing linux/input-event-codes.h, update to kernel v4.5
The kernel has split most of the event codes out to a new header but the FF_
bits are missing from that header. Until this is fixed upstream, change the
event code parsing so it can take two files (using cat and stdin) so we can
update the kernel headers again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-30 15:45:58 +10:00
Peter Hutterer
46b8381f0c test: ignore a failure to UI_DEV_DESTROY the device
Coverity complains about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-04 07:26:53 +10:00
Peter Hutterer
2a27abf824 test: drop unnecessary return value
We abort if anything goes wrong anyway, so we never returned anything but
success.

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-04 07:10:33 +10:00
Peter Hutterer
bf8e6b2982 libevdev 1.4.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-05 12:41:59 +10:00
Peter Hutterer
006f10cfcb uinput: fix race condition in uinput syspath check
In theory, the device could change between stat() call and open(), resulting
in us opening the new device. Change to open() first, then fstat() on the fd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2016-01-04 07:39:24 +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
cabe03d8fe Document that the fd should be drained before libevdev_set_fd
This is the caller's responsibility, for two reasons:
* we don't know if O_NONBLOCK is set, so draining the fd isn't a simple matter
  of read() until EAGAIN. A select() + read() could work around this of
  course.
* for stateless information, keys and relative data, it is not a problem when
  there are events waiting on the fd already, they are processed correctly,
  albeit with a delay.

So punt this decision to the caller, they openend the fd, they know if they
care about delayed events, they can drain the fd before handing it to us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
2015-12-17 10:46:31 +10:00
Peter Hutterer
de23fa00e7 libevdev 1.4.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-11 12:11:48 +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
100448ae8e Add some more files to gitignore
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-10 13:07:10 +10:00
Peter Hutterer
ece0b7bedc libevdev 1.4.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-01 10:26:21 +10:00
Andreas Pokorny
0028174c0b Fix invalid absinfo range values reported by certain mtk soc
This change will only affect certain touch screens, for which the driver
integration code does not provide meaningful values for the allowed range
of ABS_MT_TRACKING_IDs. The reported range [0, 0] will be overwritten with
[-1, 0xFFFF]

Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>

[Changed from INT_MAX to 0xFFFF to match the kernel, add device name to log
message]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 16:26:00 +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
743deafb95 Note that libevdev_free() does not close the fd
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-29 12:23:34 +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
d43413fb3d libevdev 1.4.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-22 16:57:35 +10:00
Peter Hutterer
66dfaeb999 include: update to 4.1 header
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-22 15:53:48 +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
6f03fd49fb libevdev 1.4.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-24 11:52:54 +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
01356bc5f2 include: update to 4.0 header
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-13 10:06:03 +10:00
Peter Hutterer
74f8f5388f libevdev 1.4.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-08 12:48:47 +10:00
Peter Hutterer
97da13c3c4 Accept LIBEVDEV_READ_FLAG_BLOCKING as valid flag
https://bugs.freedesktop.org/show_bug.cgi?id=89798

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-04-08 12:48:43 +10:00
Peter Hutterer
635c07ee98 ABS_MAX counts as MT axis for the event queue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-23 14:02:15 +10:00
Peter Hutterer
5e49ce5630 cosmetic: fix a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-23 14:01:58 +10:00
Peter Seiderer
bc428e0211 Disable test-static-link in case of shared only build.
Fixes the following buildroot compile failure:

libtool: link: [..]/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -std=gnu99 -I.. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -static -o test-static-link test_static_link-test-link.o  ../libevdev/.libs/libevdev.so -Wl,-rpath -Wl,[...]/build/libevdev-1.4/libevdev/.libs
[...]/arm-buildroot-linux-uclibcgnueabi/bin/ld: attempted static link of dynamic object `../libevdev/.libs/libevdev.so'
collect2: error: ld returned 1 exit status
Makefile:719: recipe for target 'test-static-link' failed

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-16 08:57:42 +10:00
Peter Hutterer
6c87163a2a libevdev 1.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-04 08:50:43 +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
4ba296cf90 test: use -std=c89 instead of c90 for the build test
They're identical, but RHEL6 doesn't support -std=c90

https://gcc.gnu.org/onlinedocs/gcc/Standards.html
https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-09 12:54:36 +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
def17850d1 test: always build the build-tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-04 10:42:42 +10:00
Peter Hutterer
a669ac1faf configure: rename BUILD_TESTS to ENABLE_RUNTIME_TESTS
Avoids confusion when we build tests in the future even though BUILD_TESTS is
disabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-04 10:42:41 +10:00
Thilo Schulz
7571dc49e5 Use memcpy/memmove instead of loop operations
Signed-off-by: Thilo Schulz <thilo@tjps.eu>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-02 11:42:57 +10:00
Owen W. Taylor
867a237c55 libevdev_uinput_destroy: don't close non-open FD
The returned errno from libevdev_input_create_from_device was returned
incorrectly because libevdev_uinput_destroy() would try to close the
unset value of ->fd, overwriting errno.

That was fixed in debe9b030c, this patch avoids
the ioctl/close calls if the fd isn't set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-21 08:48:50 +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