Commit graph

477 commits

Author SHA1 Message Date
Peter Hutterer
2dc6534ec0 evdev: add a wrapper to get the evdev device from a libinput device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-31 08:00:58 +10:00
Peter Hutterer
60de087e65 evdev: improve type-safety on dispatch switches
Set the dispatch type on creation, then check that whenever we try to get the
dispatch struct. This avoids a potential mismatch between the backends.

Plus, use of container_of means we're not dependent on the exact layout
anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-31 07:36:12 +10:00
Peter Hutterer
e6806ce292 switch: move the lid switch bits into their own file
Keep this separate from the other code so it's easier to read

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
5f2402a41a switch: only sync the initial state if we know the state is reliable
This changes the default behavior to "disable the touchpad on the first lid
close event", thus filtering any laptops where the switch state is buggy and
always in "on" state. Devices where we know the lid switch state is
reliable can be marked as such.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
3f5e9cb636 switch: prevent switches to send the same event twice
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
2a1ed92c51 switch: sync the initial state of the switch on startup
This is the default behavior, based on the theory of hardware actually doing
the right thing. That's not always the case, follow-up patches will change
when we do the theoretically ideal thing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
9b4f587390 evdev: move the lid switch process functions together
Don't sprinkle them across the file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
James Ye
4aeb3cc018 Add evdev_dispatch interface for lid switch
Create a lid_switch_interface to handle lid switch events, so the touchpad can
be disabled when lid is closed.

