Commit graph

423 commits

Author SHA1 Message Date
Peter Hutterer
ea02e2b95a evdev_device_suspend() is a void function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-19 09:48:38 +10:00
Peter Hutterer
d9c2535721 evdev: constify evdev_device_get_size
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-07-18 08:09:00 +10:00
Peter Hutterer
caf14fab16 touchpad: reduce middle button size on Dell touchpads to 10mm
All Dell touchpas appear to have a visual marker on their touchpads. With a
visible marker our middle button can (and should) be much smaller since we
can rely on users to hit the button precisely.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-07-14 07:46:54 +10:00
Peter Hutterer
0c51a52389 touchpad: unify internal/external touchpad tagging
To unify this we need to move the tagging process forward so tp_init() can
rely on it for config setup. This means moving it to the touchpad init code.
Other than that no real functional changes, the rules stay the same:
* serial/i2c/etc. are considered internal touchpads
* Bluetooth is always external
* USB is external for Logitech devices
* USB is external for Wacom devices
* USB is internal for Apple touchpads

And if we can't figure it out, we assume it's external and log a message so we
can put a quirk in place.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-04 07:42:59 +10:00
Peter Hutterer
28f75d9f9d Merge branch 'wip/touchpad-drop-hysteresis' 2016-06-20 09:26:44 +10:00
Peter Hutterer
48473994c8 touchpad: re-enable hysteresis by default for all devices
The removal of the hysteresis even on precise touchpads has led to
difficulties controlling the cursor in a few instances. Since 27078b2667
we only have the hysteresis on Apple touchpads and the Lenovo *40 series and
later. Even on those do we see some positioning difficulties (bug 94379).

So restore the hysteresis by default again for all touchpads. In the future a
knob could be exposed for precision vs reactivity or something, but for now
the drawback of imprecise positioning does not outweigh the benefits we get
on those few devices.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:23:58 +10:00
Peter Hutterer
9bb0cfd878 test: add an apple magicmouse device
This device has a touchpad on the mouse but it's labeled as mouse. For litest
we only label it as LITEST_MOUSE feature and test the touchpad directly on the
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:17:38 +10:00
Peter Hutterer
45d23a6b0e evdev: add helper to get the libinput context from the evdev device
And change the various callers, especially those where we only had the
separate struct for indentation purposes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-10 06:57:41 +10:00
Peter Hutterer
c781ef2eb3 evdev: check model flags for actual booleans
The hwdb doesn't allow unsetting a property so once we start nesting model
flags it'll become important to be able to be able to unset one as well (by
assigning it to 0).

So rather than checking for existence, check whether the property is actually
set to something resembling a boolean.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-10 06:57:35 +10:00
Peter Hutterer
27078b2667 touchpad: restore the hysteresis by default
A large part of the bugs seen right now are related to touchpads jittering too
much. Fixing them one by one is entertaining, but time consuming. Right now
the number of touchpads that require a hysteresis seem to outnumber those that
don't, so switch the approach around: leave the hysteresis in place but
disable it for those touchpads that don't need it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-06 09:00:14 +10:00
Peter Hutterer
e1915b53b5 Drop the ALPS_RUSHMORE tag
Was only used for the touchpad hysteresis, we can re-use the wobbly touchpad
tag for this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-05-23 14:56:15 +10:00
Peter Hutterer
8527242ed9 evdev: the range between dpad and trigger-happy are keys, not buttons
Affected keys:
	KEY_ALS_TOGGLE
	KEY_BUTTONCONFIG
	KEY_TASKMANAGER
	KEY_JOURNAL
	KEY_CONTROLPANEL
	KEY_APPSELECT
	KEY_SCREENSAVER
	KEY_VOICECOMMAND
	KEY_BRIGHTNESS_MIN
	KEY_BRIGHTNESS_MAX
	KEY_KBDINPUTASSIST_PREV
	KEY_KBDINPUTASSIST_NEXT
	KEY_KBDINPUTASSIST_PREVGROUP
	KEY_KBDINPUTASSIST_NEXTGROUP
	KEY_KBDINPUTASSIST_ACCEPT
	KEY_KBDINPUTASSIST_CANCEL

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-17 07:58:15 +10:00
Peter Hutterer
d1a8a92184 Add support for relative device rotation (trackball only)
Trackballs are effectively stationary devices and can be positioned at any
rotation. They are also employed by users with impaired dexterity which
sometimes implies that they are positioned at an non-default angle to make the
buttons easier to reach.

Add a config option for rotation for trackball devices. Currently only
supported for 90-degree angles, if there is a need we can add more angles
later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-05-16 09:21:38 +10:00
Peter Hutterer
8a415e486a Add tagging of trackballs
Currently unused, but oh, the possibilities...

