Peter Hutterer [Fri, 22 Nov 2013 02:15:19 +0000 (12:15 +1000)]
test: add a build test for -Wpedantic
A user of libevdev may be compiled with -Wpedantic. Our header files should
not produce any warnings, so add a simple test that merely includes both
public header files and compiles with -Wpedantic -Werror.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Fri, 22 Nov 2013 00:30:14 +0000 (10:30 +1000)]
Drop semicolons after getter/setter macros
libevdev.c:921:134: warning: ISO C does not allow extra ';' outside of a
function [-Wpedantic]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Fri, 22 Nov 2013 00:24:29 +0000 (10:24 +1000)]
Drop trailing comma from last element in the enums
If a caller is compiled with -pedantic, this causes a few complaints
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Fri, 22 Nov 2013 00:23:55 +0000 (10:23 +1000)]
Drop deprecated functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Thu, 21 Nov 2013 23:43:31 +0000 (09:43 +1000)]
libevdev 0.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Tue, 19 Nov 2013 16:59:10 +0000 (11:59 -0500)]
python: request version 2.6 or higher
This seems like a reasonable minimum version to require.
Available in RHEL6 (2010) or Ubuntu (2010).
Version 2.7 contains the argparse module so the check could be removed.
The argparse module was introduced in v2.3.5 as an optional module.
http://www.python.org/doc/versions/
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Tue, 19 Nov 2013 16:58:54 +0000 (11:58 -0500)]
configure.ac: remove redundant AC_SUBST(PYTHON)
This is already done by AM_PATH_PYTHON.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Tue, 19 Nov 2013 16:58:45 +0000 (11:58 -0500)]
configure.ac: AC_PROG_CC_C99: use C99 compiler
Given the close ties with input drivers and xserver, might
as well use the same level of compiler.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Tue, 19 Nov 2013 16:57:38 +0000 (11:57 -0500)]
configure.ac: add copyright statement
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Tue, 19 Nov 2013 16:56:40 +0000 (11:56 -0500)]
configure.ac: AC_INIT: add bug report url
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Mon, 18 Nov 2013 20:17:12 +0000 (15:17 -0500)]
autogen.sh: remove unneeded m4 configuration workaround
Creating the m4 directory is not required under any circumstances
when the package is properly configured. We have git files under m4.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Mon, 18 Nov 2013 20:15:58 +0000 (15:15 -0500)]
autogen.sh: fix broken out-of-source tree building
The configure script is invoked from the build directory rather than
from the source directory.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Fri, 15 Nov 2013 20:55:04 +0000 (15:55 -0500)]
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>
Peter Hutterer [Mon, 18 Nov 2013 03:52:37 +0000 (13:52 +1000)]
Drop gcov flags from main libevdev sources
We recompile the sources anyway in the tests and we have our own CFLAGS there.
Drop them from the main library code so we don't leave gcov files everywhere.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
David Herrmann [Sun, 17 Nov 2013 12:44:02 +0000 (07:44 -0500)]
build: check for build/link flags harder
Use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE to test for flags that
might succeed during compilation but not during linking. An example is gcc
compiled with libssp support but gnu-ld without it. In this case
-fstack-protector works fine during compilation but fails during linking
as several internal helpers are missing.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Gaetan Nadon [Thu, 14 Nov 2013 22:29:43 +0000 (17:29 -0500)]
Update COPYING file.
The file must reflect actual Copyright statements in the source code.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Tue, 5 Nov 2013 06:58:24 +0000 (07:58 +0100)]
build: set AC_CONFIG_SRCDIR
This macro is used to verify that $srcdir is set correctly by testing for
existance of the passed file. Shouldn't hurt setting it to catch wrong
build setups.
Cc: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 31 Oct 2013 01:37:33 +0000 (11:37 +1000)]
Provide separate lookup functions for zero-terminated strings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
David Herrmann [Wed, 30 Oct 2013 07:45:27 +0000 (08:45 +0100)]
Add name-resolver unit tests
A bunch of tests for the new name resolver.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Wed, 30 Oct 2013 07:44:48 +0000 (08:44 +0100)]
Add libevdev_event_type/code_from_name() resolvers
Three new helpers are added:
(1) libevdev_event_type_from_name() takes a string describing an EV_*
event type and returns the given event-type constant.
(2) libevdev_event_code_from_name() takes a string describing an event
code and returns the given event-code constant.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Mon, 28 Oct 2013 16:16:45 +0000 (17:16 +0100)]
Create event type/code lookup tables
Additionally to type->string mapping tables we now also create
string->type lookup tables. The lookup tables are sorted by their name
so binary-search will work.
We create one lookup table for EV_* types and one for all event-codes.
More tables (like bus-names, input-properties, ..) can be added later.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Wed, 30 Oct 2013 07:24:43 +0000 (08:24 +0100)]
Add startswith() helper
Simple helper that use strncmp() to test whether a given string
starts with a given suffix. While it doesn't reduce code-size by much,
it is a lot more readable than the strncmp() usage.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Mon, 28 Oct 2013 16:16:43 +0000 (17:16 +0100)]
Fix wrong libevdev clock test
We can rely on CLOCK_MONOTONIC and CLOCK_REALTIME to be different at any
time. However, this does not apply to the ms/us/ns parts of the current
time. Both may be in sync regarding the current micro-seconds state. So
remove the wrong clock us-comparison.
I was able to trigger this on my machine. Chances that both are in sync
are very low so I assume my RTC only provides low granularity and thus
both clocks are sync during boot for higher granularity.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 29 Oct 2013 03:46:14 +0000 (13:46 +1000)]
Require autoconf 2.62
According to Gaetan, that's what we really require. And as a bonus point, this makes libevdev build
on RHEL6 out-of-the-box.
CC: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 24 Oct 2013 04:30:40 +0000 (14:30 +1000)]
Check max to see if an event type is valid
There's a gap in the range between EV_SW and EV_LED. Trying to enable one
of those bits will segfault.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Thu, 24 Oct 2013 04:21:31 +0000 (14:21 +1000)]
Make sure EV_SYN is always set
Set the bit during device reset and make sure that if we're checking
for the event type we always return true for EV_SYN.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Thu, 24 Oct 2013 04:18:30 +0000 (14:18 +1000)]
Disallow disabling EV_SYN event codes
The documentation already says that, make it happen.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Tue, 22 Oct 2013 01:27:42 +0000 (11:27 +1000)]
Reset the struct on set_fd
libevdev_set_fd may fail at a number of points. If it does, it errors out but does nothing
otherwise. Thus, a client may call set_fd again for the same struct but on a different fd and have
it succeed. Depending on when set_fd bailed out the first time, some fields may already be set.
Thus, reset the whole struct at set_fd time to make sure we're nulled out appropriately.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Mon, 14 Oct 2013 05:15:46 +0000 (15:15 +1000)]
Revert "Check for linux/input.h during configure"
We now ship our own linux/input.h, so no need to have the header around locally.
This reverts commit
fcf80ba3713b9d92480dc8be9ec4d88d95586ec0.
Peter Hutterer [Thu, 10 Oct 2013 01:22:48 +0000 (11:22 +1000)]
Document backwards-compatibility behaviour
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 8 Oct 2013 04:21:14 +0000 (14:21 +1000)]
Work around missing EVIOCGMTSLOTS ioctl
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 8 Oct 2013 03:43:20 +0000 (13:43 +1000)]
Make uinput-code backwards-compatible to missing UI_SET_PROPBIT ioctl
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Tue, 8 Oct 2013 03:09:50 +0000 (13:09 +1000)]
When running against a kernel without properties, continue as usual
Missing out on properties is not fatal.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 14 Oct 2013 05:40:51 +0000 (15:40 +1000)]
Pass linux/input.h as argument to make-event-names.py
Rather than a hardcoded path inside the source.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 14 Oct 2013 04:28:46 +0000 (14:28 +1000)]
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>
Peter Hutterer [Mon, 14 Oct 2013 05:28:16 +0000 (15:28 +1000)]
configure: test for python and python-argparse
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Tue, 8 Oct 2013 05:27:27 +0000 (15:27 +1000)]
Don't allow a negative fd in libevdev_set_fd
Everything else responds with -EBADF, let's do so here as well.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 8 Oct 2013 05:16:32 +0000 (15:16 +1000)]
Allow -1 as valid fd in libevdev_change_fd
Add a new flag for "initialized" and separate that from the fd logic. This way,
we can call libevdev_change_fd(dev, -1) to signal that the current fd should be
dropped.
Otherwise libevdev can't be told to release the fd and always keeps a reference
to it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 8 Oct 2013 03:01:07 +0000 (13:01 +1000)]
Check for linux/input.h during configure
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 8 Oct 2013 04:22:27 +0000 (14:22 +1000)]
Uppercase #define LIBEVDEV_INT_H
over-eager search/replace
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 4 Oct 2013 06:15:43 +0000 (16:15 +1000)]
Note that libevdev_change_fd requires a LIBEVDEV_FORCE_SYNC
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 4 Oct 2013 06:00:38 +0000 (16:00 +1000)]
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>
Peter Hutterer [Tue, 1 Oct 2013 23:55:08 +0000 (09:55 +1000)]
Use AC_MSG_RESULT to print the few configuration options
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Tue, 1 Oct 2013 23:40:43 +0000 (09:40 +1000)]
Disable gcov by default
Having libevdev build with profiling enabled by default
leaves profiling files around. Profiling is something that only
libevdev developers should need, so let them enable it
case-by-case.
https://bugzilla.redhat.com/show_bug.cgi?id=1012180
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Stephen Kitt [Sun, 22 Sep 2013 17:34:24 +0000 (19:34 +0200)]
Avoid shipping generated documentation twice
Only add files to EXTRA_DIST, to avoid having a full copy of doc/html as
doc/html/html in the distributed tarball.
Signed-off-by: Stephen Kitt <skitt@debian.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 18 Sep 2013 22:32:00 +0000 (08:32 +1000)]
Add extern C guards to libevdev-uinput.h
Reported-by: Stanisław Halik <sthalik@misaki.pl>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 18 Sep 2013 22:31:33 +0000 (08:31 +1000)]
Capitalize uinput header guards
victim of some overly vicious search/replace
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 18 Sep 2013 04:38:26 +0000 (14:38 +1000)]
libevdev 0.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 18 Sep 2013 04:37:35 +0000 (14:37 +1000)]
Print an error on an invalid log priority
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 18 Sep 2013 01:44:06 +0000 (11:44 +1000)]
Merge branch 'clockid'
Peter Hutterer [Tue, 17 Sep 2013 10:10:18 +0000 (20:10 +1000)]
tools: make to function calls static
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 17 Sep 2013 02:26:21 +0000 (12:26 +1000)]
Fix a typo in the uinput documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 17 Sep 2013 01:59:38 +0000 (11:59 +1000)]
Move libevdev_led_value documentation to the kernel group
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Colin Walters [Mon, 16 Sep 2013 12:27:40 +0000 (08:27 -0400)]
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>
Peter Hutterer [Mon, 16 Sep 2013 06:00:06 +0000 (16:00 +1000)]
Drop duplicate compiler flag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 16 Sep 2013 05:55:10 +0000 (15:55 +1000)]
Revert "Reintroduce -fstack-protector"
http://lists.freedesktop.org/archives/input-tools/2013-September/000332.html
See above a detailed reasoning, but Colin Walters put it this way:
"At a high level, I think components (git repositories) should feel free
to set up default warning flags and possibly use a targeted subset of
-Werror=foo. But please don't inject non-warning flags like this unless
there is a very good reason.
The right way to do -fstack-protector is to have something like
redhat-rpm-config or other global CFLAGS system controlling *all*
components."
Thus, reverting the -fstack-protector flag. This doesn't completely address
Colin's comments, we still use a few other flags. But this one is the one
that causes real headaches, so drop it.
This reverts commit
f5e65ea3ce2541fe8ccfafe9b0dd04325da75b34.
David Herrmann [Thu, 12 Sep 2013 16:07:54 +0000 (18:07 +0200)]
Reintroduce -fstack-protector
We removed this previously due to build failures in:
commit
14ac764ec86452ca607403f314b0f8355d80290c
Author: David Herrmann <dh.herrmann@gmail.com>
Date: Mon Sep 9 16:03:41 2013 +0200
build: remove -fstack-protector
Reintroduce it but this time disable it if it's not supported. We use the
CC-flags testing to prevent build-failures on gcc without libssp support.
Cc: Giovanni Campagna <gcampagn@redhat.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Thu, 12 Sep 2013 16:07:53 +0000 (18:07 +0200)]
Test for CFLAGS/LFLAGS availability
Use the CC_CHECK_FLAGS_APPEND() m4 macro to test for availability of
CFLAGS and LFLAGS. It automatically drops the unavailable flags.
This is also used by systemd, so it ought to work with ostree and other
non-standard build-environments.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 12 Sep 2013 03:42:24 +0000 (13:42 +1000)]
wrap EVIOCSCLOCKID into an API call
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Thu, 12 Sep 2013 04:03:55 +0000 (14:03 +1000)]
test: provide wrapper for fetching the devnode from a uinput test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Thu, 12 Sep 2013 04:27:28 +0000 (14:27 +1000)]
test: add a test for checking log data being passed around correctly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 12 Sep 2013 03:39:40 +0000 (13:39 +1000)]
Fix a comment to reflect the new API
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 11 Sep 2013 01:17:08 +0000 (11:17 +1000)]
Remove warning comment from FORCE_SYNC
There is a legitimate reason for clients to force a sync on the device.
X.Org drivers lose the fd when the device is disabled and re-enabled. When
the device comes back, a simple libevdev_change_fd() doesn't update the status
on the device.
Button states, etc. may have changed, etc. So a driver may call FORCE_SYNC after
re-connecting to the fd to make sure the library and the driver get the current
state of the device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Wed, 11 Sep 2013 01:04:54 +0000 (11:04 +1000)]
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>
Peter Hutterer [Wed, 11 Sep 2013 00:32:36 +0000 (10:32 +1000)]
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>
Peter Hutterer [Tue, 10 Sep 2013 23:21:32 +0000 (09:21 +1000)]
Require check 0.9.9
0.9.9 is the first released version with fixed ck_assert_* macros that don't do
multiple expansion.
http://sourceforge.net/p/check/code/596/
Reported-by: Martin Minarik <minarik11@student.fiit.stuba.sk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 11 Sep 2013 02:01:05 +0000 (12:01 +1000)]
Fix comment typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 11 Sep 2013 01:57:30 +0000 (11:57 +1000)]
doc: don't show enum values in doxygen
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 11 Sep 2013 01:47:39 +0000 (11:47 +1000)]
Add missing group assignment to a bunch of functions and enumerations
Without these, they won't show up in the documentation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 27 Aug 2013 03:33:37 +0000 (13:33 +1000)]
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>
David Herrmann [Mon, 9 Sep 2013 14:03:41 +0000 (16:03 +0200)]
build: remove -fstack-protector
If gcc is built without libssp support, it loudly fails linking due to
missing __stack_chk_*() helpers. Unfortunately, gcc isn't smart enough to
disable it automatically.
systemd recently got a CC_CHECK_FLAG_APPEND helper to work around such
issues:
http://cgit.freedesktop.org/systemd/systemd/tree/m4/attributes.m4
I didn't want to add it now, so let's just drop -fstack-protector. If we
want it, we can try adding it later again.
This partially reverts:
commit
43752ec17d09b132621a86f5cbc546ca6ab9e977
Author: David Herrmann <dh.herrmann@gmail.com>
Date: Sun Sep 1 17:45:04 2013 +0200
Add some gcc/ld optimizations and magic
All other gcc/ld options are kept.
Reported-by: Giovanni Campagna <gcampagn@redhat.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Giovanni Campagna [Mon, 9 Sep 2013 12:41:11 +0000 (14:41 +0200)]
configure: add missing comma
Without that, it becomes impossible to build without gcov.
Signed-off-by: Giovanni Campagna <scampa.giovanni@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Giovanni Campagna [Mon, 9 Sep 2013 12:41:10 +0000 (14:41 +0200)]
Support GNOME Build API
By adding an autogen.sh file with NOCONFIGURE support.
Signed-off-by: Giovanni Campagna <scampa.giovanni@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 9 Sep 2013 23:59:11 +0000 (09:59 +1000)]
Merge branch 'logging-fix'
Peter Hutterer [Tue, 3 Sep 2013 06:54:44 +0000 (16:54 +1000)]
test: test for logging function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 3 Sep 2013 06:58:29 +0000 (16:58 +1000)]
Log to stderr by default
The logging we do use atm inside the library is largely
to spot application errors. Log that to stderr by default so
it doesn't get lost.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Tue, 3 Sep 2013 04:37:49 +0000 (14:37 +1000)]
Fix comment typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 2 Sep 2013 21:52:31 +0000 (07:52 +1000)]
Match the kernel define for SYN_MAX
Will be defined as 0xf in 3.12, see
http://git.kernel.org/cgit/linux/kernel/git/dtor/input.git/commit/?h=next&id=
52764fed5049655926bcecaefd52f0a415ceb105
And add the required ifdef guards for kernels before that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 3 Sep 2013 00:32:00 +0000 (10:32 +1000)]
Check for GNU ld and use the flags depending on the outcome
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Peter Hutterer [Sat, 31 Aug 2013 03:03:47 +0000 (13:03 +1000)]
Warn if there are multiple devices with the same syspath
Change to the previous code in that we continue looking at devices
even after we've found one. However, this way we can warn
the user when we can't guarantee syspath correctness.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Sat, 31 Aug 2013 02:53:36 +0000 (12:53 +1000)]
Log a few errors, specifically application bugs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Mon, 26 Aug 2013 03:24:26 +0000 (13:24 +1000)]
Drop per-device logging function, use per-library one instead
There's no need to have separate logging function for each device created.
More likely, libevdev will be hooked up once into the logging system and
expected to deal with it.
Plus, this allows us to log from the uinput code where we don't
have the context anyway.
Requires a rename to libevdev_set_log_function to avoid ABI breaks, and
while we're breaking the ABI make the logging function more sophisticated
to log line, number, etc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
David Herrmann [Sun, 1 Sep 2013 15:45:05 +0000 (17:45 +0200)]
Remove -g from default GCC_CFLAGS
-g should be set by debugging-options or in the default CFLAGS="", we
shouldn't force it in GCC_CFLAGS.
Reported-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Sun, 1 Sep 2013 15:45:04 +0000 (17:45 +0200)]
Add some gcc/ld optimizations and magic
There are several gcc/ld flags that optimize size and performance without
requiring explicit code changes. In no particular order, this adds:
- gcc -pipe to avoid temporary files and use pipes during compilation
- gcc -fno-common avoids putting uninitialized global variables not
marked as "extern" into a common section. This catches compilation
errors if we didn't mark global variables explicitly as "extern".
- gcc -fno-strict-aliasing allows us to use unions for some binary magic.
Otherwise, -O2 might assume that two different types never point at the
same memory. We currently don't rely on this but it's common practice
so avoid any non-obvious runtime errors later.
- gcc -ffunction-sections and -fdata-sections put each function and
variable into a separate section. This enables ld's --gc-sections to
drop any unused sections (sections which aren't referenced from an
exported section). This is very useful to avoid putting dead code into
DSOs. We can now link any helper function into libevdev and the linker
removes all of them if they're unused.
- gcc -fstack-protector adds small stack-corruption protectors in
functions which have big buffers on the stack (>8bytes). If the
stack-protectors are corrupted, the process is aborted. This is highly
useful to debug stack-corruption issues which often are nearly
impossible to catch without this.
- ld --as-needed drops all linked libraries that are not actually
required by libevdev. So we can link to whatever we want and the linker
will drop everything which is not actually used.
- ld -z now, resolve symbols during linking, not during runtime.
- ld -z relro, add relocation-read-only section. This allows to put
read-only global variables and alike into a read-only section. This is
useful for variables that need a relocation and thus cannot be
explicitly put into a read-only section. This option tells the linker
to mark them read-only after relocations are done. (that's why -z now
makes sense in combination with this)
All of these options are common in other open-source projects, including
systemd and weston. Don't ask me why they are not marked as default..
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Sat, 31 Aug 2013 02:59:27 +0000 (12:59 +1000)]
uinput: don't try to set the syspath twice
If we have it, stop searching for it. Otherwise a second device with the
same name would overwrite the first, causing a leak.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Sat, 31 Aug 2013 02:37:14 +0000 (12:37 +1000)]
Return -EBADF for functions that need the fd initialized
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Sat, 31 Aug 2013 02:33:33 +0000 (12:33 +1000)]
Return EBADF when trying to read from an uninitalized device
All other functions that check the fd for validity return EBADF, which also makes it
easier to debug if the actual device goes away.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Sat, 31 Aug 2013 02:23:44 +0000 (12:23 +1000)]
Use ENOMEM instead of ENOSPC
From errno(3):
ENOMEM Not enough space (POSIX.1)
ENOSPC No space left on device (POSIX.1)
when we run out memory the reason is a failed malloc, for which ENOMEM
seems more appropriate.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Fri, 30 Aug 2013 00:21:01 +0000 (10:21 +1000)]
test: update to test for the various _MAX values
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Thu, 29 Aug 2013 05:52:54 +0000 (15:52 +1000)]
memcpy instead of invidual bittoggle
The ioctls return the number of bytes copied into the destination, so just
copy them into the device state instead of individually flipping bits.
For easier review: rc is the return value of the EVIOCG* ioctl, which is
the number of bytes copied.
state variables must be initialized to 0 now, in case the kernel's FOO_MAX
is smaller than libevdev's FOO_MAX. If not initialized to 0, the bytes
between the two max values is undefined and we may end up generating bogus
events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Fri, 30 Aug 2013 00:12:30 +0000 (10:12 +1000)]
test: add a test for uinput device properties
Specifically, test for INPUT_PROP_MAX, which is a valid property value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Thu, 29 Aug 2013 05:38:53 +0000 (15:38 +1000)]
Fix off-by-one errors when dealing with *_MAX values.
LED_MAX, KEY_MAX, ABS_MT_MAX, etc. are all valid event codes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Mon, 26 Aug 2013 03:08:12 +0000 (13:08 +1000)]
Use AC_USE_SYSTEM_EXTENSIONS
Defines _GNU_SOURCE for us.
http://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Posix-Variants.html
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 29 Jul 2013 02:15:07 +0000 (12:15 +1000)]
test: fix ev_rep test for new uinput implementation
We can actually set EV_REP values now, though with limitations
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Mon, 29 Jul 2013 03:50:41 +0000 (13:50 +1000)]
test: switch udev backend over to new libevdev-uinput bits
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 26 Jul 2013 04:35:54 +0000 (14:35 +1000)]
test: add uinput creation tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Peter Hutterer [Thu, 25 Jul 2013 05:56:11 +0000 (15:56 +1000)]
Add support for uinput device creation
This lets libevdev provide a relatively generic interface for the
creation of uinput devices so we don't need to duplicate this across
multiple projects.
Most of this is lifted from the current test implementation, with a
couple of minor changes.
EV_REP needs special handling:
Kernel allows to set the EV_REP bit, it doesn't set REP_* bits (which we
wrap anyway) but it will also set the default values (500, 33).
Device node is guessed based on the sysfs path:
The sysfs path contains a eventN file, that corresponds to our
/dev/input/eventN number. Use it so clients can quickly get the device
node, without a libudev dependency.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 29 Aug 2013 01:53:59 +0000 (11:53 +1000)]
Fix two signed vs unsigned int warnings
dev->num_slots is -1 if we don't have ABS_MT_SLOT.
Set dev->grabbed to the right field type.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 23 Aug 2013 00:42:10 +0000 (10:42 +1000)]
Actually use the gcc CFLAGS set in configure
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 29 Aug 2013 01:50:09 +0000 (11:50 +1000)]
Mark all external symbols with LIBEVDEV_EXPORT
GCC_CFLAGS was set by configure, but never actually used. So we didn't build with hidden symbols,
rather just weeded them out later through libtool.
Do this properly now, mark the symbols as visibility default.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>