Peter Hutterer [Tue, 4 Nov 2014 00:28:00 +0000 (10:28 +1000)]
Fix documentation for libinput_log_set_handler
user_data argument was dropped in
97a6bf10f958.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Thu, 30 Oct 2014 21:34:15 +0000 (16:34 -0500)]
evdev: add DPI to evdev calculations
Assume "normal" mice are 400DPI, and that all calculations should be
normalized to this before being fed into the filter.
There isn't yet a way to configure a device's DPI.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Thu, 30 Oct 2014 21:34:14 +0000 (16:34 -0500)]
filter: perform speed computations with doubles
Converting to integer before the sqrt calculation can cause loss of
motion at low speed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Thu, 30 Oct 2014 21:34:13 +0000 (16:34 -0500)]
filter: Fix typo
accelator -> accelerator
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Wed, 29 Oct 2014 14:56:27 +0000 (09:56 -0500)]
evdev: Log evdev event queue overflows
Log a message when the kernel event queue overflows and events are dropped.
After 10 messages logging stops to avoid flooding the logs if the condition
is persistent.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 30 Oct 2014 05:36:16 +0000 (15:36 +1000)]
Fix a documentation typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 30 Oct 2014 05:16:40 +0000 (15:16 +1000)]
doc: update for latest doxygen
doxygen -u, no manual interference.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Fri, 3 Oct 2014 20:01:35 +0000 (15:01 -0500)]
cosmetic: convert evdev_need_touch_frame from int to bool
We use stdbool elsewhere, so use it here too for consistency.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 23 Sep 2014 02:46:02 +0000 (12:46 +1000)]
test: add some left-handed tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 23 Sep 2014 04:35:42 +0000 (14:35 +1000)]
touchpad: hook up left-handed configuration
Tapping and clickfinger is unaffected, physical and software buttons are
swapped. The main area of a clickpad remains as left button though.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 23 Sep 2014 03:48:06 +0000 (13:48 +1000)]
evdev: hook up left-handed configuration option
Two separate flags needed, want_left_handed and left_handed to avoid switching
to left_handed while a button is still down. Since each backend has a
different way of determining whether buttons are down, let them set a function
to do exactly that. Then call that function whenever a button release event is
posted to switch the device to right/left-handed if applicable.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 22 Sep 2014 06:48:41 +0000 (16:48 +1000)]
Add configuration option for left-handed behavior
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:07:38 +0000 (10:07 +1000)]
test: add litest_push/pop_event_frame() helpers
For some tests we need to string multiple event sequences together into one
event frame. Use a push/pop frame approach that stops litest from sending any
EV_SYN/SYN_REPORT events, so we can merge two touches together by e.g.
litest_push_event_frame(d);
litest_touch_down(d, 0, 10, 10);
litest_touch_down(d, 1, 20, 50);
litest_pop_event_frame(d);
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 16 Sep 2014 06:08:29 +0000 (16:08 +1000)]
test: add helper functions for the two timers we care about
Rather than a random msleep() with a comment, use a helper function that
describes what we're waiting for. Also makes changing the timeouts easier in
the future.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 22 Sep 2014 06:37:36 +0000 (16:37 +1000)]
Add missing doxygen @ingroup commands
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 18 Sep 2014 06:14:35 +0000 (16:14 +1000)]
test: add tests for natural scrolling
2-finger scrolling only, we don't have anything else yet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 18 Sep 2014 05:51:53 +0000 (15:51 +1000)]
touchpad: hook up natural scrolling configuration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 18 Sep 2014 05:10:19 +0000 (15:10 +1000)]
Add a configuration option for natural scrolling
Natural scrolling is simply inverted scrolling, but I decided to
use the Apple terminology simply because it's easier to google for.
Add the usual quartett of config options for has/set/get/get_default/, as a
boolean option rather than an enum for scroll mode to avoid name collusion
with the (currently in the works) edge scrolling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 23:04:10 +0000 (09:04 +1000)]
tools: map KEY_UP/DOWN to pointer acceleration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 22:56:44 +0000 (08:56 +1000)]
tools: keep a list of devices around for run-time changes
Hard-coded to 50 devices, because for a debugging tool that's plenty.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 23:44:43 +0000 (09:44 +1000)]
touchpad: hook up pointer acceleration configuration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 19 Sep 2014 05:09:31 +0000 (15:09 +1000)]
evdev: hook into pointer acceleration config interface
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 15 May 2014 05:46:19 +0000 (15:46 +1000)]
Add a pointer acceleration API
Only exposes one knob - speed, normalized to a [-1, 1] range with 0 being the
neutral "this is what we think is normal" speed. -1 and 1 reflect the
slowest/fastest reasonable speed on this device.
Note: with this API we commit to having any pointer accelerating as a true
gliding scale. We cannot map the [-1,1] range into a discrete set of steps
as we do not communicate to the caller whether a specific value has changed
the acceleration. Without that, a caller may assume that acceleration has
changed even when it is not visible to the user.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Sun, 21 Sep 2014 23:35:53 +0000 (09:35 +1000)]
touchpad: use the evdev device's filter struct
We don't need a separate filter struct, we can use the parent evdev device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 19 Sep 2014 04:25:22 +0000 (14:25 +1000)]
filter: adjust acceleration curve depending on speed
The acceleration curve consists of four parts, in ascii-art like this:
_____________
/
____/
/
/
where the x axis is the speed, y is the acceleration factor.
The first plateau is at the acceleration factor 1 (i.e. unaccelerated
movement), the second plateau is at the max acceleration factor. The threshold
in the code defines where and how long the plateau is.
This patch adjusts the curve based on a [-1, 1] range. For anything below 0,
the plateau is longer (i.e. accel kicks in at a higher speed), the second
incline is flatter (i.e. accel kicks in slower) and the max accel factor is
lower (i.e. maximum speed is slower). For anything above 0, the inverse is
true, acceleration kicks in earlier, harder and is faster in general. So the
default/min/max curves overlaid look something like this:
________ max
| _______ default
| / _____ min
_|_/_/
/
/
Note that there's a limit to what ascii art can do...
Note that there are additional tweaks we can introduce later, such as
decreaseing the unaccelerated speed of the device (i.e. lowering the first
plateau).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 05:53:56 +0000 (15:53 +1000)]
filter: add a configurable speed interface
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 05:32:40 +0000 (15:32 +1000)]
filter: move the threshold/accel into the filter struct
No functional changes, prep work for the config interface.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 23:29:11 +0000 (09:29 +1000)]
filter: add a filter-private.h header file
To keep the implementation of a filter separate from the users of a filter.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 19 Sep 2014 01:10:17 +0000 (11:10 +1000)]
Replace pointer acceleration with a much simpler linear one
We ran a userstudy, evaluating three different accel methods. Detailed results are
available at:
http://www.who-t.net/publications/hutterer2014_libinput_ptraccel_study.pdf
We found that there was little difference between the method we had in
libinput 0.6 and this three-line function. Users didn't really notice a
difference, but measured data suggests that it has slight advantages in some
use-cases.
The method proposed here is the one labeled "linear" in the paper, its profile
looks roughly like this:
_____________
/
____/
/
/
where the x axis is the speed, y is the acceleration factor.
The first plateau is at the acceleration factor 1 (i.e. unaccelerated
movement), the second plateau is at the max acceleration factor. The threshold
in the code defines where and how long the plateau is.
Differences to the previous accel function:
- both inclines are linear rather than curved
- the second incline is less steep than the current method
From a maintainer's point-of-view, this function is significantly easier to
understand and manipulate than the previous one.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 17 Sep 2014 05:11:41 +0000 (15:11 +1000)]
Drop two semicolons after a macro definition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Sun, 21 Sep 2014 23:30:38 +0000 (09:30 +1000)]
evdev: drop unused declaration evdev_proces_event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Thu, 18 Sep 2014 09:15:27 +0000 (11:15 +0200)]
test: Add trackpoint middlebutton scrolling tests
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 [Wed, 17 Sep 2014 13:35:31 +0000 (15:35 +0200)]
litest: Add litest_assert_scroll() helper function
Make check_2fg_scroll functionality available outside of touchpad.c ,
no functional changes.
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 [Wed, 17 Sep 2014 13:35:30 +0000 (15:35 +0200)]
touchpad: Enlarge topbutton area a bit while the touchpad is disabled
Make it easier to hit the topbutton area when the touchpad is disabled,
normally we don't want to make the topbutton area too big, so as to not
interfere with normal touchpad operation, but when disabled we have no such
worries.
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>
Derek Foreman [Thu, 18 Sep 2014 22:02:39 +0000 (17:02 -0500)]
cosmetic: Remove prototype for nonexistent create_linear_acceleration_filter()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 16 Sep 2014 14:22:42 +0000 (16:22 +0200)]
test: Test the topbuttons of a disabled touchpad still send events through the trackpoint
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Tue, 16 Sep 2014 14:22:41 +0000 (16:22 +0200)]
touchpad: When disabling a TOPBUTTONPAD, leave the top buttons enabled
On a TOPBUTTONPAD, we can't disable the touchpad altogether - the trackstick
relies on the touchpad's top software buttons.
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 [Tue, 16 Sep 2014 14:22:40 +0000 (16:22 +0200)]
touchpad: Put state unrolling code in a tp_clear_state() helper function
For touchpads with top softbuttons we don't want to fully disable the touchpad
on suspend, as we want to keep the top softbuttons working for the trackpoint.
So in the suspended state some of the touchpad sub-statemachines will keep
running (e.g. buttons) where others (e.g. tap) will not. This means that
we will need to clear the touchpad state on resume too, to avoid things
being in an inconsistent state after resume.
This commit factors out the state clearing code into a helper functions, so
that the same code can be used on resume.
No functional changes.
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 [Tue, 16 Sep 2014 14:22:39 +0000 (16:22 +0200)]
touchpad: Route top softbuttons through the trackstick if we've one
The touchpad top softbuttons such as found on the Lenove T440 are intended for
use with the trackstick. Route their events through the trackstick, so that
they can be used for e.g. middle button scrolling with the trackstick.
Note that sending top button events to a disabled trackpoint makes no sense
(and will mess up internal state). Likely a user with a disabled trackpoint
will still expect the top buttons to work, so rather than not sending events
in that case, simply treat a suspendeded trackpoint as not being there, and
send the events directly from the touchpad device.
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 [Tue, 16 Sep 2014 14:22:38 +0000 (16:22 +0200)]
touchpad: Keep track of associated trackpoint device
The top soft buttons are intended for use with a trackpoint, and to e.g.
make middle button scrolling work correctly, we must post the events for
these "buttons" through the trackpoint device.
This commit is a preparation patch for this, it adds a link to the
trackpoint to the touchpad, but does not yet do anything with it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 16 Sep 2014 14:22:37 +0000 (16:22 +0200)]
evdev: Add an internal device suspend / resume notification system
We have the ability for a device to form a link to another device through the
device_added / device_removed callbacks. A device having such a link to
another device may also want to know when that other device is disabled /
enabled (suspended / resumed). So add a notification mechanism for this too.
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 [Tue, 16 Sep 2014 14:22:36 +0000 (16:22 +0200)]
evdev: Add middle button scrolling for trackpoints
Most trackpoint users want to be able to scroll using the trackpoint with
the middle button pressed, add support for 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 [Tue, 16 Sep 2014 14:22:35 +0000 (16:22 +0200)]
evdev: Move generic scroll code from evdev-mt-touchpad.c to evdev.c
So that it can be used for middle button trackpoint scrolling too.
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 [Thu, 4 Sep 2014 02:55:02 +0000 (12:55 +1000)]
touchpad: move softbutton initialization to separate function
No functional changes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 3 Sep 2014 05:45:57 +0000 (15:45 +1000)]
touchpad: implement conditional disabling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 3 Sep 2014 05:50:28 +0000 (15:50 +1000)]
evdev: add internal tagging system
For conditional touchpad disabling we need two pieces of knowledge: is the
device an internal touchpad and is another device an external mouse-like
device. For that use-case it's enough to tag any device that's on USB and
Bluetooth with pointer capabilities as external mouse. A more complex can be
done when needed.
The tag function is part of the dispatch interface (to save on udev code) and
called before the caller is notified about the new device, i.e. the device is
fully configured by the time it needs to be tagged, and other devices can rely
on the tags being assigned by the time they get notified about the new device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 3 Sep 2014 04:34:52 +0000 (14:34 +1000)]
evdev: add a internal device notification mechanism
When a device is added or removed, notify all internal devices about the
device change. This allows all devices to configure themselves depending on
other devices in the system. Prime use-case here is an internal touchpad that
wants to know if an external mouse is connected.
On device added, notification goes both ways: existing devices are notified
about the new device, and the new device is notified about existing devices.
On device removed, notification only goes one way.
In both cases, the internal notification is complete before the event is sent
to the caller.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 20 Aug 2014 00:32:29 +0000 (10:32 +1000)]
test: test for release events on device suspend
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 1 Sep 2014 07:17:18 +0000 (17:17 +1000)]
touchpad: hook up sendevents configuration
We may be in the middle of a software button click or a tap, so make sure we
go back to the device-neutral state by unwinding.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
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>