platform/upstream/libevdev.git
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>
11 years agoUse ENOMEM instead of ENOSPC
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>
11 years agotest: update to test for the various _MAX values
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>
11 years agomemcpy instead of invidual bittoggle
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>
11 years agotest: add a test for uinput device properties
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>
11 years agoFix off-by-one errors when dealing with *_MAX values.
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>
11 years agoUse AC_USE_SYSTEM_EXTENSIONS
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>
11 years agotest: fix ev_rep test for new uinput implementation
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>
11 years agotest: switch udev backend over to new libevdev-uinput bits
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>
11 years agotest: add uinput creation tests
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>
11 years agoAdd support for uinput device creation
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>
11 years agoFix two signed vs unsigned int warnings
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>
11 years agoActually use the gcc CFLAGS set in configure
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>
11 years agoMark all external symbols with LIBEVDEV_EXPORT
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>
11 years agoFix some compiler warnings about maybe uninitialized values
Peter Hutterer [Sun, 25 Aug 2013 22:39:55 +0000 (08:39 +1000)]
Fix some compiler warnings about maybe uninitialized values

These are just to shut the compiler up, in all three cases we only access
the respective values if they're defined.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoconfigure.ac: Drop a superfluous variable
Peter Hutterer [Fri, 23 Aug 2013 04:01:34 +0000 (14:01 +1000)]
configure.ac: Drop a superfluous variable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd C++ header guards
Peter Hutterer [Fri, 23 Aug 2013 01:08:26 +0000 (11:08 +1000)]
Add C++ header guards

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: add test for libevdev_is_event_code(EV_SYN...)
Peter Hutterer [Fri, 23 Aug 2013 00:57:50 +0000 (10:57 +1000)]
test: add test for libevdev_is_event_code(EV_SYN...)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoSimplify getter/setter macros
Peter Hutterer [Fri, 23 Aug 2013 00:49:56 +0000 (10:49 +1000)]
Simplify getter/setter macros

Now that we've dropped the deprecated API, we can simplify the macros a bit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDrop deprecated API
Peter Hutterer [Fri, 23 Aug 2013 00:48:46 +0000 (10:48 +1000)]
Drop deprecated API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoFix a few signed/unsigned int comparisons
Peter Hutterer [Fri, 23 Aug 2013 00:28:57 +0000 (10:28 +1000)]
Fix a few signed/unsigned int comparisons

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAdd a note that libevdev_is_event_type/code have compile-time ranges
Peter Hutterer [Fri, 23 Aug 2013 00:26:36 +0000 (10:26 +1000)]
Add a note that libevdev_is_event_type/code have compile-time ranges

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agolibevdev_is_event_type() needs to check for < EV_CNT
Peter Hutterer [Thu, 29 Aug 2013 01:17:08 +0000 (11:17 +1000)]
libevdev_is_event_type() needs to check for < EV_CNT

EV_MAX is a valid (though unused) value.

Reported-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoRewrite libevdev_is_event_code to avoid signed/unsigned comparison
Peter Hutterer [Fri, 23 Aug 2013 00:25:08 +0000 (10:25 +1000)]
Rewrite libevdev_is_event_code to avoid signed/unsigned comparison

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUse libevdev_get_event_type_max from libevdev_get_event_code_name
Peter Hutterer [Fri, 23 Aug 2013 00:20:50 +0000 (10:20 +1000)]
Use libevdev_get_event_type_max from libevdev_get_event_code_name

This will check for invalid types for us, and we can do a better check
for signed/unsigned comparison.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAxis values must be int, not unsigned int
Peter Hutterer [Fri, 23 Aug 2013 00:15:50 +0000 (10:15 +1000)]
Axis values must be int, not unsigned int

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoIgnore -Woverride-init in event-names.h
Peter Hutterer [Thu, 22 Aug 2013 06:04:40 +0000 (16:04 +1000)]
Ignore -Woverride-init in event-names.h

Having the declarations in the form of [0...EV_MAX] = NULL together
with the actual definitions causes warnings for every true definition if
-Woverride-init is enabled.

