Commit graph

626 commits

Author SHA1 Message Date
Peter Hutterer
318b0a5b11 Remove superfluous linebreak in an error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-18 08:17:56 +10:00
Peter Hutterer
0bf6d29ceb doc: fix uinput example code
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-18 08:17:55 +10:00
Peter Hutterer
45670fa6db Fix a confusing comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-17 11:26:29 +10:00
Peter Hutterer
9a3f2ced4e libevdev 1.3.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-13 11:06:08 +10:00
Peter Hutterer
c8882c31c4 doc: update doxygen.in for current doxygen
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-13 11:06:08 +10:00
Peter Hutterer
e4bb610cda include: update to 3.17 header
Adds INPUT_PROP_POINTING_STICK

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-13 09:40:42 +10:00
Peter Hutterer
74c3ed6504 libevdev 1.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-09 11:29:15 +10:00
Ran Benita
f92f4027d1 doc: fix slightly confusing code/type comments
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-28 07:54:22 +10:00
Peter Hutterer
825644803c configure.ac: print prefix and libdir
When building for multiple prefixes from the same repo it's nice to see a
reminder for what the current prefix is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-27 15:48:06 +10:00
Peter Hutterer
592caa6106 libevdev 1.3RC2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 10:29:05 +10:00
Peter Hutterer
69b77b896a test: fix EVIOCREVOKE test on non-supporting kernels
The ioctl-returned errno is positive.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 10:28:09 +10:00
Peter Hutterer
0ceee5ec65 Add some minimal documentation about static linking
I can't recommend it, but I can't stop people from doing it, so at least
document the ground rules.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 10:12:37 +10:00
Peter Hutterer
31113e6038 Hook up nm to check for leaking symbols in the static library
We ignore anything that starts with an underscore, anything that starts with
libevdev and main (since we test the test-static-link binary) and a couple of
gcov-related functions. This should catch any functions we accidentally
export.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 10:06:48 +10:00
Peter Hutterer
6d3c994694 test: handle the GCOV_LDFLAGS in all tests
We rebuild the libevdev object files with the gcov flags for the tests, so we
need to make sure those flags are present on all binaries.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 10:06:48 +10:00
Peter Hutterer
1e264b6e94 test: override check-local instead of check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 10:06:48 +10:00
Peter Hutterer
f46737726b test: add basic static link test
Same as the dynamic link test, just with the -static flag

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 10:06:48 +10:00
Peter Hutterer
6247e5c12a uinput: explicitly ignore the UI_DEV_DESTROY return value
This can't fail in the kernel anyway, so cast it to shut up Coverity.
Error message:
"Calling function "ioctl(int, unsigned long, ...)" without checking return
 value (as is done elsewhere 35 out of 36 times)."

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-25 09:54:28 +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
Peter Hutterer
53958c56cd uinput: close the managed fd on error
Using LIBEVDEV_UINPUT_OPEN_MANAGED can leak the fd if an error occurs after
opening it.

Found by Coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-22 11:50:13 +10:00
Peter Hutterer
e4c315fc16 Rename symbols leaking from static library to avoid name clashes
The static library currently leaks log_msg and log_priority. Both are too
generic, so rename them, with a leading underscore to hint they're supposed to
be private.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-20 16:43:58 +10:00
Peter Hutterer
8742e1e346 Add libevdev_property_from_name()
12717d79 "Add libevdev_event_type/code_from_name() resolvers" added the
lookup functions for types and codes, this commit adds the missing ones for
input properties.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-08-20 08:43:15 +10:00
Peter Hutterer
87c1cd05ec configure: move the python check down to re-unite the gcov check outputs
The python check was inserted between "checking whether to build with gcov"
and the answering "yes", causing a lonely "yes" or "no" to wander around the
config.log in vain, haunted by solitude and wondering about the binary
simplicity of its life.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-19 09:41:57 +10:00
Peter Hutterer
d856a85cda test: drop include of libevdev-int.h
Not needed, and shouldn't be used in a test anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 10:36:08 +10:00
Peter Hutterer
c0248818e6 test: use ck_assert_int_eq() where comparing integers
A simple ck_assert() just fails, a ck_assert_int_eq() also shows the two
values. Makes failures a bit easier to debug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 10:36:08 +10:00
Peter Hutterer
debe9b030c uinput: preserve the errno before cleaning up
libevdev_uinput_destroy() may/will botch the errno, make sure we save it
before use.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-15 08:37:30 +10:00
Peter Hutterer
09529a6a65 uinput: check errno against the positive value
We use the negative errno internally, but the proper errno is always positive.

Fixes device creation failures on kernels that don't support UI_SET_PROPBIT.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-15 08:37:26 +10:00
Peter Hutterer
a5f150ef57 libevdev 1.3RC1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-08 11:39:58 +10:00
Peter Hutterer
f8689be5ba include: update to Linux 3.16 header
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-08 11:12:24 +10:00
Peter Hutterer
9058665fc0 include: add uinput.h header as well
Older kernels don't have UI_GET_SYSNAME, and upstream is adding a few more
ioctls to the uinput code. So ship the header we're using to avoid compilation
errors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-06-25 08:29:53 +10:00
Peter Hutterer
734aadb487 uinput: change strcpy/strcat usage for snprintf
Better protection against buffer overflow, though by the time someone
is manipulating your sysfs, libevdev is unlikely to be the biggest worry.