Signed-off-by: James Ye <jye836@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
13a2336beb evdev: fix an error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-25 13:24:48 +10:00
Peter Hutterer
ebeba8e8ff Merge branch 'wip/wheel-tilt-source' 2017-01-20 12:51:53 +10:00
Peter Hutterer
43ba2dbb30 touchpad: add a model tag to mark touchpads with visible marker
We used to mark dell touchpads this way but let's make this more generic.
Nothing else used the dell touchpad model flag, so we can simply replace it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-11 10:39:05 +10:00
Peter Hutterer
4bf8b8934d evdev: add support for wheel tilt
This is added on top of the click angle handling, so the actual axis values
simply fall back onto whatever is set by udev, including the default fallbacks
to 15 and whatnot.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-04 15:15:28 +10:00
Peter Hutterer
738a39f56b evdev: add helper function to parse a udev flag
Only allow values of 0 and 1 for udev flags. Not that I'm aware of anyone
using anything else (i.e. his shouldn't break anything) but it's best to be as
restrictive as possible here.

Bonus effect: it's now possible to unset LIBINPUT_MODEL_* tags as well,
previously any value (including 0) was counted as "yes".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-04 15:15:27 +10:00
Peter Hutterer
bdd4264d61 filter: change the filter functions to take raw device coordinates
We used to normalize all deltas to equivalents of a 1000dpi mouse before
passing it into the acceleration functions. This has a bunch of drawbacks, not
least that we already have to un-normalize back into device units for a few
devices already (trackpoints, tablet, low-dpi mice).

Switch the filter code over to use device units, relying on the dpi set
earlier during filter creation to convert to normalized. To make things easy,
the output of the filter code is still normalized data, i.e. data ready to be
handed to the libinput caller.

No effective functional changes. For touchpads, we still send normalized
coordinates (for now, anyway). For the various filter methods, we either drop
the places where we unnormalized before or we normalize where needed.

Two possible changes: for trackpoints and low-dpi mice we had a max dpi factor
of 1.0 before - now we don't anymore. This was only the case if a low-dpi
mouse had more than 1000dpi (never true) or a trackpoint had a const accel
lower than 1.0 (yeah, whatever).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-21 10:55:57 +10:00
Peter Hutterer
9d7bd8e623 evdev: rename a leftover weston variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-15 08:12:39 +10:00
Peter Hutterer
340474857e Whitespace fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-05 15:17:28 +10:00
Peter Hutterer
996b845d68 touchpad: add a quirk for the HP Pavilion dm4
This touchpad has cursor jumps for 2-finger scrolling that also affects the
single-finger emulation. So disable any multitouch bits on this device and
disallow the 2-finger scroll method. This still allows for 2-finger
tapping/clicking.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-01 06:24:07 +10:00
Peter Hutterer
4bb3da4115 evdev: init axis range warnings for touch devices too
Move the code from the touchpad code into the more generic evdev code

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-30 08:54:00 +10:00
Peter Hutterer
98793f6b43 evdev: use safe_atod to convert the matrix values
Avoids parsing issues when we're in different locales

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-29 11:21:39 +10:00
Peter Hutterer
50e4a1fada evdev: move reading the calibration prop into a helper function
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-29 11:21:38 +10:00
Peter Hutterer
6752544e56 evdev: add a quirk for the HP Zbook Studio G3
Announces 4 slots but only sends data for the first two. This causes libinput
to miss three-finger actions (we don't look at BTN_TOOL_TRIPLETAP if we have
3 or more slots).

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-21 06:44:16 +10:00
Hermann Gausterer
92c30b5a71 evdev: fix typo / bugzilla url
Signed-off-by: Hermann Gausterer <git-libinput-2016@mrq1.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-10 09:45:08 +10:00
Peter Hutterer
58c7a9cbf0 evdev: implement support for the MOUSE_WHEEL_CLICK_COUNT property
Not all mice have a click angle with integer degrees. The new
MOUSE_WHEEL_CLICK_COUNT property specifies how many clicks per full rotation,
the angle can be calculated from that.

See https://github.com/systemd/systemd/pull/4440 for more information

CLICK_COUNT overrides CLICK_ANGLE, so we check for the former first and then
fall back to the angle if need be. No changes to the user-facing API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-04 12:10:52 +10:00
Peter Hutterer
76008034ca evdev: add hwdb quirk for HP Compaq 6910
Same as the HP Compat 8510, it doesn't send BTN_TOOL_DOUBLETAP/TRIPLETAP. This
may be a general issue with those series but they're 6 years old now, so
it's questionable to spend extra effort detecting them.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-02 21:46:11 +10:00
Peter Hutterer
a58a9de70d evdev: actually ignore joysticks
A joystick has ID_INPUT_JOYSTICK *and* ID_INPUT set, so we need to check for
both.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-02 21:04:03 +10:00
Peter Hutterer
9959464af7 evdev: add missing space in error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-25 10:44:00 +10:00
Peter Hutterer
18adfed4c1 Force the HP Stream 11 touchpad as a clickpad
INPUT_PROP_BUTTONPAD is not set on this device and RMI4 which should fix this
is a bit too far into the future at this point. Hack around it.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-07 13:25:31 +10:00
Peter Hutterer
b519ea4ab5 tablet: add touch arbitration
So far we've relied on the wacom kernel module to do touch arbitration for us
but that won't be the case in upcoming kernels. Implement touch arbitration in
userspace by pairing the two devices and suspending the touch device whenever
a tool comes into proximity.

In the future more sophisticated arbitration can be done (e.g. only touches
which are close to the pen) but let's burn that bridge when we have to cross
it.

Note that touch arbitration is "device suspend light", i.e. we leave the
device enabled and the fd is active. Tablet interactions are comparatively
short-lived, so closing the fd and asking logind for a new one every time the
pen changes proximity is suboptimal. Instead, we just keep a boolean around
and discard all events while it is set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
1ce99fd698 evdev: split resetting to a neutral state out
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
61e8542d6e evdev: release current touches when the device is suspended
Previously suspending a touch device with at least one touch down would never
release the touch point.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
b22dcab463 evdev: don't send frame events if we filtered the touch event
If the touch is inactive the seat_slot is -1 and we filter the event. The same
happens for devices that send may touch events but aren't touch devices like
any touch-capable mouse. In those cases we sent a bunch of 'empty' touch frame
events. Stop this by checking if we actually flushed the respective event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
b0ec4bacbd evdev: let the fallback_flush... function decide whether a frame is needed
Rather than testing before if we have an event that matches the need for a
frame simply return the event sent by the flush function. If that event
matches those that need frame events, send the event then.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
b26d8f9122 evdev: split out mt event flushing
No functional changes, this is prep work for being able to release touch
points on the fly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
64c8939911 evdev: add quirk for the HP85810 touchpad
The touchpad's says it can do two- and three-finger detection but it never
sends events for it. Disable them so we treat it as pure single-finger
touchpad.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-01 10:55:34 +10:00
Peter Hutterer
8db9d2b927 evdev: fix handling of click wheel on parsing errors
Introduced in b02acd346b, we need to check the angle returned by the parsing
function, not the variable passed in.

Found by Coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-01 09:57:26 +10:00
Peter Hutterer
72d81cf7c6 evdev: recognize and use ID_INPUT_TRACKBALL
We leave the old LIBINPUT_MODEL_TRACKBALL in place until we can rely on
systems to have the new systemd tagging.

https://github.com/systemd/systemd/pull/3872

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-30 07:47:32 +10:00
Peter Hutterer
b02acd346b Read the horizontal wheel click angle property if available
The Logitech MX master has different click angles for the two wheels.

https://github.com/systemd/systemd/issues/3947

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-22 11:29:35 +10:00
Peter Hutterer
d48cee051e evdev: rename all fallback-specific functions to a fallback_ prefix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
acf1c36f83 evdev: pass the dispatch interface around
The only places we should typecast from device->dispatch is where we have
external entry points. Everywhere else keep the pointer to the dispatch
interface we already have anyway.

This way we avoid papering over a potential re-use of a function from
non-evdev code, passing in the wrong dispatch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
bb37a2e102 evdev: move the abs point into the fallback dispatch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
5af236a022 evdev: switch three ints to booleans
And a minor rename to make it more obvious

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
aac42ca528 evdev: split evdev_dispatch and fallback_dispatch into separate entities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
0a27faec78 evdev: move the keyboard mask into the fallback dispatch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
dd727ce4fd evdev: move pending_event to the evdev_dispatch struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
7e18ef2913 evdev: move the relative deltas for normal devices to the fallback dispatch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
4182e51403 evdev: move the mt struct into the evdev dispatch struct
This is only used by the fallback dispatch method, not by any of the others.
Anything dispatch-specific should go into that struct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
ad031733f2 evdev: move axis dimension handling into a single helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
2469adc852 evdev: split out slot init
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
3013fc6223 evdev: return the dispatch method from evdev_configure_device
Rather than setting a magic device field and returning true/false just return
the dispatch method.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00
Peter Hutterer
f89a79d9a4 evdev: move the fallback dispatch creation to evdev_configure_device
All the other devices are created in there too, unify that approach.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 19:56:16 +10:00