We can drop them for most as they're zero, but still need them for
ev_max (which defaults to -1), not zero. So use the GCC pragma to
disable the warnings for this file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoChange event name generate script to be python 2/3 compatible
Peter Hutterer [Sun, 25 Aug 2013 22:53:46 +0000 (08:53 +1000)]
Change event name generate script to be python 2/3 compatible

Python 3 doesn't have a print statement, only a print function.

Fixed with:
  2to3 make-event-names.py | git apply

Print as function requires Python 2.6 which is reasonable enough given
that even RHEL6 ships that.

Even though it's not needed for 2.6, use
from __future__ import print_function
to avoid accidentally introducing a print statement in the future.
With this line, print "blah" is now a syntax error in python 2.
This line was added manually, after the 2to3 conversion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodoc: actually package generated documentation
Peter Hutterer [Tue, 27 Aug 2013 01:42:48 +0000 (11:42 +1000)]
doc: actually package generated documentation

Previous find command wouldn't actually list the generated documentation
files, so they'd be missing in the tarball.

...and add a dist-hook to make sure this won't happen during release.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAdd support for EV_SW
Peter Hutterer [Wed, 14 Aug 2013 09:52:25 +0000 (19:52 +1000)]
Add support for EV_SW

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAvoid under-allocation of array for syncing key/led state
Peter Hutterer [Mon, 26 Aug 2013 22:03:17 +0000 (08:03 +1000)]
Avoid under-allocation of array for syncing key/led state

No functional effect as the size would end up being the same anyway
due to the values of KEY_MAX and LED_MAX.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoRemove unneeded include of linux/uinput.h
Peter Hutterer [Mon, 26 Aug 2013 03:10:05 +0000 (13:10 +1000)]
Remove unneeded include of linux/uinput.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoMerge branch 'led-handling'
Peter Hutterer [Sun, 25 Aug 2013 23:53:10 +0000 (09:53 +1000)]
Merge branch 'led-handling'

11 years agoRename enums to match lower_case format
Peter Hutterer [Wed, 14 Aug 2013 00:17:59 +0000 (10:17 +1000)]
Rename enums to match lower_case format

This is technically an API, but not an ABI change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
11 years agoStore the abs value after handling mt events
Peter Hutterer [Thu, 15 Aug 2013 01:10:17 +0000 (11:10 +1000)]
Store the abs value after handling mt events

This way any ABS_MT_ event value that comes in will also be stored in abs_info.
That always corresponds to "current slot", so if a user calls
libevdev_set_event_value() or libevdev_get_event_value() they're actually
modifying the current slot value.

When the current slot changes, sync the state back into the absinfo values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agowrite EV_SYN input_event along with led events to device
polyphemus [Fri, 9 Aug 2013 15:38:51 +0000 (17:38 +0200)]
write EV_SYN input_event along with led events to device

Other clients of an evdev device need to have the events they receive
be separated, in moment in time, from other events by an EV_SYN/
SYN_REPORT. This is the responsibility of the client who writes events
into the stream.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoFix build without MSC_TIMESTAMP
Martin Minarik [Fri, 23 Aug 2013 17:47:55 +0000 (19:47 +0200)]
Fix build without MSC_TIMESTAMP

To build with older input.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoPass --no-print-directory to make
David Herrmann [Sat, 17 Aug 2013 11:58:18 +0000 (13:58 +0200)]
Pass --no-print-directory to make

The "Entering/Leaving directroy /xyz" messages only add noise to
make-output. Even without we still get short hints which directory is
currently processed. Compare the two outputs below:

With --no-print-directory added:
  make --no-print-directory all-recursive
  Making all in doc
  doxygen libevdev.doxygen
  Making all in libevdev
  python2 ./make-event-names.py --output=c > event-names.h
  make  all-am
    CC       libevdev.lo
    CCLD     libevdev.la
  Making all in tools
    CC       libevdev-events.o
    CCLD     libevdev-events
  Making all in test
    CC       test-main.o
    CC       test-event-names.o
    CC       test-libevdev-init.o
    CC       test-libevdev-has-event.o
    CC       test-int-queue.o
    CC       test-libevdev-events.o
    CC       libevdev.o
    CC       test-common-uinput.o
    CC       test-common.o
    CCLD     test-libevdev

