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>
Add support for EV_SW

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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>
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>
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>
Axis values must be int, not unsigned int

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
Rewrite libevdev_is_event_code to avoid signed/unsigned comparison

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
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>
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>
Drop deprecated API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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>
test: add test for libevdev_is_event_code(EV_SYN...)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add C++ header guards

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
configure.ac: Drop a superfluous variable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
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>
Actually use the gcc CFLAGS set in configure

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>