summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2018-03-09Merge branch 'wip/hysteresis-wobbles'Peter Hutterer4-9/+64
2018-03-09Extract and reset the abs fuzz value for the x/y axesPeter Hutterer2-0/+42
The kernel fuzz handling is buggy, especially when we want to rely on the fuzz value for our hysteresis. But since this is a hw property and (at least sometimes) set by the driver, we can't make this a pure libinput hwdb set either. So our workaround is: * extract the (non-zero) fuzz into a udev property so we don't lose it * set the fuzz to 0 to disable the in-kernel hysteresis * overwrite our internal absinfo with the property fuzz This way we get to use the hw-specified fuzz without having the kernel muck around with it. We also get to use the EVDEV_ABS_ values in 60-evdev.hwdb to override a driver-set fuzz. Two drawbacks: - we're resetting the kernel fuzz to 0, this affects any other users of the device node. That's probably a minor impact only. - we can only save this in a udev property there's a risk of this information getting lost when playing around with udev rules. That too should be a minor issue. https://bugs.freedesktop.org/show_bug.cgi?id=105303 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-09touchpad: enable hysteresis based on a 0 fuzz valuePeter Hutterer1-1/+3
If the fuzz is 0, assume we don't need hysteresis and use the wobble detection code instead. If the fuzz is non-zero, enable it by default. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-09touchpad: use the fuzz value (if any) for the hysteresis marginPeter Hutterer1-5/+15
We currently used 0.5mm on touchpads as hysteresis value. This causes pointer movement delays, it is likely too high. Reduce it to a kernel-set fuzz value (if any) and see how we go with that. On many touchpads, the fuzz is 8 which would be closer to 0.2mm on e.g. a T440. Note that the does some defuzzing anyway, but the response of that function is nonlinear, e.g. for a fuzz of 8, the physical deltas map to: phys 0..3 → delta 0 phys 4..7 → delta 1 phys 8..15 → delta 4, 5, 6, 7 phys 16..N → delta 16..N In other words, we never see some logical deltas 2 and 3. While this shouldn't matter given the average touchpad resolution, reducing the hysteresis margin is likely to provide some better response. We never see values 8-15 either which could be the cause of some pointer jumps we've been seeing. see https://bugs.freedesktop.org/show_bug.cgi?id=105303 Devices with a fuzz of 0 have the hysteresis margin reduced to 0.25mm (from 0.5mm). https://bugs.freedesktop.org/show_bug.cgi?id=105108 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-09fallback: fix touchscreen defuzzingPeter Hutterer1-3/+4
The hysteresis-returned point always differs from the current point, even if the hysteresis kicks in. We need to compare to the hysteresis center. And the returned point is only the new center if we exceed the margin, otherwise the center stays as-is. The touch_fuzz() test only succeeded for this because for the values we were introducing jitter by, the kernel filtered out all the actual movement so these paths weren't hit. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-07touchpad: handle a palm down in the tapped statePeter Hutterer1-1/+1
We expected the first event after TAPPED to be a finger down. If that finger has been recognised as palm, the finger state isn't TOUCH_BEGIN so we get an invalid state in our FSM. libinput bug: 0: invalid tap event TAP_EVENT_PALM in state TAP_STATE_TAPPED https://bugs.freedesktop.org/show_bug.cgi?id=105370 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-06tools: add the git version in the libinput-record outputPeter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-05touchpad: enable palm detection on tablets' touchpadsPeter Hutterer3-6/+21
https://bugs.freedesktop.org/show_bug.cgi?id=104986 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-05touchpad: init touch size range based on the udev propertyPeter Hutterer1-8/+6
No need to hardcode Apple here, if we have a udev property for this, let's use it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-05pad: use libwacom to get the evdev to button number mappingPeter Hutterer1-6/+68
Some of wacom's tablets, notably the Bamboo series, have a non-predictable scheme of mapping the buttons to numeric button numbers in libwacom. Since we promise sequential button numbers, we need to have those identical to libwacom, otherwise it's impossible to map the two together. Most tablets have a predictable mapping, so this does not affect the majority of devices. For the old-style bamboos, this swaps the buttons around with the buttons being ordered vertically top-to-bottom in libwacom. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2018-03-05Introduce omnidirectional (elliptical) hysteresisDaniel van Vugt3-55/+71
This changes the hysteresis region to an ellipse (usually a circle), where previously it was a rectangle (usually square). Using an ellipse means the algorithm is no longer more sensitive in some directions than others. It is now omnidirectional, which solves a few problems: * Moving a finger in small circles now creates circles, not squares. * Moving a finger in a curve no longer snaps the cursor to vertical or horizontal lines. The cursor now follows a similar curve to the finger. https://bugs.freedesktop.org/page.cgi?id=splinter.html&bug=105306 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-05Merge branch 'wip/touchpad-maybe-end-state'Peter Hutterer3-25/+93
2018-03-02touchpad: add wobbling detectionKonstantin Kharlamov2-1/+59
The details are explained in comment in the code. That aside, I shall mention the check is so light, that it shouldn't influence CPU performance even a bit, and can blindly be kept always enabled. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104828 Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-03-01touchpad: remove the code for disabling hysteresisKonstantin Kharlamov1-20/+1
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-03-01touchpad: move the hysteresis into its own substructPeter Hutterer2-6/+8
Prep work for the wobbling detection patch Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-03-01touchpad: add a TOUCH_MAYBE_END statePeter Hutterer3-23/+87
This state is used by the pre-processing of the touch states to indicate that the touch point has ended and is changed to TOUCH_END as soon as that pre-processing is finished. Sometimes we have to resurrect a touch point that has physically or logically ended but needs to be kept around to keep the BTN_TOOL_* fake finger count happy. Particularly on Synaptics touchpads, where a BTN_TOOL_TRIPLETAP can cause a touch point to end (i.e. 1 touch down + TRIPLETAP) but that touch restarts in the next sequence. We had a quirk for this in place already, but if we end the touch and then re-instate it with tp_begin_touch(), we may lose some information about thumb/palm/etc. states that touch already had. As a result, the state machines can get confused and a touch that was previously ignored as thumb suddenly isn't one anymore and triggers assertions. The specific sequence in bug 10528 is: * touch T1 down * touch T2 down, detected as speed-based thumb, tap state machine ignores it * frame F: TRIPLETAP down, touch T2 up * frame F+1: touch T2 down in next frame, but without the thumb bit * frame F+n: touch T2 ends, tap state machine gets confused because that touch should not trigger a release https://bugs.freedesktop.org/show_bug.cgi?id=105258 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01touchpad: don't end below-threshold pressure touches if nfake_fingers > nslotsPeter Hutterer1-1/+3
If we have more BTN_TOOL_*TAP fingers down than we have slots, ignore any below-threshold pressure changes on the slots. When a touchpad only detects two touches, guessing whether the third touch has sufficient pressure is unreliable. Instead, always assume that all touches have sufficient pressure when we exceed the slot number. Exception: if all real fingers are below the pressure threshold, the fake fingers are ignored too. Related to https://bugs.freedesktop.org/show_bug.cgi?id=105258 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01touchpad: add the pressure thresholds to the debugging outputPeter Hutterer1-1/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01touchpad: don't do speed-based thumb detection on single-touch or semi-mtsPeter Hutterer1-0/+4
Because life is too short for this https://bugs.freedesktop.org/show_bug.cgi?id=105265 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-27Whitespace fixPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-23evdev: remove excessive debugging outputPeter Hutterer1-1/+1
Accidentally committed in 2a378beab032d74277 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21touchpad: delay arbitration by 90ms after touch togglePeter Hutterer3-7/+52
When drawing on a tablet, the hand usually rests on the device, causing touch events. The kernel arbitrates for us in most cases, so we get a touch up and no events while the stylus is in proximity. When lifting the hand off in a natural position, the hand still touches the device when the pen goes out of proximity. This is 'immediately' followed by the hand lifting off the device. When kernel pen/touch arbitration is active, the pen proximity out causes a touch begin for the hand still on the pad. This is followed by a touch up when the hand lifts which happens to look exactly like a tap-to-click. Fix this by delaying the 'arbitration is now off' toggle, causing any touch that starts immediately after proximity out to be detected as palm and ignored for its lifetime. https://bugs.freedesktop.org/show_bug.cgi?id=104985 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21evdev: pass the time down to toggle_touchPeter Hutterer4-9/+18
Currently unused, will be used in later patches Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21touchpad: change the stylus palm arbitration to process touchesPeter Hutterer2-10/+25
Previously, on touch toggle (invoked by the tablet when a pen goes in proximity) the touchpad cleared the state and ignored any events. Since we ignore touches that we didn't see the touch begin for, this handled the cases of a touch remaining after proximity out. This code pre-dates palm detection, so let's take the bluetack off and instead integrate it with proper palm detectino.
2018-02-21touchpad: reset the palm state to NONE on a new touchPeter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-20touchpad: only begin fake touches when we have at least one finger downPeter Hutterer2-7/+10
If a single-touch touchpad drops below the pressure threshold in the same frame where a fake finger is added, we begin a fake touch here. The subsequent loop ends this fake touch because real_fingers_down is 0. This causes the tapping code to have a mismatch of how many fingers are down because it never sees the touch begin event for that finger. https://bugs.freedesktop.org/show_bug.cgi?id=105160
2018-02-20touchpad: add a touch index for debuggingPeter Hutterer5-29/+52
Makes debugging a bit easier when you know *which* touch was marked as palm, etc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-20touchpad: compress a statementPeter Hutterer1-4/+2
Having this initialized and then changed later is more confusing that having the trinary here in one line
2018-02-16udev: fix segfault when resuming before assigning a seatPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16Don't leak when realloc failsPeter Hutterer1-2/+6
Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16meson: Fix absolute libdir case in install scriptQuentin Glidic1-2/+2
If libdir is an absolute path (which means it’s outside of prefix) we would wrongly add the prefix to it in the install script. Just pass the correct libdir from Meson directly thanks to join_paths() magic. Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13Add a test device for aiptek tabletsPeter Hutterer2-0/+8
This tablet advertises tilt but doesn't actually have it. Let's rule out tilt for all aiptek devices until someone complains. Recording from: https://bugzilla.redhat.com/show_bug.cgi?id=1535755 Related to: https://bugs.freedesktop.org/show_bug.cgi?id=104911 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13tablet: fake a BTN_TOOL_PEN on the first event if neededPeter Hutterer1-13/+27
Some (?) Aiptek tablets have BTN_TOOL_PEN but aren't inclined to actually send this on proximity in. This means we don't have a tool assigned and ignore the events. This patch piggy-backs on the already-existing proximity-out quirks. On the first EV_SYN and if the tool is still NONE (i.e. no BTN_TOOL_* was received), we pretend that we've earlier forced a proximity-out event for this tablet. This causes the proximity-out quirk code to emulate a proximity in and we're off. Hooray. https://bugs.freedesktop.org/show_bug.cgi?id=104911 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13tablet: disable BTN_TOOL_MOUSE/LENS for non-Wacom tabletsPeter Hutterer1-0/+7
Mouse and lens cursor tools are rare and the rotation calculation is quirky to say the least. I don't have access to a non-Wacom mouse tool, so until this changes, just disable those tools and wait for someone to shout. This is a much easier fix than trying to figure out the correct generic rotation calculation that may not be correct anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13tablet: skip tablet_flush() if our current tool type is nonePeter Hutterer1-5/+9
If a tablet never sends a BTN_TOOL_foo, we never update the tool and we remain on the 'none' tool. Somewhat related to: https://bugzilla.redhat.com/show_bug.cgi?id=1535755 https://bugs.freedesktop.org/show_bug.cgi?id=104911 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13tablet: release the tablet state on device deletePeter Hutterer1-0/+6
When the device gets deleted in a non-neutral state, we need to release all buttons, lift the tip up and send a proximity out event. https://bugs.freedesktop.org/show_bug.cgi?id=104940 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13tablet: move the quirk disabling up within tablet_initPeter Hutterer1-6/+6
Let's make sure all libevdev manipluations are done before we start initializing anything based on the event codes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13evdev: add a quirk to disable debouncing on the MS Nano TranscieversPeter Hutterer4-1/+41
A set of wireless devices that can scramble the timestamps, so we get press/release within 8ms even though I doubt the user is capable of doing this. Since they're generally good quality anyway, let's just disable debouncing on those until someone complains and we need something more sophisticated. https://bugs.freedesktop.org/show_bug.cgi?id=104415 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13evdev: fail before open_restricted if the devnode doesn't existPeter Hutterer1-0/+8
https://bugzilla.redhat.com/show_bug.cgi?id=1536633 https://bugzilla.redhat.com/show_bug.cgi?id=1539046 https://bugzilla.redhat.com/show_bug.cgi?id=1539783 https://bugzilla.redhat.com/show_bug.cgi?id=1540662 https://bugs.freedesktop.org/show_bug.cgi?id=104278 Debugged-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-09tablet: don't set rotation on a tool if we don't have ABS_ZPeter Hutterer1-1/+11
Rotation on a tool can either ABS_Z or in the case of the mouse/lens tools a combination of ABS_TILT_X/Y. The code assumes that if the rotation on a stylus (not mouse/lense) changes, we need to fetch it from ABS_Z. This happens on the very first event from the tablet, proximity in invalidates all axes so we can send the current state to the caller. On libwacom-recognized tablets we never set the rotation bit on the stylus, so that's all fine. On tablets without libwacom support, the stylus may have a rotation bit copied because we have it set thanks to mouse+tilt on the tablet. When that first event is handled, we try to access ABS_Z. On tablets without ABS_Z like Aipteks, we go boom. Fix this by checking for ABS_Z during tablet init, if we don't have that axis then never set the rotation bit on the tool. That's the only axis where we need this, all other axes have a single cause only and thus the tablet bits are accurate anyway. https://bugs.freedesktop.org/show_bug.cgi?id=104939 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-07tablet: remove obsolete BTN_TOUCH casePeter Hutterer1-2/+0
We filter BTN_TOUCH in the caller, so this cannot happen here. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-07tablet: drop unnecessary switch case statementsPeter Hutterer1-10/+0
We fall through to the default statement anyway Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-06timer: change the timer offset warning to a client bugPeter Hutterer1-4/+4
This looks like a libinput bug (well, it does say "libinput bug" on the package) but it hasn't been that for a long time. The cause is almost always insufficient motivation to call libinput_dispatch() by the caller, or at least not doing it with the celerity libinput demands (and deserves, if I may say so). Up-, down- or side-grade it to a client bug, so the outrage can be directed elsewhere, preferably away from me. And add a section to the documentation, just in case someone actually reads this stuff. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2018-02-06evdev: log all evdev_msg_* on one linePeter Hutterer1-12/+11
So we don't have to have newline handling in the callers. This effectively reverts 6ab2999be90331 "test: detect linebreaks in log messages". https://bugs.freedesktop.org/show_bug.cgi?id=104957 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-05evdev: whitespace fixPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-23fallback: remove unused DEBOUNCE_TIME settingPeter Hutterer1-2/+0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-10touchpad: drop the double normalizationPeter Hutterer4-50/+63
Previously, touchpad deltas were converted to 1000-dpi normalized coordinates and handled from there. This changed in bdd4264d6150f4a6248eec7e1fbf (1.6) when the filter functions started taking device coordinates instead. Since then, we used to convert the device delta to normalized coordinates, then (often immediately) convert back to device coordinates, albeit for equal x/y resolution. This isn't necessary, we can just convert the device coordinates to x/y-equal resolution device coordinates and pass those on. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-09touchpad: don't disable the hysteresis unless a finger is downPeter Hutterer1-1/+2
On the very first event, the last_motion_time set by tp_begin_touch is not yet set because we are called before the pressure-based touch detection takes effect. And any event timestamp is more than 80ms after a zero timestamp, causing the hysteresis to always be disabled. https://bugs.freedesktop.org/show_bug.cgi?id=98839#c74 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-09path: if the udev device is never initialized, bailPeter Hutterer1-1/+1
2000ms should be enough, if that fails let's bail completely. Related to: https://bugs.freedesktop.org/show_bug.cgi?id=104278 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-18tablet: break up a long linePeter Hutterer1-1/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>