Without it:
  make  all-recursive
  make[1]: Entering directory `/home/david/dev/libevdev'
  Making all in doc
  make[2]: Entering directory `/home/david/dev/libevdev/doc'
  doxygen libevdev.doxygen
  make[2]: Leaving directory `/home/david/dev/libevdev/doc'
  Making all in libevdev
  make[2]: Entering directory `/home/david/dev/libevdev/libevdev'
  python2 ./make-event-names.py --output=c > event-names.h
  make  all-am
  make[3]: Entering directory `/home/david/dev/libevdev/libevdev'
    CC       libevdev.lo
    CCLD     libevdev.la
  make[3]: Leaving directory `/home/david/dev/libevdev/libevdev'
  make[2]: Leaving directory `/home/david/dev/libevdev/libevdev'
  Making all in tools
  make[2]: Entering directory `/home/david/dev/libevdev/tools'
    CC       libevdev-events.o
    CCLD     libevdev-events
  make[2]: Leaving directory `/home/david/dev/libevdev/tools'
  Making all in test
  make[2]: Entering directory `/home/david/dev/libevdev/test'
    CC       test-main.o
    CC       test-event-names.o
    CC       test-libevdev-init.o
    CC       test-libevdev-has-event.o
    CC       test-int-queue.o
    CC       test-libevdev-events.o
    CC       libevdev.o
    CC       test-common-uinput.o
    CC       test-common.o
    CCLD     test-libevdev
  make[2]: Leaving directory `/home/david/dev/libevdev/test'
  make[2]: Entering directory `/home/david/dev/libevdev'
  make[2]: Leaving directory `/home/david/dev/libevdev'
  make[1]: Leaving directory `/home/david/dev/libevdev'

We don't really win any useful information from these messages.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoRemove deprecated SYMBOL_CACHE_SIZE from doxygen.in
David Herrmann [Sat, 17 Aug 2013 11:58:17 +0000 (13:58 +0200)]
Remove deprecated SYMBOL_CACHE_SIZE from doxygen.in

SYMBOL_CACHE_SIZE was removed in newer doxygen releases. We use the
default value, so simply drop it.

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 -I m4 to ACLOCAL_AMFLAGS
David Herrmann [Sat, 17 Aug 2013 11:58:14 +0000 (13:58 +0200)]
Add -I m4 to ACLOCAL_AMFLAGS

We put m4 files into a separate directory. If we ever put our own files in
there, we need to include it. Furthermore, this suppresses annoying
autotools warnings.

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 functions to toggle LEDs on the device
Peter Hutterer [Fri, 9 Aug 2013 03:21:28 +0000 (13:21 +1000)]
Add functions to toggle LEDs on the device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoKeep the LED state and sync it after SYN_DROPPED
Peter Hutterer [Tue, 13 Aug 2013 23:29:41 +0000 (09:29 +1000)]
Keep the LED state and sync it after SYN_DROPPED

This enables libevdev_get_event_value(dev, EV_LED, LED_NUML); to check
if a LED is on or off.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAdd setters for an event or slot value
Peter Hutterer [Fri, 9 Aug 2013 04:46:24 +0000 (14:46 +1000)]
Add setters for an event or slot value

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoRename libevdev_kernel_set_abs_value to libevdev_kernel_set_abs_info
Peter Hutterer [Fri, 9 Aug 2013 03:47:00 +0000 (13:47 +1000)]
Rename libevdev_kernel_set_abs_value to libevdev_kernel_set_abs_info

