Commit graph

38 commits

Author SHA1 Message Date
Peter Hutterer
2b2a1b0eb9 Add udev bits to assign LIBINPUT_DEVICE_GROUP
The easiest way to get a device group is by looking at the phys path of the
input device (which looks like usb-0000:00:14.0-1/input1) and dropping the
/inputX bit. The rest is the same for devices that belong together (except on
the Cintiq 22HD Touch).

Ideally we could just take ATTRS{phys} but we can't select substrings to drop
into ENV so we need to do it ourselves. This patch adds a callout that takes a
syspath and prints the mangled path, to be used in LIBINPUT_DEVICE_GROUP.

The rule triggers on any device that has a non-zero phys attribute, this
groups devices like tablets together but also devices like mice with multiple
interfaces.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-02-18 10:08:29 +10:00
Marek Chalupa
a9f216ab47 add simple symbols leak checker
This patch adds simple script that compares libinput.sym file to the
functions that are marked by LIBINPUT_EXPORT. This script is added
to make check target.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-13 10:20:44 +10:00
Peter Hutterer
ca4e03fb11 configure.ac: libinput 0.10.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-06 10:33:02 +10:00
Peter Hutterer
4ec2947cc9 test: add per-device udev rule support
Don't rely on a magic version tag, instead let a device define a udev rule and
drop that into the udev runtime directory before the device is created.

There are a couple of caveats with this approach: first, since this changes
system-wide state it may cause issues on the device the test suite is run on.
This can be avoided if the udev rules have filter patterns that ensure only
test devices are affected.

Second, the check test suite aborts but it doesn't run the teardown() function
if a test fails. So far this wasn't a problem since uinput devices disappear
whenever we exit. The rules files will hang around though, so an unchecked
fixture was added to delete all litest-foo.rules files before and after a test
case starts. Unchecked fixtures are run regardless of the exit status of the
test but run in the same address space - i.e. no ck_assert() usage.

Also unchecked fixtures are only run once per test-case, not once per test
function. For us, that means they're only run once per device (we use the
devices as test case), i.e. if a test fails and the udev rule isn't tidied up,
the next test may be unpredictable. This shouldn't matter too much though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-03 10:34:26 +10:00
Peter Hutterer
fd8a29fb69 configure.ac: libinput 0.9.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-30 14:05:01 +10:00
Peter Hutterer
c8dc81b48f configure.ac: libinput 0.8
Note: soname bump

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-15 11:48:15 +10:00
Jon A. Cruz
b853ec90d5 Added configure option for documentation build.
Added option with fallback of 'auto' to control building of documentation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-19 08:39:59 +10:00
Jon A. Cruz
0b7efd6211 Initial move of some wiki contents into main documentation.
This moves some information from the wiki into the main generated doxygen
documenation. It is fairly rought but includes examples for inline and
stand-alone diagrams, linking to external HTML pages, etc.

Among other things, it allows for better cross-referencing into the
main doxygen contents and thus for overall shorter documentation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-19 08:39:46 +10:00
Peter Hutterer
06e2f522a4 configure.ac: libinput 0.7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 14:04:22 +10:00
Peter Hutterer
1affca8d44 Split libinput-util into a noinst helper library
Fixes distcheck (automake 1.14.1)

make[2]: Entering directory '....../libinput-0.7.0/_build/test'
Makefile:926: ../src/.deps/libinput-util.Plo: No such file or directory
make[2]: *** No rule to make target '../src/.deps/libinput-util.Plo'.  Stop.
make[2]: Leaving directory '....../libinput/libinput-0.7.0/_build/test'
Makefile:412: recipe for target 'distclean-recursive' failed

That was the only place we used subdir objects, so we can drop it from
configure now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-12-05 14:04:08 +10:00
Jonas Ådahl
224f1d823b configure.ac: libinput 0.6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-09-11 22:32:51 +02:00
Jan Engelhardt
99ccc0d47a build: symbol ck_assert_ptr_ne requires check-0.9.10
openSUSE 12.3 ships with check-0.9.9 and subsequently fails to build
the tests. Change the call to look for check >= 0.9.10 where that
symbol is available.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-11 21:25:03 +02:00
Jonas Ådahl
bb10ec84d3 configure.ac: libinput 0.5
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-07-22 21:37:02 +02:00
Jonas Ådahl
a474a7648d configure.ac: Add subdir-objects to AM_INIT_AUTOMAKE paramaters
Silences a warning when running autogen.sh.

This also adds a work-around for a bug in automake
<https://lists.gnu.org/archive/html/bug-automake/2014-01/msg00005.html>
replacing $(top_srcdir) with ../ in test/Makefile.am.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-07-15 23:44:50 +02:00
Peter Hutterer
124aa9b0f8 configure: print a summary of the build options
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-03 11:17:49 +10:00
Peter Hutterer
f28eb5ecec Add -lrt to the libs
Needed for clock_gettime()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-03 09:59:43 +10:00
Peter Hutterer
5d36e8e817 configure: check for -lm through AC_CHECK_LIB
Saves us from manually appending it everywhere

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-03 09:59:43 +10:00
Peter Hutterer
d1f8a545e7 configure.ac: libinput 0.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 13:37:59 +10:00
Peter Hutterer
82e81e8790 tools: add a tool for GUI-based debugging
Looking at debugging output is nice but not useful when testing for the feel
of a device. Add a tool that presents a canvas and draws the various events
onto it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-23 14:53:27 +10:00
Peter Hutterer
63927631a4 test: silence compiler warning for C++ build test
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for
C/ObjC but not for C++ [enabled by default]