Slight change in functionality: before we checked the timestamp of
/sys/devices/virtual/input/inputXYZ before looking at /inputXYZ/name, now we
just check the name file for the timestamp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-06-20 11:00:16 +10:00
Peter Hutterer
2ff45c73a1 uinput: use the UI_GET_SYSNAME ioctl if available
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-06-20 10:58:46 +10:00
Peter Hutterer
f415f2a694 whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-19 13:52:02 +10:00
Peter Hutterer
aa201a4737 test: ignore any timer_create errors in valgrind
Drop the rest of the stack trace, we know whenever check calls this we get a
valgrind error if sevp in timer_create(2) is NULL.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-12 09:50:22 +10:00
Peter Hutterer
02fc1bb235 include: update to Linux 3.15 header
Adds INPUT_PROP_TOPBUTTONPAD

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-10 07:51:09 +10:00
Peter Hutterer
93bc9a329d Add per-device log handlers
The global log handler isn't a good choice for a low-level library. In the
caser of the X server, both evdev and synaptics are now using the libevdev but
are loaded from the same server process. Thus, there's only one log handler,
but evdev and synaptics don't talk to each other (a bit childish, I know).

Add a per-device log handler that overrides the global log handler, and fall
back to the global log handler if no device log handler is set. The log
macros take care of that automatically, especially as we can't do per-device
log handlers for the uinput code.

Note that we use the same struct for the global and device logging, so in each
instance one of the two function pointers is NULL. Suicide triggers are in
place in case we mess that up.

This also makes libevdev_new_from_fd() a bit less useful since we can't set
the log handler beforehand.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2014-06-05 15:16:06 +10:00
Peter Hutterer
a5a1042312 m4: fix CC_CHECK_WERROR and CC_FLAG_VISIBILITY macros
These macros come from systemd, but CC_CHECK_CFLAGS_SILENT was removed in
systemd commit eb2e280f9c59b66965c9316eadc4c113a13ca744, breaking some of
them.

CC_FLAG_VISIBILITY doesn't need to require CC_CHECK_WERROR because
CC_CHECK_FLAG_APPEND always append -Werror anyway. Which kinda brings into
question why we have CC_CHECK_WERROR in the first place, but whavever.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-05 15:16:06 +10:00
Peter Hutterer
4e7863eee1 libevdev 1.2.99.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-05 15:16:05 +10:00
Peter Hutterer
576ceeea59 libevdev 1.2.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-05 15:15:30 +10:00
Peter Hutterer
f5c4de024d Mark the log functions with the printf format attribute
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2014-06-05 15:15:12 +10:00
Peter Hutterer
25507127bd Document that we need uinput in the kernel for the test suite
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-22 15:07:59 +10:00
Peter Hutterer
ee6d8b6f6e libevdev 1.2.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-14 15:12:31 +10:00
Peter Hutterer
067426385e test: unconditionally distribute the valgrind suppressions
Reported-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-07 18:55:02 +10:00
Peter Hutterer
d0af7f2851 Ignore NULL as argument in libevdev_uinput_destroy()
Triggered by the tests when run as non-root. Simply ignore any attempt to
destroy a NULL device, which also matches the behaviour of libevdev_free().

Reported-by: Andreas Radke <a.radke@arcor.de>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
Tested-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-07 18:52:17 +10:00
Peter Hutterer
b5a39e9e05 libevdev 1.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-30 15:08:25 +10:00
Peter Hutterer
a93baace89 test: run all tests through valgrind
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-04-29 10:49:10 +10:00
Peter Hutterer
974e330ac2 test: disable parallel testing
The tests create devices on the host system, avoid running them in parallel to
avoid interference between the test devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-04-29 10:48:36 +10:00
Peter Hutterer
9d22a52383 test: silence some valgrind warnings
ioctl points to uninitialized bytes - correct but we didn't use those anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-04-28 08:27:06 +10:00
Peter Hutterer
5dacba1ef8 libevdev 1.2RC1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-24 08:24:09 +10:00
Peter Hutterer
050bca91a1 Drain all events before synchronizing after SYN_DROPPED
The kernel ring buffer drops all events on SYN_DROPPED, but then continues to
fill up again. So by the time we read the events, the kernel's client buffer is
essentially like this:
  SYN_DROPPED, ev1, ev2, ev3, ...., evN

The kernel's device state represents the device after evN, and that is what
the ioctls return. For EV_KEY, EV_SND, EV_LED and EV_SW the kernel removes
potential duplicates from the client buffer [1], it doesn't do so for EV_ABS.

So we can't actually sync while there are events on the wire because the
events represent an earlier state. So simply discard all events in the kernel
buffer, synchronize, and then start processing again. We lose some granularity
but at least the events are correct.

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/input/evdev.c?id=483180281f0ac60d1138710eb21f4b9961901294

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-24 08:17:01 +10:00
Peter Hutterer
8b01184404 Move read_more_events() up in the file
No functional change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-04-24 08:17:01 +10:00