Keep it in line with the non-kernel setter

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoSync the key state on startup
Peter Hutterer [Tue, 13 Aug 2013 23:44:21 +0000 (09:44 +1000)]
Sync the key state on startup

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoSimplify a bit state setter
Peter Hutterer [Tue, 13 Aug 2013 23:15:51 +0000 (09:15 +1000)]
Simplify a bit state setter

set_bit_state does exactly what the previous if/else did.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoMinor documentation improvement
Peter Hutterer [Wed, 14 Aug 2013 00:22:24 +0000 (10:22 +1000)]
Minor documentation improvement

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: devices with abs axes need to be created properly
Peter Hutterer [Mon, 29 Jul 2013 03:38:28 +0000 (13:38 +1000)]
test: devices with abs axes need to be created properly

Simply enabling the bits is not enough, we need to provide axis
information too if we want to enable this properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoMake the tests optional to drop unneeded dependencies
Peter Hutterer [Mon, 29 Jul 2013 04:27:41 +0000 (14:27 +1000)]
Make the tests optional to drop unneeded dependencies

libevdev has no external dependencies and both check and libudev are
only required for running the unit-tests. Make them optional.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agotest: change device for enabling/disabling bits to use REL_*
Peter Hutterer [Mon, 29 Jul 2013 03:34:48 +0000 (13:34 +1000)]
test: change device for enabling/disabling bits to use REL_*

No real effect on the test, this check is just so that a follow-up patch to
fix the tests for the new uinput backend is a bit easier to review.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoFix stray * in documentation
Peter Hutterer [Fri, 9 Aug 2013 04:35:45 +0000 (14:35 +1000)]
Fix stray * in documentation

11 years agolibevdev 0.3 libevdev-0.3
Peter Hutterer [Thu, 8 Aug 2013 03:21:04 +0000 (13:21 +1000)]
libevdev 0.3

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix header guard, lowercased in some previous search/replace
Peter Hutterer [Thu, 8 Aug 2013 03:04:11 +0000 (13:04 +1000)]
Fix header guard, lowercased in some previous search/replace

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd setters for product/vendor/bustype/version
Peter Hutterer [Thu, 25 Jul 2013 06:21:32 +0000 (16:21 +1000)]
Add setters for product/vendor/bustype/version

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoRename ID getters to have a consistent naming scheme
Peter Hutterer [Thu, 1 Aug 2013 03:22:07 +0000 (13:22 +1000)]
Rename ID getters to have a consistent naming scheme

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoReplace ID getter implementation with a define
Peter Hutterer [Tue, 30 Jul 2013 03:48:55 +0000 (13:48 +1000)]
Replace ID getter implementation with a define

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoProvide setters for name, phys, uniq
Peter Hutterer [Thu, 25 Jul 2013 06:11:04 +0000 (16:11 +1000)]
Provide setters for name, phys, uniq

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAdd abs setters for changing a single value on an abs axis
Peter Hutterer [Wed, 24 Jul 2013 05:52:02 +0000 (15:52 +1000)]
Add abs setters for changing a single value on an abs axis

Changing a single value on an abs axis is slightly more common than
having to enable that axis outright. Provide a set of accessors for
doing so.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoRename a few getters for consistency
Peter Hutterer [Tue, 30 Jul 2013 01:25:00 +0000 (11:25 +1000)]
Rename a few getters for consistency

Deprecated:
* libevdev_get_abs_min, libevdev_get_abs_max
* libevdev_get_input_prop_name

Will be removed in one or two versions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoReplace libevdev_get_abs_* with macro-generated ones
Peter Hutterer [Thu, 25 Jul 2013 03:06:23 +0000 (13:06 +1000)]
Replace libevdev_get_abs_* with macro-generated ones

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAdd setter for property bits
Peter Hutterer [Mon, 29 Jul 2013 05:34:37 +0000 (15:34 +1000)]
Add setter for property bits

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agotest: check for enabling REL_X with data
Peter Hutterer [Mon, 29 Jul 2013 04:35:52 +0000 (14:35 +1000)]
test: check for enabling REL_X with data