Since gcc also complains about adding -Wno-strict-prototypes we have to handle
the two separately. A side-effect here: now that we promote the GCC_CFLAGS to
AM_CFLAGS, litest.la is built with the correct CFLAGS too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-10 20:54:53 +10:00
Jonas Ådahl
4be1aa466c configure.ac: libinput 0.3
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-06-09 22:27:35 +02:00
Peter Hutterer
65a89424ca configure: simplify a condition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-30 15:18:11 +10:00
Jonas Ådahl
40bae41159 configure.ac: libinput 0.2
Bump the libinput version and the libtool version.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-05-22 08:10:42 +02:00
Jonas Ådahl
378cfb6066 configure.ac: Add libtool versioning setting to configure.ac
Add the explanatory description of the version components from libevdev
as well.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-05-22 08:09:41 +02:00
Peter Hutterer
c073003691 test: automatically run the tests against valgrind for leaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-10 11:11:56 +10:00
Jonas Ådahl
32e513226c configure.ac: Always check for C++ compiler
Even though libinput uses no C++, it should be supported to include
libinput.h from C++. Therefore a build test ensuring this possibility
exist. However, since we can not conditionally invoke AC_PROG_CXX
in configure.ac just do it always.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-29 14:39:42 +01:00
Jonas Ådahl
07750ef798 test: Add include from C++ build test 2014-03-29 00:51:44 +01:00
Jonas Ådahl
6ae636fe18 configure.ac: Bump to 0.1.0
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:54:51 +01:00
Jonas Ådahl
edd792ab6e configure.ac: Update URLs
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:54:27 +01:00
Peter Hutterer
f925cee8df Hook up libevdev as backend
libevdev wraps the various peculiarities of the evdev kernel API into a
type-safe API. It also buffers the device so checking for specific features at
a later time is easier than re-issuing the ioctls. Plus, it gives us almost
free support for SYN_DROPPED events (in the following patch).

This patch switches all the bit checks over to libevdev and leaves the event
processing as-is. Makes it easier to review.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-24 09:29:09 +10:00
Peter Hutterer
3444b29ceb tools: add a tool for basic event debugging
Simply prints the various events to make it easier to check what's coming out
of libinput. Works for --udev (the default) or for --device /dev/input/event0.
Example output:

event7 	DEVICE_ADDED	seat0	default
event8 	DEVICE_ADDED	seat0	default
event4 	POINTER_BUTTON	 +1.35s	272 pressed
event5 	POINTER_MOTION	 +2.31s	 -3.00/  2.00

Time is displayed relative to the starting time.

Note: statically linked for easier debugging, but we don't distribute it
(yet) anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-01-31 14:57:19 +10:00
Peter Hutterer
3a344169bb Add a device test suite
A rather large commit, copied from a similar (almost identical) suite in
libtouchpad and ported for libinput.

The goal here is to make testing for various devices easy, so the litest
("libinput test") wrappers do that. The idea is that each device has some
features, and tests are likely to exercise some features or won't work with
other features.

Each test case takes a list of required features and a list of excluded
features. The test suite will create a new test case for each device in the
suite that matches that set.

For example, the set of required LITEST_TOUCHPAD, excluded LITEST_BUTTON would
run on clickpads only, not on touchpads with buttons.

check supports suites and test cases, both named. We wrap that so that each
named set of cases we add are a test suite, with the set of devices being the
test cases. i.e.

litest_add("foo:bar", some_test_function, LITEST_ANY, LITEST_ANY);

adds a suite named "foo:bar" and test cases for both devices given, with their
shortnames as test case name, resulting in:
   "foo:bar", "trackpoint"
   "foo:bar", "clickpad"
   ...

Multiple test functions can be added to a suite. For tests without a device
requirement there is litest_add_no_device_test(...).

The environment variables CK_RUN_SUITE and CK_RUN_CASE can be used to narrow
the set of test cases. The test suite detects when run inside a debugger and
disables fork mode (the default).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-15 11:59:27 +10:00
Peter Hutterer
0049641116 Add the framework for a test suite
Just the scaffolding, no actual tests just yet

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-10 14:17:06 +10:00
Peter Hutterer
ce5a068daf configure: require c99
This enables a few nice things that gcc would otherwise not allow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:07:50 +01:00
Peter Hutterer
48608f1f6a configure: add libudev dependency
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:07:30 +01:00
Peter Hutterer
2d2df7842c doc: hook up doxygen to generate the public API documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-07 14:06:46 +01:00
Jonas Ådahl
ce787552bc Introduce libinput object managing all input data
Instead of having the user manage added and removed fd's as well as the
fd used for creating evdev devices, introduce a libinput object that
itself has an epoll fd.

The user no longer manages multiple fd's per libinput instance, but
instead handles one fd, dispatches libinput when data is available, then
reading events using libinput_get_event().

libinput_event's are now per libinstance, but divided into categories.
So far the only category is device events. Device events are categorized
by the presence of a non-NULL device pointer in the event.

The current API usage should look like:

struct libinput libinput = ...;
struct libinput_event *event;

if (libinput_dispatch(libinput) != 0)
	return -1;
while ((event = libinput_get_event(libinput))) {
	if (event->device)
		process_device_event(event);
	free(event);
}

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-17 17:03:06 +01:00
Jonas Ådahl
bd4db1c2a2 Port evdev code to be used as a shared library
This commit introduces build script configuration for building a shared
library 'libinput.so' containing the evdev input device functionality
from weston.

evdev.c, evdev.h and evdev-touchpad.c are ported to not use the data
structures and API in weston and libwayland-server in order to minimize
dependencies.

The API of filter.c and filter.h are renamed to not include the
'weston_' prefix.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-12 22:37:20 +01:00