Commit graph

2584 commits

Author SHA1 Message Date
Peter Hutterer
1cfa1f64cf evdev: read LIBINPUT_ATTR_KEYBOARD_INTEGRATION property
We have heuristics for detecting whether a keyboard is internal or external,
but in some cases (e.g. Surface 3) these heuristics fail. Add a udev property
that we can apply to these cases so we have something that's reliable.

This will likely eventually become ID_INPUT_KEYBOARD_INTEGRATION as shipped by
systemd, similar to the touchpad property.

https://bugs.freedesktop.org/show_bug.cgi?id=101101

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Peter Hutterer
782a0661d1 lid: add a comment for why we post the switch state there
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:09:40 +10:00
Peter Hutterer
a2a8db261a Merge branch 'wip/libinput-tool-v2' 2017-05-23 13:37:06 +10:00
Peter Hutterer
1daaa07fc3 test: tighten the wakeup-on-key lid test
Having a litest_wait_for_event_of_type() in there causes us to silently
discard anything but the events we're looking for. This is risky, we want to
make sure that if we re-enable the lid that the key events arrive *after* the
lid open event, not before. So let's not paper over those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 13:03:42 +10:00
Peter Hutterer
3f6b97d4c4 test: fix a lid test
We were checking for the empty queue on the wrong context, the default context
got drained a few lines above.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 13:03:39 +10:00
Peter Hutterer
78a810cfd5 Remove write-only CYAPA model tag
Obsolete since we moved pressure into the hwdb in
8d5f4decb4

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-22 13:25:46 +10:00
Peter Hutterer
bcf5eef127 meson: define the various files litest needs to copy rules/hwdb in place
This was motivated by the need to run the test runner from any directory, so
we need absolute paths to the files we copy.

Unfortunately, we can't get the absolute path from the object returned by
configure_file() and we can't feed that directly into join_paths() either.
So let' make it at least easier to handle: create a configure_file for all the
files we need (so they all end up in builddir/) and simply hardcode the name
for join_paths. Define the lot in config.h, no need to pass compiler flags
around.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-18 10:02:33 +10:00
Peter Hutterer
f3107a78e0 tools: hook libinput-debug-events into the libinput tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-18 09:24:22 +10:00
Peter Hutterer
ed72e2bcfb tools: add a 'libinput' tool
This tool will eventually replace the different libinput tools we ship atm
with the various functionalities being commands to the single tool, rather
than multiple tools.

Right now, we still build both tools separately.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-18 09:24:18 +10:00
Peter Hutterer
d2c7f73d6d tools: rename a source file to match the future common file name paradigm
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-18 09:24:14 +10:00
Peter Hutterer
863fd1f0eb tools: drop libshared.la
Include the source files directly, we'll need per-target compiler flags that
affect different tools differently in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-18 09:24:10 +10:00
Gabriel Laskar
20f5f2d962 util: harmonize container_of() definition with linux kernel one
commit 3925936 introduced changes to container_of, this is hopefully the
last part of it.

In the linux kernel, container_of() takes a type name, and not a
variable. Without this, in some cases it is needed to declare an unused
variable in order to call container_of().

example:

	return container_of(dispatch, struct fallback_dispatch, base);

instead of:

	struct fallback_dispatch *p;
	return container_of(dispatch, p, base);

This introduce also list_first_entry(), a simple wrapper around
container_of() to retrieve the first element of a non empty list. It
allows to simplify list_for_each() and list_for_each_safe().

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-17 15:04:41 +10:00
Gabriel Laskar
cef2a09524 udev/hwdb_parser.py: use python3 from env instead of /usr/bin
python installation does not always lives in /usr/bin, this allows to
use virtualenv for example.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15 10:22:09 +10:00
Gabriel Laskar
3236ee0d90 util: use offsetof in container_of
gcc and clang supports offsetof (defined in stddef.h) as defined by C99
and POSIX.1-2001, use it in container_of.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15 10:21:51 +10:00
Peter Hutterer
695facc130 test: make the initial copy file error messages more sensible
This is most likely the first error message a developer encounters when
running the test suite and the /run/udev/rules.d directory already exists.
Make it more meaningful than the current generic integer comparison failure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15 09:02:32 +10:00
Peter Hutterer
2c818ec267 test: don't use ck_abort_msg outside of test runs
This function used to be called inside a test run a long time ago but moved to
a pre-setup stage without switching to the more generic litest_abort_msg.
The only error message we got is "check_msg.c:80: No messaging setup".

