summaryrefslogtreecommitdiff
path: root/src/evdev-mt-touchpad.c
AgeCommit message (Collapse)AuthorFilesLines
2017-07-02evdev-mt-touchpad: Enable timestamp smoothing support for bluetooth touchpadsHEADmasterHans de Goede1-1/+3
Bluetooth wreaks havoc with the timestamp of the input events coming from the touchpad, enable timestamp smoothing support to counter this. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2017-06-21touchpad: update the timestamp even when we only get other axesPeter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-21touchpad: rename tp_touch->millis to tp_touch->timePeter Hutterer1-7/+7
This is in µs and hasn't been in ms for a long time. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-19touchpad: use the "is internal keyboard" tag to enable dwtPeter Hutterer1-31/+10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23evdev: read LIBINPUT_ATTR_KEYBOARD_INTEGRATION propertyPeter Hutterer1-2/+1
We have heuristics for detecting whether a keyboard is internal or external, but in some cases (e.g. Surface 3) these heuristics fail. Add a udev property that we can apply to these cases so we have something that's reliable. This will likely eventually become ID_INPUT_KEYBOARD_INTEGRATION as shipped by systemd, similar to the touchpad property. https://bugs.freedesktop.org/show_bug.cgi?id=101101 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-11touchpad: pull the tap exclusion zone down to the full edge zonePeter Hutterer1-9/+2
This was originally left outside of the button areas in case users tap in those zones, but we're getting false tap events in that zone. On a 100mm touchpad, the edge zone is merely 5mm, it's acceptable to ignore taps in that area even in the software button. We can revisit this if we see tap detection failures in the future. https://bugzilla.redhat.com/show_bug.cgi?id=1415796 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-05-05touchpad: remove the lid switch listener on device_removedPeter Hutterer1-0/+6
Sequence triggered by the xorg driver, but basically: if the touchpad is destroyed before the lid switch, the event listener wasn't removed and an assertion was triggered. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04Merge branch 'wip/touchpad-tap-timestamps'Peter Hutterer1-0/+25
2017-05-03touchpad: make use of use tp_for_each_touchMarcos Paulo de Souza1-9/+3
Instead of reimplementing a for loop every time. Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28touchpad: add touch state debugging helperPeter Hutterer1-0/+25
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26Merge branch 'wip/touchpad-custom-pressure-values'Peter Hutterer1-12/+32
2017-04-26touchpad: move the pressure range to a hwdb entryPeter Hutterer1-12/+32
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: add MT_TOOL-based palm detectionPeter Hutterer1-0/+41
If the touchpad driver tells us something is a palm, go with that. https://bugs.freedesktop.org/show_bug.cgi?id=100243 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: add helper function for stopping current actionsPeter Hutterer1-6/+10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: move edge palm init to separate helperPeter Hutterer1-12/+18
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: always enable trackpoint palm detectionPeter Hutterer1-0/+2
Trackpoints are situated so that a user is pretty much guaranteed to trigger some palm interaction, even if on a small touchpad. Always enable trackpoint monitoring on touchpads where required. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: make palm detection logging a bit easierPeter Hutterer1-3/+21
Nested trinary conditions are fun, but... Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21touchpad: move edge palm detection into a helper tooPeter Hutterer1-14/+27
Just code cleanup, no changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-29touchpad: don't try to unhover touches in NONE statePeter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-23touchpad: add touchpad pressure state debugging to debug outputPeter Hutterer1-1/+6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-23evdev: mark the new log functions as printf-style functionsPeter Hutterer1-2/+1
And fix up the one buggy call we had Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-23touchpad: add pressure ranges for cyapa touchpadsPeter Hutterer1-0/+3
https://bugs.freedesktop.org/show_bug.cgi?id=100122 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-03-08touchpad: add elantech-specific pressure valuesPeter Hutterer1-3/+8
https://bugs.freedesktop.org/show_bug.cgi?id=99975 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-24evdev: standardize log messsagesPeter Hutterer1-54/+48
Prefix device log messages with the device's sysname so it's more obvious where the messages are coming from. This makes it much easier to grep for a specific device's messages but also adds some identifier to messages that were previously without any identifier (e.g. all the state machine debugging) All info and error messages also automatically prefix the device name, so those messages are standardised too, e.g an info message now: event4 - SynPS/2 Synaptics TouchPad: is tagged by udev as: Touchpad a debug message now: event4 - using pressure-based touch detection And since this required changing a lot of the strings in messages anyway, polish a few minor things too. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Hans de Goede <hdegoede@redhat.com>
2017-02-13touchpad: drop 'is blacklisted' check for dwt pairingPeter Hutterer1-22/+2
dwt is needed on internal touchpads only and those external ones that are a combo device. This also now gives us the same check for palm detect and dwt. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-13touchpad: add a hwdb quirk for (external) touchpad/keyboard combosPeter Hutterer1-2/+17
Specify the layout of the combo so we know when to initialize palm detection. This allows us to drop palm detection on external touchpads otherwise, replacing the wacom-specific check with something more generic.. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-09touchpad: mark the Apple onebutton touchpad as clickfinger-defaultPeter Hutterer1-1/+5
We don't initialize click methods on devices with physical buttons. This model is a special case, it's not a clickpad but it only has one button (because one button is all you ever need and whatnot). https://bugs.freedesktop.org/show_bug.cgi?id=99283 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-03Merge branch 'touchpad-pressure-based-v2'Peter Hutterer1-22/+109
2017-02-01Merge branch 'wip/switch-interface'Peter Hutterer1-20/+67
2017-01-31touchpad: remove unnecessary return statementPeter Hutterer1-2/+0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-31evdev: add a wrapper to get the evdev device from a libinput devicePeter Hutterer1-12/+12
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-31evdev: improve type-safety on dispatch switchesPeter Hutterer1-8/+6
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-30touchpad: use pressure values for touch is-down decisionPeter Hutterer1-22/+107
Don't rely on BTN_TOUCH for "finger down", the value for that is hardcoded in the kernel and not always suitable. Some devices need a different value to avoid reacting to accidental touches or hovering fingers. Implement a basic Schmitt trigger, same as we have in the synaptics driver. We also take the default values from there but these will likely see some updates. A special case is when we have more fingers down than slots. Since we can't detect the pressure on fake fingers (we only get a bit for 'is down') we assume that *all* fingers are down with sufficient pressure. It's too much of a niche case to have this work any other way. This patch drops the handling of ABS_DISTANCE because it's simply not needed anymore. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26touchpad: ignore hovering touches when tappingPeter Hutterer1-0/+2
We need to remember whether a tap was down or just hovering, otherwise we mess up the state machine when we send tap release events for taps that never switched to TOUCH_BEGIN. This is quick fix, really we should have a new state here, but that's a lot harder to implement. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26touchpad: check for a switch type before handling the eventPeter Hutterer1-12/+12
Don't call get_switch_event immediately, doing so for non-switch events is documented as a bug. Check the event type instead, if that one is correct then we can assume the rest works. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26Pair touchpad and lid_switch for disableJames Ye1-0/+49
Add listener for lid switch events, disable touchpad on switch event. 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-25touchpad: use a helper function for the libinput contextPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-23Drop normalized_get_direction, use physical distances insteadPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-23touchpad: convert normalized_length to physical coordinatesPeter Hutterer1-4/+3
Now that the acceleration code doesn't use dpi-normalized coordinates anymore, we don't need to use them in the touchpad code. Switch to physical distances instead, it makes debugging a lot saner. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-23touchpad: mask out ABS_MT if we don't have or disable MTPeter Hutterer1-0/+13
Make sure the events we deal with are the ones we actually honor. This reduces the chance that we accidentally process events we weren't event supposed to get based on some earlier device decision. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-21Merge branch 'touchpad-pointer-accel-revamp'Peter Hutterer1-2/+18
2016-12-21filter: change the filter functions to take raw device coordinatesPeter Hutterer1-2/+14
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-21touchpad: init the device's dpi correctlyPeter Hutterer1-0/+4
This has no real effect just yet because we don't use a touchpad's dpi anywhere in the touchpad code. Only the acceleration code wants it but all touchpads use the same acceleration method, and that one doesn't care about the dpi. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-20touchpad: if an external touchpad and keyboard share a VID/PID assume dwtPeter Hutterer1-2/+11
This requires to expand the blacklisting to be a bit more specific so we don't initialize dwt config on devices that won't need it. https://bugs.freedesktop.org/show_bug.cgi?id=99140 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14touchpad: convert two functions to use the device->phys helpersPeter Hutterer1-11/+13
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14touchpad: constify a few helper functionsPeter Hutterer1-1/+1
May help the compiler with further optimization Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-06touchpad: sync BTN_TOOL_FINGER state on initPeter Hutterer1-0/+8
The Elantech touchpad on my Asus Vivobook doesn't release BTN_TOOL_FINGER on up. If the touchpad was used before libinput initializes, the kernel filters the event because its state is already set. We never receive it and keep ignoring all events until the first switch to BTN_TOOL_DOUBLETAP and back. On touchpad init sync the BTN_TOOL_FINGER state and set it accordingly. This is the only event that can be legitimately down on init. We don't care about BTN_TOUCH because ignoring an ongoing touch on init is generally a good idea and we can ignore any multifinger gesture as well. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-01touchpad: add a quirk for the HP Pavilion dm4Peter Hutterer1-1/+11
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-11-30evdev: init axis range warnings for touch devices tooPeter Hutterer1-63/+13
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-23touchpad: only use the last two coordinates for delta calculationPeter Hutterer1-15/+5
Taking the last 4 points means factoring in a coordinate that may be more than 40ms in the past - or even more when the finger moves slowly and we don't get events for a while. This makes the pointer more sluggish and slower to catch up with what the finger is actually doing. We already have the motion hysteresis as a separate item to prevent jumps (and thus adds some delay to the movement), the calculation over time doesn't provide enough benefit to justify the sluggish pointer. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>