platform/upstream/libevdev.git
10 years agoDocumentation fix, refer to correct function
Peter Hutterer [Wed, 4 Dec 2013 10:03:24 +0000 (20:03 +1000)]
Documentation fix, refer to correct function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoFix a typo in the documentation
Peter Hutterer [Wed, 4 Dec 2013 09:46:50 +0000 (19:46 +1000)]
Fix a typo in the documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agobuild: set aux-dir
David Herrmann [Mon, 4 Nov 2013 14:43:57 +0000 (15:43 +0100)]
build: set aux-dir

If we don't set AUX_DIR, I get errors during ./configure:
  /bin/sh: /home/david/missing: No such file or directory
  configure: WARNING: 'missing' script is too old or missing

This error is ignored by default, but may cause failures with newer
autoconf versions. Simply set the AUX_DIR to "build-aux" like many other
autotools projects do.

[This is an automake 1.14 bug, see the upstream report:
http://lists.gnu.org/archive/html/bug-automake/2013-11/msg00007.html]

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>
10 years agoDrop some leftover deprecated constants.
Peter Hutterer [Thu, 28 Nov 2013 07:50:36 +0000 (17:50 +1000)]
Drop some leftover deprecated constants.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest-compile-pedantic: replace -Wpedantic with -pedantic
Gaetan Nadon [Mon, 25 Nov 2013 16:13:02 +0000 (11:13 -0500)]
test-compile-pedantic: replace -Wpedantic with -pedantic

-Wpedantic is a relatively new option, with -pedantic being the old version of
it that works on older gcc versions too.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: specifying builddir is not required
Gaetan Nadon [Mon, 25 Nov 2013 16:08:26 +0000 (11:08 -0500)]
doxygen: specifying builddir is not required

For the scenarios the module supports it is not required to
be specified.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: fix 'dist' when the html docs have not yet been built
Gaetan Nadon [Sun, 24 Nov 2013 13:02:33 +0000 (08:02 -0500)]
doxygen: fix 'dist' when the html docs have not yet been built

The reason why this did not work is that we do not have a fixed list
of html doc files and it would be  pain to maintain.

The 'find' hack gets a list of html files but only when the package
has already been built. Let's complement this hack with the
html/index.html file which act as a build trigger as it is the target name.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: fix rebuild when not necessary
Gaetan Nadon [Sun, 24 Nov 2013 13:02:30 +0000 (08:02 -0500)]
doxygen: fix rebuild when not necessary

Everytime make is invoked, doxygen is invoked to generate the html doc.

Dependencies are added so it does rebuild when necessary.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: fix error msg: 'find: `html': No such file or directory'
Gaetan Nadon [Sun, 24 Nov 2013 13:02:29 +0000 (08:02 -0500)]
doxygen: fix error msg: 'find: `html': No such file or directory'

Every time a make target is run in the doc directory when the html dir
is absent, you get this error. Even with 'make clean'.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: remove redundant "dist_noinst_DATA = libevdev.doxygen.in" statement
Gaetan Nadon [Sun, 24 Nov 2013 13:02:28 +0000 (08:02 -0500)]
doxygen: remove redundant "dist_noinst_DATA = libevdev.doxygen.in" statement

All .in files in AC_CONFIG_FILES are distributed.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: implement silent rules in the makefile
Gaetan Nadon [Sun, 24 Nov 2013 13:02:27 +0000 (08:02 -0500)]
doxygen: implement silent rules in the makefile

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: invocation of doxygen fails due to hard coded path
Gaetan Nadon [Sun, 24 Nov 2013 13:02:26 +0000 (08:02 -0500)]
doxygen: invocation of doxygen fails due to hard coded path

The makefile does not use $(DOXYGEN) variable.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoxygen: libevdev.doxygen must not be distributed
Gaetan Nadon [Sun, 24 Nov 2013 13:02:25 +0000 (08:02 -0500)]
doxygen: libevdev.doxygen must not be distributed

It reflects the values on the build machine.
Same pattern as libevdev.pc vs libevdev.pc.in.

For example, in libevdev.doxygen:
HTML_EXTRA_STYLESHEET  = ./libevdev.css

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: add a build test for -Wpedantic
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>
10 years agoDrop semicolons after getter/setter macros
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>
10 years agoDrop trailing comma from last element in the enums
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>
10 years agoDrop deprecated functions
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>
10 years agolibevdev 0.5 libevdev-0.5
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>
10 years agopython: request version 2.6 or higher
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>
10 years agoconfigure.ac: remove redundant AC_SUBST(PYTHON)
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>
10 years agoconfigure.ac: AC_PROG_CC_C99: use C99 compiler
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>
10 years agoconfigure.ac: add copyright statement
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>
10 years agoconfigure.ac: AC_INIT: add bug report url
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>
10 years agoautogen.sh: remove unneeded m4 configuration workaround
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>
10 years agoautogen.sh: fix broken out-of-source tree building
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>
10 years agoReview/update .gitignore files
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>
10 years agoDrop gcov flags from main libevdev sources
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>
10 years agobuild: check for build/link flags harder
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>
10 years agoUpdate COPYING file.
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>
10 years agobuild: set AC_CONFIG_SRCDIR
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>
11 years agoProvide separate lookup functions for zero-terminated strings
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>
11 years agoAdd name-resolver unit tests
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>
11 years agoAdd libevdev_event_type/code_from_name() resolvers
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>
11 years agoCreate event type/code lookup tables
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>
11 years agoAdd startswith() helper
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>
11 years agoFix wrong libevdev clock test
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>
11 years agoRequire autoconf 2.62
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>
11 years agoCheck max to see if an event type is valid
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>
11 years agoMake sure EV_SYN is always set
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>
11 years agoDisallow disabling EV_SYN event codes
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>
11 years agoReset the struct on set_fd
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>
11 years agoRevert "Check for linux/input.h during configure"
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.

11 years agoDocument backwards-compatibility behaviour
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>
11 years agoWork around missing EVIOCGMTSLOTS ioctl
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>
11 years agoMake uinput-code backwards-compatible to missing UI_SET_PROPBIT ioctl
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>
11 years agoWhen running against a kernel without properties, continue as usual
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>
11 years agoPass linux/input.h as argument to make-event-names.py
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>
11 years agoAdd a copy of linux/input.h
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>
11 years agoconfigure: test for python and python-argparse
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>
11 years agoDon't allow a negative fd in libevdev_set_fd
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>
11 years agoAllow -1 as valid fd in libevdev_change_fd
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>
11 years agoCheck for linux/input.h during configure
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>
11 years agoUppercase #define LIBEVDEV_INT_H
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>
11 years agoNote that libevdev_change_fd requires a LIBEVDEV_FORCE_SYNC
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>
11 years agoMark three deprecated functions as such
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>
11 years agoUse AC_MSG_RESULT to print the few configuration options
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>
11 years agoDisable gcov by default
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>
11 years agoAvoid shipping generated documentation twice
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>
11 years agoAdd extern C guards to libevdev-uinput.h
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>
11 years agoCapitalize uinput header guards
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>
11 years agolibevdev 0.4 libevdev-0.4
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>
11 years agoPrint an error on an invalid log priority
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>
11 years agoMerge branch 'clockid'
Peter Hutterer [Wed, 18 Sep 2013 01:44:06 +0000 (11:44 +1000)]
Merge branch 'clockid'

11 years agotools: make to function calls static
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>
11 years agoFix a typo in the uinput documentation
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>
11 years agoMove libevdev_led_value documentation to the kernel group
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>
11 years agotools: Honor GCC_CFLAGS
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>
11 years agoDrop duplicate compiler flag
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>
11 years agoRevert "Reintroduce -fstack-protector"
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.

11 years agoReintroduce -fstack-protector
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>
11 years agoTest for CFLAGS/LFLAGS availability
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>
11 years agowrap EVIOCSCLOCKID into an API call
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>
11 years agotest: provide wrapper for fetching the devnode from a uinput test device
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>
11 years agotest: add a test for checking log data being passed around correctly
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>
11 years agoFix a comment to reflect the new API
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>
11 years agoRemove warning comment from FORCE_SYNC
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>
11 years agoName-space the read flags better
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>
11 years agoEnumerate libevdev_next_event() return codes
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>
11 years agoRequire check 0.9.9
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>
11 years agoFix comment typo
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>
11 years agodoc: don't show enum values in doxygen
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>
11 years agoAdd missing group assignment to a bunch of functions and enumerations
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>
11 years agoRevamp the API once again
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>
11 years agobuild: remove -fstack-protector
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>
11 years agoconfigure: add missing comma
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>
11 years agoSupport GNOME Build API
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>
11 years agoMerge branch 'logging-fix'
Peter Hutterer [Mon, 9 Sep 2013 23:59:11 +0000 (09:59 +1000)]
Merge branch 'logging-fix'

11 years agotest: test for logging function
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>
11 years agoLog to stderr by default
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>
11 years agoFix comment typo
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>
11 years agoMatch the kernel define for SYN_MAX
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>
11 years agoCheck for GNU ld and use the flags depending on the outcome
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>
11 years agoWarn if there are multiple devices with the same syspath
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>
11 years agoLog a few errors, specifically application bugs
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>
11 years agoDrop per-device logging function, use per-library one instead
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>
11 years agoRemove -g from default GCC_CFLAGS
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>
11 years agoAdd some gcc/ld optimizations and magic
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>
11 years agouinput: don't try to set the syspath twice
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>
11 years agoReturn -EBADF for functions that need the fd initialized
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>
11 years agoReturn EBADF when trying to read from an uninitalized device
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>