https://github.com/libcheck/check/issues/18#issuecomment-301217615

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15 09:00:16 +10:00
Peter Hutterer
235001ce0b Include config.h from event-debug.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-12 12:47:20 +10:00
Peter Hutterer
c2c97a0b01 test: install the litest device groups file
We never installed the device groups file for the tests, effectively relying
on a system copy to be installed already.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-11 11:48:39 +10:00
Peter Hutterer
c68d8531fb meson: add missing trailing slash to udev test path
Otherwise the absolute path to our test binary is invalid

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-11 11:48:39 +10:00
Peter Hutterer
211bed2c25 touchpad: pull the tap exclusion zone down to the full edge zone
This was originally left outside of the button areas in case users tap in
those zones, but we're getting false tap events in that zone.

On a 100mm touchpad, the edge zone is merely 5mm, it's acceptable to ignore
taps in that area even in the software button. We can revisit this if we see
tap detection failures in the future.

https://bugzilla.redhat.com/show_bug.cgi?id=1415796

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-05-11 10:30:04 +10:00
Eric Engestrom
368006ef40 evdev: replace null sentinel with ARRAY_SIZE
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-11 10:29:50 +10:00
Peter Hutterer
07ed6d6f92 Ensure enums are size int
Because otherwise things go boom, but unless you passed -fshort-enums this
shouldn't happen anyway. And gcc's documentation says don't do that. So don't
do that, or we'll scream at you.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-10 12:52:20 +10:00
Peter Hutterer
02fca305ed Fix va_start compiler warning
../src/libinput.c:56:17: warning: passing an object that undergoes default
argument promotion to 'va_start' has undefined behavior [-Wvarargs]

The enum's size is compiler-defined, so the enum gets promoted to whatever the
compiler chose. That promotion is undefined, so let's use an int here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-10 12:52:16 +10:00
Peter Hutterer
3925936969 util: fix container_of() macro
Fixes a bunch of warnings of the kind
../src/evdev.h:378:32: warning: variable 'f' is uninitialized when used here [-Wuninitialized]
        return container_of(dispatch, f, base);

Just typecasting NULL means we can ignore sample but for the type.