The only thing we have to go on for trackballs at the moment is whether they
have "Trackball" in the name string. All others need to be manually tagged.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-05-03 17:17:28 +10:00
Peter Hutterer
4d2724d022 evdev: de-duplicate the model property->model flag list
Rather than a list where the only difference is the LIBINPUT_MODEL vs
EVDEV_MODEL prefix, use a macro.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-05-03 17:16:47 +10:00
Peter Hutterer
d8e92b3e45 evdev: log the applied model flags in debug mode
Makes it a lot easier to figure out if the udev properties are set up
correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-03 15:10:01 +10:00
Peter Hutterer
064c72a52a Merge branch 'wip/tablet-pad-support' 2016-04-18 13:31:46 +10:00
Peter Hutterer
8e17a9ab5c pad: implement wacom pad support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:12:02 +10:00
Peter Hutterer
61e58a4c1f tablet: move the libwacom check for left-handed-ness into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:11:59 +10:00
Peter Hutterer
fcc9a2bf18 evdev: always defuzz absolute touchscreens
If a touchscreen has a fuzz value use it for motion hysteresis similar to how
we do it for a touchpad. This stops pointer wobbles as seen in
https://bugs.freedesktop.org/show_bug.cgi?id=94918

It's up to the system to override or set the kernel's fuzz value correctly,
i.e. a udev hwdb entry is required where the kernel driver does not set it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-04-18 08:40:42 +10:00
Peter Hutterer
b31618b25b evdev: use a slot variable instead of dereferencing everywhere
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-04-18 08:40:42 +10:00
Peter Hutterer
ef4e96de58 evdev: rename slot to slot_idx
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-04-18 08:40:41 +10:00
Peter Hutterer
afdcaf5015 touchpad: add LIBINPUT_MODEL_WOBBLY_TOUCHPAD for the HP 14-ac157tu
If some elantech touchpads require a hysteresis, let's use some more generic
tag for those touchpads that require correct handling of pointer wobbles.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-15 10:46:54 +10:00
Peter Hutterer
c61dfc80bd evdev: enable middle-button scrolling on middle-button emulation
https://bugs.freedesktop.org/show_bug.cgi?id=94856

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-14 10:48:26 +10:00
Peter Hutterer
aeb0c21b1c evdev: split scroll button state check out
Rather than checking the physical key's state, set a flag for the button to be
down. This enables us to use non-physical buttons (middle button emulation).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-14 10:48:21 +10:00
Peter Hutterer
d76263a00f evdev: if we have a quick scroll button release, skip middle button emulation
The only difference between evdev_pointer_notify_physical_button() and
evdev_pointer_notify_button() is that the former filters out middle button
emulations where applicable.

Doing so effectively disables using a button for scrolling that is also used
for middle button emulation. This is intentional, it is a niche use-case
(and prone to timer races). OTOH some devices exist that only have two buttons
on the pointing stick and require button scrolling. This use-case is given
preference.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-14 10:48:14 +10:00
Peter Hutterer
4f74f8e685 test: add test for no scroll events before the scroll button timeout
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-14 10:47:58 +10:00
Eric Engestrom
7a81ba9cc2 Fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-06 07:42:03 +10:00
Peter Hutterer
a608d9dc2c touchpad: add quirk for the T450 and T460 generation hardware
The touchpad's sensors are too far apart (or the firmware interferes), causing
in a jerky movement visible especially on slow motion. We get a bunch of
normal motion events, then only ABS_MT_PRESSURE updates without x/y updates.
After about one mm of movement x/y updates resume, with the first event
covering the distance between the last motion event. That event is usually
accelerated and thus causes a large jump. Subsequent events are sufficiently
fine-grained again.

This patch counts the number of non-motion events. Once we hit 10 in a row, we
mark the first motion update as non-dirty, effectively discarding the motion
and thus stopping the pointer jumps.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-11 10:02:26 +10:00
Peter Hutterer
07420eec05 touchpad: init a default hysteresis for ALPS rushmore touchpads
https://bugs.freedesktop.org/show_bug.cgi?id=90590

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-10 08:08:31 +10:00
Peter Hutterer
f6c2d4b8b5 touchpad: drop motion hysteresis by default
Some older touchpad devices jitter a fair bit when a finger is resting on the
touchpad. That's why the hysteresis was introduced in the synaptics driver
back in 2011. However, the default value of the hysteresis in the synaptics
driver ended up being 0, even though the code looks like it's using a fraction
of the touchpad diagonal. When the hysteresis code was ported to libinput it
was eventually set to 0.5mm.

