Peter Hutterer [Mon, 1 Sep 2014 07:05:49 +0000 (17:05 +1000)]
touchpad: split handling the state into a separate function
No functional changes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 20 Aug 2014 01:11:28 +0000 (11:11 +1000)]
evdev: drop the button count when releasing keys on remove
We previously called this function only before device removal, so failing to
update the button state didn't matter. To make this function generic for the
device suspend/resume, we need to keep track of the button/key count properly.
If we have a key down multiple times on suspend though, log a bug.
The dispatch should release the keys before we even get here (functionality
added in a subsequent patch).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 30 Jan 2014 05:40:35 +0000 (15:40 +1000)]
test: add test for device suspend/resume
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 30 Jan 2014 06:33:24 +0000 (16:33 +1000)]
evdev: don't resume a removed device
A device may disappear and a new device may re-appear with the same device
node while the original device is suspended. Prevent a device resume to open
the wrong device.
In a path context, a changing syspath is the only indicator we get of the
device changing.
In a udev context, if the device was removed and libinput_dispatch() was
called, we can short-cut the syspath comparison by setting it to NULL.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 22 Aug 2014 03:40:40 +0000 (13:40 +1000)]
evdev: hook up a generic enable/disable interface for devices
The evdev fallback dispatch supports enabling and disabling devices. That's
fairly easy to support since we don't (yet) have extra event generation within
the fallback backend. Thus, we can simply close the fd and re-open it again
later.
Touchpads are currently excluded here, they generate extra events on tapping,
scrolling, and software buttons and need a more complex implementation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 15 Sep 2014 04:59:07 +0000 (14:59 +1000)]
evdev: add helper function evdev_need_mtdev
Prep work for upcoming patches
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 30 Jan 2014 06:18:55 +0000 (16:18 +1000)]
Add a config interface for enabling/disabling event generation from a device
Rather than adding a config interface to disable a device merely allow a
caller to toggle the "send events" mode on the device. If off, the device
won't send events (though further events may be received depending on the
current state of the device).
Default is enabled, i.e. the device sends events.
A special mode is added to the obvious enable/disable: disable the device when
an external mouse is connected. Once set, the device will be enabled when no
mouse is present and stop sending events otherwise. This isn't hooked up to
anything yet though.
Built into the config API is the default option of "enabled". Any device
supports this, for the obvious reason. Disabling or conditionally disabling is
left to the implementation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 30 Jan 2014 05:55:37 +0000 (15:55 +1000)]
evdev: prevent double-suspending a device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 30 Jan 2014 05:34:00 +0000 (15:34 +1000)]
evdev: factor out closing a device into evdev_suspend()
No functional changes, just prep work for an upcoming patch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 22 Aug 2014 00:41:20 +0000 (10:41 +1000)]
evdev: prefix the hw key/button bitmask with 'hw'
This bitmask reflects the hw state, prefix it accordingly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 3 Sep 2014 01:16:20 +0000 (11:16 +1000)]
touchpad: fix tap-and-drag handling for timeouts
Doing a tap-and-drag gesture but just holding the finger instead of moving
should trigger a timeout and still switchin into tap-and-drag.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 3 Sep 2014 00:57:25 +0000 (10:57 +1000)]
test: wait for events in litest_assert_button_events
Takes the onus of waiting from the caller.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 3 Sep 2014 00:53:00 +0000 (10:53 +1000)]
test: move assert_button_event to litest proper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 29 Aug 2014 04:08:46 +0000 (14:08 +1000)]
test: add litest_add_device()
For adding a litest device to an existing context.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 4 Aug 2014 02:49:59 +0000 (12:49 +1000)]
test: avoid erroneous devices to be passed into the test suites
The litest features overlap with the litest device specifiers, so it's easy to
pass in LITEST_MOUSE where LITEST_POINTER should be passed in, and vice versa.
Lacking proper type checking the best we can do here is simply move the
devices into the negative range and check for that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 1 Sep 2014 06:47:28 +0000 (16:47 +1000)]
Add a helper function for clock_gettime
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 17 Sep 2014 00:30:45 +0000 (10:30 +1000)]
test: print strerror() if uinput device creation fails
The most common error running the test suite is not running as root, but the
error message is hard to interpret. Make it more explicit when it failed,
printing the strerror of the errno.
Note that libevdev 1.3 is needed to get EACCES instead of EBADF
http://cgit.freedesktop.org/libevdev/commit/?id=
debe9b030c8069cdf78307888ef3b65830b25122
A workaround is put in place for now until libevdev 1.3 is commonplace.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 16 Sep 2014 04:30:44 +0000 (14:30 +1000)]
test: fix a jumping touch movement
touch_move_to() should usually continue from the touch_down() location
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Thu, 11 Sep 2014 20:32:51 +0000 (22:32 +0200)]
configure.ac: libinput 0.6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jan Engelhardt [Tue, 9 Sep 2014 23:32:24 +0000 (01:32 +0200)]
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>
Peter Hutterer [Tue, 9 Sep 2014 23:31:08 +0000 (09:31 +1000)]
Document the static udev configuration options we support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 9 Sep 2014 23:00:09 +0000 (09:00 +1000)]
Document LIBINPUT_CALIBRATION_MATRIX properly
Make this part of our API proper and outline the 4 most common examples.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 2 Sep 2014 14:34:48 +0000 (16:34 +0200)]
litest-alps-semi-mt: Fix compiler warnings
This fixes the following (false positive) compiler warnings:
litest-alps-semi-mt.c: In function 'alps_touch_move':
litest-alps-semi-mt.c:163:3: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
send_abs_mt_xy(d, r, b);
^
litest-alps-semi-mt.c:163:3: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
litest-alps-semi-mt.c: In function 'alps_touch_down':
litest-alps-semi-mt.c:127:3: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
send_abs_mt_xy(d, r, b);
^
litest-alps-semi-mt.c:127:3: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sun, 27 Jul 2014 21:28:31 +0000 (23:28 +0200)]
touchpad: Only break out of tap FSM for clickpad button presses
It should be possible to initiate a drag by tapping-drag, but continue
it by pressing a physical button continuing to drag by subsequent finger
motions.
As the generic evdev layer helps us ignore multiple button presses we
can have the tap machine run completely separate from and uneffected by
regular physical button presses, making the tap FSM much simpler than
adding new states for handling button presse life times from outside
of the tap state machine.
A touchpad test is updated to test click while tapping instead of tap
FSM break out. The updated test is re-added but only for clickpads only.
The tap FSM svg is updated to say "clickpad button press" instead of
"phys button press".
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 1 Sep 2014 02:40:59 +0000 (12:40 +1000)]
test: use the evironment variable for check's verbosity
Allows to set CK_VERBOSITY to be set to "silent", "minimal", "normal", or
"verbose". Falls back to CK_NORMAL if unset.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 1 Sep 2014 02:39:38 +0000 (12:39 +1000)]
test: fix infinite loop in litest_wait_for_event_of_type()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 26 Aug 2014 03:44:03 +0000 (13:44 +1000)]
evdev: load the LIBINPUT_CALIBRATION_MATRIX as default matrix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 26 Aug 2014 01:41:19 +0000 (11:41 +1000)]
Change calibration into a configuration option
New configuration API:
libinput_device_config_calibration_has_matrix()
libinput_device_config_calibration_set_matrix()
libinput_device_config_calibration_get_matrix()
libinput_device_config_calibration_get_default_matrix()
Deprecates libinput_device_calibrate().
For coordinate transformation, we're using a precalculated matrix. Thus, to
support ..._get_matrix() we need to store the original user-specified matrix
separately, in an unmangled state.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 20 Aug 2014 07:16:06 +0000 (17:16 +1000)]
test: add tests for touch calibration
Basic tests for rotation, translation and scaling events.
Note that tests need to be added separately for single-touch and touch
devices, this is a restriction of the litest framework.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 26 Aug 2014 04:02:44 +0000 (14:02 +1000)]
udev: drop WL_CALIBRATION, replace with LIBINPUT_CALIBRATION_MATRIX
WL_CALIBRATION is a weston-specific property that required the translation
component of the matrix to be in pixels. libinput can't provide calibration
based on unknown outputs, so drop support for this property.
The basic functionality is maintained, renaming just makes the change in
behavior more explicit.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 26 Aug 2014 00:34:05 +0000 (10:34 +1000)]
evdev: switch to a normalized transformation matrix
The big change here is the requirement to have the translation component in a
device-normalized coordinate space. Without that, we cannot reliably rotate as
the coordinate space is effectively unknown and may differ between the axes.
This affects any rotation matrix or translation matrix, pure scale matrices
were working just fine since they're unit-less.
Requiring the matrix in device-normalized space makes it possible for libinput
to rotate or otherwise handle the matrix independent of the screen resolution.
The rotation matrix is documented in a bit more detail to make it easier for
users to figure it out.
This changes the definition of the WL_CALIBRATION property (which is currently
broken).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 25 Aug 2014 23:37:29 +0000 (09:37 +1000)]
util: add a couple of 3x3 matrix helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 20 Aug 2014 08:23:43 +0000 (18:23 +1000)]
evdev: apply calibration to multitouch values as well
We apply calibration to single-touch and absolute devices, but we might as
well do so for multitouch events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 26 Aug 2014 02:57:41 +0000 (12:57 +1000)]
evdev: constify evdev_device_calibrate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 26 Aug 2014 00:33:39 +0000 (10:33 +1000)]
udev: use evdev_device_calibrate() instead of manually writing the matrix
We have a wrapper, use it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 21 Aug 2014 01:08:29 +0000 (11:08 +1000)]
test: add a generic single-touch device
With a non-zero absmin for both axes and different ranges for x/y, just to
detect those errors.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 20 Aug 2014 07:15:50 +0000 (17:15 +1000)]
test: add helpers to wait for specific events
litest_wait_for_event() returns if any event is available.
litest_wait_for_event_of_type(... type, type, type, -1) returns if any of the
given event types is availble. All other events are discarded.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 26 Aug 2014 01:33:59 +0000 (11:33 +1000)]
Fix a doxygen reference
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 22 Aug 2014 05:15:17 +0000 (15:15 +1000)]
touchpad: silence Coverity warnings about uninitialized use
container_of() accesses tp for offset calculation. Which is fine, but
Coverity doesn't know that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 22 Aug 2014 05:08:57 +0000 (15:08 +1000)]
Swap conditions for ARRAY_FOR_EACH()
The current conditions result in _elem being assigned _arr[i] before the
condition is checked. This is fine since we then break from the loop and don't
access it anyway, but it makes Coverity unhappy.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 22 Aug 2014 04:58:48 +0000 (14:58 +1000)]
touchpad: mark a intentional switch case fallthrough as such
Both motion and timeout expiry transition into the TOUCH_2_HOLD state, but
only for motion do we need to cancel the current timeout.
Found by Coverity.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 22 Aug 2014 04:54:06 +0000 (14:54 +1000)]
Don't close the fd if libinput_add_fd() fails
Let the caller decide what to do with the fd.
In the current code the caller can't know if the fd was closed on error since
we return NULL on malloc failure as well as on epoll_ctl() failure. In the
latter case the fd was closed, not in the former. The caller had to close
the fd anyway (and all three callers do), so drop closing the fd from this
function.
Found by Coverity.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 22 Aug 2014 04:48:42 +0000 (14:48 +1000)]
evdev: plug memory leak on libevdev_new_from_fd failure
Found by coverity.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 18 Aug 2014 21:59:10 +0000 (07:59 +1000)]
Disable static libraries
Our static library leaks symbols like crazy, some of which are likely
conflicts with users of this library (log_msg, open_restricted, ...).
Disale static linking by default so we don't have to spend time debugging
this.
Related to:
https://bugs.freedesktop.org/show_bug.cgi?id=82292
https://bugs.freedesktop.org/show_bug.cgi?id=82785
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 18 Aug 2014 21:57:25 +0000 (07:57 +1000)]
Use -no-install instead of -static for local noinst linking
The goal of -static was to avoid the libtool wrappers for easier debugging.
The -no-install flag does exactly that, without requiring static linking.
Related to https://bugs.freedesktop.org/show_bug.cgi?id=82292
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Sun, 27 Jul 2014 14:02:46 +0000 (16:02 +0200)]
evdev: Release still pressed keys/buttons when removing device
When removing a device, its not guaranteed that all button or key
presses have been released, resulting in an invalid seat wide button
count.
Note that kernel devices normally will send release events when being
unplugged, but this won't happen when removing a device from the path
backend.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sun, 27 Jul 2014 13:54:49 +0000 (15:54 +0200)]
evdev: Keep track of button/key press count per device
Keep track of the number of times a given button or key is pressed on a
device. For regular mouse devices or keyboard devices, such a count will
never exceed 1, but counting button presses could help when button
presses with the same code can originate from different sources. One could
for example implement overlapping tap-drags with button presses by
having them deal with their own life-time independently, sorting out
when the user should receive button presses or not depending on the
pressed count.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sun, 27 Jul 2014 13:43:59 +0000 (15:43 +0200)]
evdev: Ignore key/button release events if key was never pressed
The kernel may send a 'release' event without ever having sent a key
'pressed' event in case the key was pressed before libinput was
initiated. Ignore these events so that we always guarantee a release
event always comes after a pressed event for any given key or button.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 12 Jul 2014 22:25:36 +0000 (00:25 +0200)]
evdev: Use helper for separating buttons from keys
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sat, 26 Jul 2014 19:34:47 +0000 (21:34 +0200)]
evdev: Let dispatch instances set their own capabilities
It's up to a evdev device backend to configure seat capabilities it
supports. Even though it may be possible for a touchpad to have extra
keys, there is currently no support for sending keyboard events from the
touchpad driver, and if that would be implemented, it'd be a detail of
the touchpad driver, not the generic evdev device part.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 14 Jul 2014 21:34:25 +0000 (23:34 +0200)]
test: Don't fail when events are enabled multiple times
When overriding events of a test device, if one would enable an event
that was already enabled by default for the overridden device, an assert
checking if the event was already enabled would fail and cause the test
to fail.
Since the merging of the default and overriding event lists is implemented
by simply concatinating them letting libevdev deal with ignoring
superfluous event enabling, remove the assert to allow the implementation
to work.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sun, 13 Jul 2014 22:04:14 +0000 (00:04 +0200)]
test: Remove test device from context when deleting
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sun, 13 Jul 2014 22:01:10 +0000 (00:01 +0200)]
test: Use only one test device for some udev and path tests
Some tests in test/path.c and test/udev.c are not dependent on
device behaviour but rather managing of device lifetime etc. Run those
tests only once with only one device, resulting more or less the same
code coverage but shorter run time.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 6 Aug 2014 02:22:38 +0000 (12:22 +1000)]
touchpad: increase top software button area to 15%
We had reports that the top software button area is hard to hit for those
using the trackpoint and clicking the buttons with their thumb.
Analysis of event recordings (3 different people) for left, right and middle
clicks shows that there is a significant amount of events up to about 10mm
(with outliers up to 12mm) from the top of the touchpad. That maps to 15%.
Interestingly, the middle button is not affected by this, presumably the
haptic feedback of the little dots sticking out from the surface make hitting
the button easier.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 24 Jul 2014 03:18:56 +0000 (13:18 +1000)]
test: add a semi-mt Alps test device
Provides the bounding box only, with slot 0 always being the upper/left, slot
1 being the lower-right touch. This needs to use the touch_down etc. litest
interfaces, which are now widened to double (leftover from
489630f58) and a
device-specific private pointer in the litest device.
New device feature for litest: LITEST_SEMI_MT
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 24 Jul 2014 06:15:43 +0000 (16:15 +1000)]
evdev: don't return a width/height if we faked the resolution
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Mon, 21 Jul 2014 13:25:47 +0000 (15:25 +0200)]
touchpad: reset motion history when nfingers changes on semi-mt pads
On semi-mt touchpads the reported position of the first finger down may
jump when the pad switches from st to mt mode. When this happens a large
delta gets seen on the first finger at the same time the second fingers
is first seen down, causing a spurious 2 finger scroll event.
Reset the motion history when nfingers changes on semi-mt pads to avoid this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 23 Jul 2014 08:03:15 +0000 (18:03 +1000)]
Document that the delta from pointer events is accelerated
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 21 Jul 2014 02:30:40 +0000 (12:30 +1000)]
test: auto-update for BTN_TOOL_* when using litest_touch_ functions
Set BTN_TOUCH, BTN_TOOL_DOUBLETAP automatically depending on the number of
fingers down.
This emulates real event sequences a bit better than the current approach,
though it's not a 100% correct emulation:
1) On real devices, BTN_* are usually sent last before the SYN_REPORT - here
they are sent first to slot in with the custom, device-specific event
sequence. We should only ever look at the complete sequence anyway, so this
shouldn't matter.
2) On real devices, the switch from BTN_TOOL_DOUBLETAP to TRIPLETAP and vice
versa is not always toggled within the same SYN_REPORT
3) On synaptics devices, BTN_TOUCH is released in the frame where
BTN_TOOL_DOUBLETAP is set. It is then immediately set again in the next
frame. With the current litest framework this is hard to integrate, so we
just leave BTN_TOUCH set the whole time, which is what MT devices do if
they don't have BTN_TOOL_DOUBLETAP.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Tue, 22 Jul 2014 19:37:02 +0000 (21:37 +0200)]
configure.ac: libinput 0.5
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 16 Jul 2014 19:14:51 +0000 (21:14 +0200)]
test/path: Avoid creating ignored test devices
Some tests doesn't use or doesn't need to use the test device
automatically created when adding a test case for certain types of
devices. For these tests, to shorten test run time, don't create the
test devices that would be ignored.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 21 Jul 2014 23:00:27 +0000 (09:00 +1000)]
style fix: Remove duplicate empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 21 Jul 2014 00:58:24 +0000 (10:58 +1000)]
tools: always enable tapping in the event-gui program
This is a debugging tool, so the features to debug should be enabled by
default.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 21 Jul 2014 01:07:25 +0000 (11:07 +1000)]
Use an enum to enable/disable tapping configuration
More expressive in the caller and less ambiguous about return values (is it 1?
is it non-zero? can it be negative?)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 21 Jul 2014 02:29:19 +0000 (12:29 +1000)]
test: add test for 3-finger tapping
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Fri, 18 Jul 2014 09:06:39 +0000 (11:06 +0200)]
touchpad: make tp_estimate_delta return fractions
Force a cast of the input arguments to a double before the divide, rather
than after the divide.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Fri, 18 Jul 2014 09:06:38 +0000 (11:06 +0200)]
touchpad: Create fake touches for BTN_TOOL_FOO on multi-touch pads too
Multi-touch pads may track less touches then they can report fingers being
present through BTN_TOOL_FOO. So create fake touches for fingers reported
by BTN_TOOL_FOO on multi-touch pads too (when necessary).
This fixes e.g. 3 finger tap not working on the T440s.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Fri, 18 Jul 2014 09:06:37 +0000 (11:06 +0200)]
touchpad: Don't process fake touches if they are not dirty
Don't process fake touches, e.g. re-adding the same position to the motion
history when they are not dirty. This could trigger for example on a button
press.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Fri, 18 Jul 2014 09:06:36 +0000 (11:06 +0200)]
touchpad: Protect tp_begin_touch and tp_end_touch against being called twice
They were already protected against being called twice between SYN_REPORT, but not
for being called twice before a SYN_REPORT arrives.
This allows simplifying tp_process_fake_touch a bit. Note while at it also
also flip the if condition in tp_process_fake_touch so that the if is
true when the finger is down, and remove the bogus t->state = TOUCH_NONE.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 21 Jul 2014 04:20:35 +0000 (14:20 +1000)]
touchpad: always enable palm detection on apple touchpads
They don't set resolution so we can't calculate the size but we know they're
big enough to need palm detection.
And fix the descriptor for the bcm5974. For some reason this was advertising
synaptics coordinates. Fix it to represent (one of) the apple touchpads.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 21 Jul 2014 04:35:42 +0000 (14:35 +1000)]
test: touchpads are too small for palm if we can't get the dimensions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 21 Jul 2014 01:27:21 +0000 (11:27 +1000)]
touchpad: always init the left/right palm edge to INT_MIN/MAX
A touchpad without resolution support had the values set to 0, disabling
pointer movement.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 21 Jul 2014 01:15:43 +0000 (11:15 +1000)]
Fix two doxygen errors
Add the config status enum to the config doxygen group, and remove a
superfluous argument for an @ingroup command.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 15 Jul 2014 04:01:00 +0000 (14:01 +1000)]
touchpad: don't init edge palm detection on touchpads less than 8cm across
On small touchpads, a touch that intends to go across the width of the
touchpad is likely to start in the edge zone. Likewise, on those touchpads the
chances of a palm event happening on the edge is small.
A minimum width of 8cm determined by an elaborate process of completely
unscientific guesswork: the x220 is roughly 7.5cm across and doesn't suffer
much from edge events, the T440s is 10cm across and definitely suffers from
it. So the trigger width likely somewhere in between which makes 8cm about as
valid as any other guess.
Note that this disables palm detection for resolution-less touchpads too - if
we don't know how big the touchpad is we can't know if palm detection on the
edges is necessary.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 14 Jul 2014 06:38:46 +0000 (16:38 +1000)]
touchpad: require a <45 degree movement for a palm to become a touch
Any legitimate finger movement that starts in the palm area is expected to
move out of the palm area at an angle roughly orthogonal to the edge of the
touchpad. Check for the direction of the movement vector, and if it is within
the accepted cardinal/ordinal directions then proceed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 14 Jul 2014 06:06:51 +0000 (16:06 +1000)]
touchpad: if a palm touch moves out of the edge zone within a timeout, unpalm
On small touchpads a touch that is intended to traverse much of the screen
width may start at the very edge, i.e. in the palm zone.
In that case, and if the touch moves out of the palm zone quickly enough, drop
the palm label and make it a normal touchpoint.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 10 Jul 2014 07:34:08 +0000 (17:34 +1000)]
touchpad: implement edge-based basic palm detection
A large part of palm events are situated on the far edges of the touchpad. In
a test run on a T440s while typing a long email all but 2 touch points were
located in the outer ~5% of the touchpad. Define a 5% exclusion zone on the
left and right edges in which new touchpoint is automatically assigned to be a
palm.
A finger may move into that exclusion zone without being marked as palm, it
just can't start in one.
On clickpads, the exclusion zone does not extend into the software buttons.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 14 Jul 2014 06:19:33 +0000 (16:19 +1000)]
filter: move get_direction into shared header
Makes it possible to use from the touchpad code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 15 Jul 2014 05:35:20 +0000 (15:35 +1000)]
test: set the abs resolution after creating the device
Until uinput gets that capability (likely not before 3.17) all we can do is a
racy approach of setting it after creating it. That won't work well for
anything test where libinput is already listening to udev when the device is
created, but it does work for those cases where libinput is started after the
device was initialized.
And it's a better alternative than not testing anything dependent on
resolution settings.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 15 Jul 2014 06:32:33 +0000 (16:32 +1000)]
test: reduce sideways-component in two-finger scroll test
This breaks when we have a device resolution set on the test devices,
specificially on the T440. The current tests use a delta of 1% of the device
which with the resolution set results in an effective delta of 3 - above the
scroll threshold.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 18 Jul 2014 06:01:10 +0000 (16:01 +1000)]
test: widen litest to use doubles for scaled variables
Using a 0-100% range is useful but in some cases we need events with finer
than 1% granularity.
And fix up the two-finger test that now fails. This was a bug in the test
anyway, the dx/dy supplied here was 1% of the touchpad width. Confined to
integers this meant we only ever had the touch down, then the single move by
1%. That caused two events - not enough to satisfy tp_estimate_delta, so we
always had a delta of 0/0 regardless of the size of the move.
Now with doubles this fails, so drop it to 0.1% instead, which is small enough
on all touchpads we currently have.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 15 Jul 2014 06:01:49 +0000 (16:01 +1000)]
touchpad: check the pointer touch for history size
The current touch may not be the pointer touch, so it's pointless checking the
history size on that touch. Instead, search for the pointer touch first, check
if it's dirty and then check the history size.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 16 Jul 2014 04:10:08 +0000 (14:10 +1000)]
test: fix x/y resolution for a test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 15 Jul 2014 06:26:46 +0000 (16:26 +1000)]
test: fix resolution on T440s multitouch axes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 15 Jul 2014 06:49:26 +0000 (16:49 +1000)]
test: fix a missing finger release
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 4 Jul 2014 00:43:52 +0000 (10:43 +1000)]
Include stdint.h from filter.h
Don't rely on the users to include it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 14 Jul 2014 21:33:51 +0000 (23:33 +0200)]
test: Assert libevdev_uinput_write_event() call was successful
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sun, 13 Jul 2014 22:15:07 +0000 (00:15 +0200)]
tools/event-gui: Silence a couple of compiler warnings
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 15 Jul 2014 19:53:26 +0000 (21:53 +0200)]
event-debug: Silence compiler warnings
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 15 Jul 2014 21:25:28 +0000 (23:25 +0200)]
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>
Peter Hutterer [Thu, 10 Jul 2014 07:17:53 +0000 (17:17 +1000)]
touchpad: fix coding style
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 8 Jul 2014 03:43:45 +0000 (13:43 +1000)]
touchpad: normalize the touchpad resolution to 400dpi, not 10 units/mm
In an attempt to bring method into the madness, normalize the touchpad deltas
to those of a USB mouse with 400 dpi. This way the data we're dealing with in
the acceleration code is of a known quantity.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 8 Jul 2014 03:02:31 +0000 (13:02 +1000)]
touchpad: don't feed 0/0 deltas into the accel filters
The resolution-based scaling may result in deltas of 0. The accel code doesn't
handle 0 deltas too well. 0/0 deltas can't happen for EV_REL devices, so the
code just isn't designed for it.
Most notably, events with delta 0/0 have no direction. That messes up the
history-based velocity calculation which stops whenever the current vector's
direction changes from the one in the trackers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 8 Jul 2014 02:09:20 +0000 (12:09 +1000)]
filter: drop constant acceleration
This just moves a decimal point around, at the expense of making the approach
harder to understand. The only time the const acceleration matters is when
applied to the velocity but it only matters in relation to the threshold which
is a fixed number.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 8 Jul 2014 02:05:36 +0000 (12:05 +1000)]
filter: use a separate variable for the final accel factor
velocity is in unit/ms, the threshold is in units/ms. Once we divide
velocity/threshold, we're not in units/ms anymore but have a unitless factor.
Use a separate variable to avoid confusion.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 8 Jul 2014 01:45:36 +0000 (11:45 +1000)]
filter: annotate the various variables we have with units
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Fri, 4 Jul 2014 14:59:50 +0000 (16:59 +0200)]
accel_profile_smooth_simple: Make 0.0-1.0 accel range depend on threshold
Instead of always going from an accel of 0.0 to 1.0 between a velocity of
0.0 and 1.0, make the lead-in length of the curve depend on the threshold
setting, using half of the threshold for the lead-in.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Fri, 4 Jul 2014 15:17:14 +0000 (17:17 +0200)]
accel_profile_smooth_simple: Fix jump in acceleration curve
There was an error in the value passed to the second calc_penumbral_gradient
call causing a jump in the acceleration curve. This commit fixes this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Fri, 4 Jul 2014 15:16:25 +0000 (17:16 +0200)]
accel_profile_smooth_simple: Cleanup
Cleanup the code a bit, and make sure accel is at least 1.0 .
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 4 Jul 2014 02:52:04 +0000 (12:52 +1000)]
filter: drop delta-softening
I doubt this does what we think it does. It doesn't soften the delta changes,
rather it introduces bumps in the smooth processing of the changes.
abs(delta) below 1.0 is untouched, and abs(delta) beyond 3 or 4 isn't
noticable much. But in the slow range around the 1/-1 mark there is a bump.
For example, if our last_delta is 1.0 and delta is 1.1, the "softened"
delta is set to 0.6. That is stored as last delta, so an input sequence of:
0.8, 0.9, 1.0, 1.1, 1.2, 1.0, 0.8, 1.1
results in "softened" deltas that don't match the input:
0.8, 0.9, 1.0, 0.6, 0.7, 1.0, 0.8, 0.6
A better approach at smoothing this out would be to calculate the softened as:
current = current ± diff(last, current) * 0.5
or even weighted towards the new delta
current = current ± diff(last, current) * 0.25
In tests, this makes little difference. Dropping this function altogether is
sufficient to make the pointer pointer behave slightly better at low speeds
though the increase is small enough to attribute to confirmation bias.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>