Only EV_REP and EV_ABS accept data.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAdd libevdev_has_event_pending()
Peter Hutterer [Wed, 24 Jul 2013 03:37:53 +0000 (13:37 +1000)]
Add libevdev_has_event_pending()

Returns non-zero if there are events avialable to be read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agodoc: fix css for notes and return values
Peter Hutterer [Tue, 30 Jul 2013 23:48:44 +0000 (09:48 +1000)]
doc: fix css for notes and return values

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoWhen enabling EV_REP, set the delay/period values
Peter Hutterer [Mon, 29 Jul 2013 01:46:01 +0000 (11:46 +1000)]
When enabling EV_REP, set the delay/period values

Just enabling EV_REP sets them to zero, but when enabling them directly,
a value is required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoMake sure all EV_REP bits are set
Peter Hutterer [Mon, 29 Jul 2013 02:04:58 +0000 (12:04 +1000)]
Make sure all EV_REP bits are set

Current code was skipping REP_PERIOD

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoSet the size for repeat delays based on REP_CNT
Peter Hutterer [Mon, 29 Jul 2013 01:45:30 +0000 (11:45 +1000)]
Set the size for repeat delays based on REP_CNT

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoDon't try setting an ABS code without data
Peter Hutterer [Fri, 26 Jul 2013 06:53:04 +0000 (16:53 +1000)]
Don't try setting an ABS code without data

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agoAllow enabling of EV_SYN codes
Peter Hutterer [Fri, 26 Jul 2013 06:51:17 +0000 (16:51 +1000)]
Allow enabling of EV_SYN codes

Has no effect, but allow it nonetheless to avoid superfluous
conditions in client code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agotest: drop some superfluous dev creation
Peter Hutterer [Mon, 29 Jul 2013 02:36:42 +0000 (12:36 +1000)]
test: drop some superfluous dev creation

copy/paste residue, had no effect

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agogitignore: ignore gcov, ctags, announce emails
Peter Hutterer [Mon, 29 Jul 2013 03:32:41 +0000 (13:32 +1000)]
gitignore: ignore gcov, ctags, announce emails

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 years agolibevdev 0.2.1 libevdev-0.2.1
Peter Hutterer [Wed, 24 Jul 2013 23:00:42 +0000 (09:00 +1000)]
libevdev 0.2.1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix name and version in pkgconfig file
Peter Hutterer [Tue, 23 Jul 2013 21:19:12 +0000 (07:19 +1000)]
Fix name and version in pkgconfig file

evdev_read was an earlier name for this library.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agolibevdev 0.2 libevdev-0.2
Peter Hutterer [Sun, 21 Jul 2013 22:16:07 +0000 (08:16 +1000)]
libevdev 0.2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodoc: fix two doxygen include paths to be source-relative
Peter Hutterer [Mon, 22 Jul 2013 00:49:36 +0000 (10:49 +1000)]
doc: fix two doxygen include paths to be source-relative

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd libevdev.css to EXTRA_DIST
Peter Hutterer [Mon, 22 Jul 2013 00:44:23 +0000 (10:44 +1000)]
Add libevdev.css to EXTRA_DIST

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoPoint to new API documentation URL
Peter Hutterer [Sun, 21 Jul 2013 22:31:36 +0000 (08:31 +1000)]
Point to new API documentation URL

And fix up the tool to publish it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDocument mailing list
Peter Hutterer [Sun, 21 Jul 2013 22:20:46 +0000 (08:20 +1000)]
Document mailing list

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoChange github.com references to freedesktop.org
Peter Hutterer [Wed, 17 Jul 2013 01:05:08 +0000 (11:05 +1000)]
Change github.com references to freedesktop.org

Except for the API documentation, that'll stay on github for now until
I figure out where to put it (and have the space to put it in).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: add uinput prop bits and the test for it
Peter Hutterer [Wed, 10 Jul 2013 23:09:14 +0000 (09:09 +1000)]
test: add uinput prop bits and the test for it

Turns out I was looking at an old header file, UI_SET_PROPBIT
has existed for quite a while.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>