Turns out this is still too high and tiny finger motions are either
nonreactive or quite jumpy, making it hard to select small targets. Drop the
default hysteresis by reducing its margin to 0, but leave it in place for
those devices where we need them (e.g. the cyapa touchpads).

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-04 15:12:55 +10:00
Peter Hutterer
e19d5d228c evdev: disable the mode button on the Cyborg RAT 5
This button sends a release N, press N+1 on each press, cycling through the
three event codes supported. This causes a stuck button since the current mode
is never released.

Long-term this better served by a set of switches that toggle accordingly, for
now disable the button codes.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-01 08:37:41 +10:00
Peter Hutterer
7164d6eff5 tablet: hook up relative motion events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-22 16:16:55 +10:00
Peter Hutterer
91a568d1a1 Merge branch 'master' into tablet-support 2016-01-19 12:02:51 +10:00
Peter Hutterer
988cfda42c evdev: only reject devices with missing MT x/y if they're MT devices
A fake MT device may have ABS_MT_POSITION_X but not Y. In this case we don't
care, because we don't handle those axes anyway.

http://bugs.freedesktop.org/show_bug.cgi?id=93474

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-12 09:07:36 +10:00
Caibin Chen
b3f11180e3 touchpad: fix DWT pairing for Macbook Pro 2015
Label internal keyboards through the udev hwdb and only pair the internal
(usb) Apple touchpads with those keyboards labelled as such.

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

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-11 10:11:32 +10:00
Peter Hutterer
30df66d0a6 evdev: drain any pending evdev events on a device
open_restricted() doesn't always mean 'open the fd'. When the X server uses
systemd-logind, the fd is opened once before PreInit and then kept open across
devices being disabled and enabled through the protocol.

When the device is re-enabled and libinput_path_add_device is called for the
device, we may have events pending on the fd, leaking information that we
should just ignore.

There's also the potential of inconsistent state. The kernel updates the
device state whenever it processes an event, the evdev ioctls return that
state. If events are pending, the state we see is newer than the events we
process immediately after initialization. That can lead to confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-18 10:10:01 +10:00
Peter Hutterer
6261e4e61f Merge branch 'master' into tablet-support 2015-12-14 12:44:05 +10:00
Peter Hutterer
53c28a7d75 touchpad: add a special quirk for the Lenovo x220 with updated firmware
If an x220 is updated to the touchpad firmware version 8.1, the touchpad
suffers from the same issues as the x230 and needs custom acceleration code.
Unfortunately we cannot detect this otherwise, so it is left to the user as a
custom hwdb setting.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-14 08:25:56 +10:00
Peter Hutterer
eb9b05f407 Merge branch 'master' into tablet-support 2015-12-09 10:19:47 +10:00
Peter Hutterer
bd0f43eeb6 tablet: enable the calibration matrix for internal tablets
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-09 09:01:03 +10:00
Peter Hutterer
20db89f5c9 evdev: make evdev_transform_absolute available within libinput
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-09 08:59:49 +10:00
Peter Hutterer
147162da69 touchpad: don't set the axis for a 0.0 value in a scroll event
Once we trigger diagonal scrolling, the device's scroll direction is set as
horiz+vert. From then on, both axes will be set on every subsequent scroll
event, even when the actual delta for an axis is 0.

This causes continuous scroll stop events in clients that care about these
things.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-07 13:13:16 +10:00
Peter Hutterer
61b2ec3159 Ignore BTN_TOOL_* events when posting button events
These aren't real button events and they are handled elsewhere, either through
proper touch events on touchscreen or through custom handling in the touchpad
case.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-03 07:08:34 +10:00
Peter Hutterer
5074b59241 Merge branch 'master' into tablet-support 2015-11-24 15:18:47 +10:00
Peter Hutterer
b1b676e24a tablet: rename the tablet capability to a tablet_tool capability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
38f20850e1 evdev: init pointer acceleration for any device with pointer cap and rel x/y
The Asus RoG Gladius exposes two event nodes, one mouse, one keyboard. The
keyboard node has REL_X/Y and REL_HWHEEL on top of the various key bits and
ABS_VOLUME.

The keyboard node does not have BTN_* set, udev tags this device as a
keyboard only, not as a pointer but we still initialize the pointer caps for
it because of the wheel.

When moving this mouse, some deltas (ca "1 in every 20") are sent through the
keyboard node, causing a crash because we never initialized pointer
acceleration.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-30 11:18:18 +10:00
Peter Hutterer
91f11eb961 evdev: don't handle motion events if the device isn't a pointer device
This check is already in place for all other event types.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-28 10:04:19 +10:00
Peter Hutterer
8b6cc1cc95 evdev: log a bug for missing pointer accel on relative events
And use the unaccelerated motion events. Better than crashing, and better than
a non-moving mouse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-28 10:04:19 +10:00
Peter Hutterer
f012d78de4 evdev: whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-28 10:04:19 +10:00