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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>