https://bugs.freedesktop.org/show_bug.cgi?id=100976

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-10 12:33:10 +10:00
Peter Hutterer
89490d2b34 util: drop GCC specifics for container_of
clang supports __typeof__ which was the only real difference. Not sure any
other compilers matter (that don't support __typeof__)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-10 12:30:50 +10:00
Peter Hutterer
e877fd605c test: suppress Python3 valgrind errors
Running through mesontest also runs parse-hwdb through valgrind and
gives us a bunch of leaks that originate within Python somewhere - we don't
care about those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-08 20:51:15 +10:00
Peter Hutterer
27c9736e27 test: disable coredumps during test suite runs
Running valgrind through mesontest produces coredumps for a lot of tests
(unclear why, the core dump merely shows a call to abort). But even without
mesontest, creating a core dump for each failed test is a bad idea - if one
fails, most likely many others fail and the coredumps quickly fill up the file
system.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-08 20:51:14 +10:00
Peter Hutterer
8dcd71b395 lid: remove the keyboard listener on remove and re-init the listener
If the event listener is added, then removed again on a lid switch on/off
event, the list is set to null. This can trigger two crashes:
* when the keyboard is removed first, the call to
  libinput_device_remove_event_listener() dereferences the null pointer
* when the switch is removed first, the call to device_destroy will find a
  remaining event listener and assert

https://bugzilla.redhat.com/show_bug.cgi?id=1440927

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-05 12:50:57 +10:00
Peter Hutterer
9d1fdb0c6d touchpad: remove the lid switch listener on device_removed
Sequence triggered by the xorg driver, but basically: if the touchpad is
destroyed before the lid switch, the event listener wasn't removed and an
assertion was triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-05 12:50:04 +10:00
Peter Hutterer
87b04a0cb2 util: add asserts with useful error messages to catch uninitialized lists
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 15:28:58 +10:00
Peter Hutterer
96fa4266d0 doc: add build instructions for meson
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:50:06 +10:00
Peter Hutterer
4f4bfae2a1 Add meson.build file
v2:
- meson 0.40 requirement
- add_project_arguments() instead of add_global_arguments()
- use cc.get_define('static_assert')
- use config.set10 and config.set_quoted instead of manual handling
- more use of join_paths
- use files() for model quirks hwdb check
- update options to all state 'true' as default instead of variations of
  'true', 'enabled' and 'yes'

v3:
- drop -Wall -Wextra and -g, let meson set that with warning_level/debug build
- add meson files to EXTRA_DIST

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:49:37 +10:00
Peter Hutterer
717fbc42c3 test: switch from #ifdef to #if HAVE_LIBUNWIND
We use #if everywhere else and it allows building with '-Wundef -Werror=undef'
to avoid accidental misuse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:49:37 +10:00
Peter Hutterer
251023b9e4 configure.ac: drop checks for a few flags
These were added in 2013 for old enterprise distributions (centos 5.5, see fdo
bz 63360), it's now 4 years later and these checks seems a bit superfluous.

If those bits are missing, compilation will fail anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:49:37 +10:00
Peter Hutterer
3c2fbabb27 test: allow running the symbols-leak-test.in script directly
With autotools, we replace the @top_srcdir@ during configure and then run teh
resulting scripts.

With meson, it's easier to just pass top-srcdir it in as argument.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2017-05-04 13:49:37 +10:00
Peter Hutterer
64cac88a9f doc: drop the explicit input from the doxygen.in
We pass in the input via the commandline, so having the files here is
misleading. Replace it with an @INPUT@ - in autotools that one is ignored but
it'll help meson.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:49:37 +10:00
Peter Hutterer
411aaa8f92 Rename man pages to .1 suffix for meson's benefit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:49:37 +10:00
Peter Hutterer
de7365bb0a doc: update build instructions for lack of autodetection
Since we dropped autodetection of features in configure, these instructions
were incorrect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:47:26 +10:00
Peter Hutterer
37397bb218 test: fix compiler warning
test-tablet.c: In function ‘proximity_in_out’:
test-tablet.c:797:20: warning: increment of a boolean expression [-Wbool-operation]
    have_tool_update++;

And tighten the test so we fail for multiple prox in events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 12:45:23 +10:00
Peter Hutterer
d187ef44aa test: undef ck_assert_double before redefining it
check 0.11 has those macros, but they don't work the same way as our homemade
ones. So for now just #undef them

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 12:43:38 +10:00
Peter Hutterer
fc470291f1 Merge branch 'wip/touchpad-tap-timestamps' 2017-05-04 11:51:36 +10:00
Peter Hutterer
61452d80c6 lid: fix some indentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-03 21:08:14 +10:00
Marcos Paulo de Souza
8584c044da touchpad: make use of use tp_for_each_touch
Instead of reimplementing a for loop every time.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-03 12:38:15 +10:00
Peter Hutterer
b4f9d7a6b5 doc: fix doxygen group for libinput_event_tablet_pad_get_time
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 15:35:52 +10:00
Peter Hutterer
2d032019b6 doc: document the event timestamps
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 15:32:19 +10:00
Paul Kocialkowski
46af543b49 udev: Add specific pressure range for the ASUS ZenBook UX21E
This adds specific pressure range values for the Elantech touchpad
found in the ASUS ZenBook UX21E.

https://bugs.freedesktop.org/show_bug.cgi?id=99975

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 10:37:52 +10:00
Paul Kocialkowski
1dfedc6995 udev: Select more generic pressure range values for Elantech touchpads
The current pressure values for Elantech touchpads are too high for
various devices and make the touchpad almost unusable on them.

Decreasing the pressure range values makes those devices usable again.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 10:37:49 +10:00
Paul Kocialkowski
6af9f8e5fb udev: Remove unused Elantech touchpad model binding
The Elantech touchpad model binding in udev is currently unused, since
pressure values were moved to a udev binding of their own.

This gets rid of the deprecated model binding.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 10:37:44 +10:00
Peter Hutterer
2b867feab7 Put a check in to make sure our events have correct timestamps
This is for debugging purposes only, we cannot guarantee that event timestamps
always go up - at least not across devices. Example: tapping on a touchpad may
delay an event until a timeout expires, but that event is then sent with the
original touch timestamps (i.e. in the past). If any other device produces
events during that timeout period, our timestamps are out-of-order.

This isn't really a bug because we are forced to do that, but for bug-fixing
it can be useful to detect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28 16:47:38 +10:00
Peter Hutterer
ea4332a6cf touchpad: add touch state debugging helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28 15:37:00 +10:00