[xorg-x11-drv-synaptics/f21] Restore cursor jumping patch (#1149377)

Peter Hutterer whot at fedoraproject.org
Thu Feb 12 23:06:18 UTC 2015


commit 28a5e6cb0493a21595fb8a8720147647de8a97e4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 13 09:04:39 2015 +1000

    Restore cursor jumping patch (#1149377)

 0001-Limit-the-movement-to-20-mm-per-event.patch |  113 ++++++++++++++++++++++
 xorg-x11-drv-synaptics.spec                      |    6 +-
 2 files changed, 118 insertions(+), 1 deletions(-)
---
diff --git a/0001-Limit-the-movement-to-20-mm-per-event.patch b/0001-Limit-the-movement-to-20-mm-per-event.patch
new file mode 100644
index 0000000..07f7141
--- /dev/null
+++ b/0001-Limit-the-movement-to-20-mm-per-event.patch
@@ -0,0 +1,113 @@
+From f9155de44f1a94cccaca061231830b3c3e2277cd Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Tue, 16 Sep 2014 08:52:56 +1000
+Subject: [PATCH synaptics] Limit the movement to 20 mm per event
+
+Touchpads are limited by a fixed sampling rate (usually 80Hz). Some finger
+changes may happen too fast for this sampling rate, resulting in two distinct
+event sequences:
+* finger 1 up and finger 2 down in the same EV_SYN frame. Synaptics sees one
+  finger down before and after and the changed coordinates
+* finger 1 up and finger 2 down _between_ two EV_SYN frames. Synaptics sees one
+  touchpoint move from f1 position to f2 position.
+
+That move causes a large cursor jump. The former could be solved (with
+difficulty) by adding fake EV_SYN handling after releasing touchpoints but
+that won't fix the latter case.
+
+So as a solution for now limit the finger movement to 20mm per event.
+Tests on a T440 and an x220 showed that this is just above what a reasonable
+finger movement would trigger. If a movement is greater than that limit, reset
+it to 0/0.
+
+On devices without resolution, use 0.25 of the touchpad's diagonal instead.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Hans de Goede <hdegoede at redhat.com>
+(cherry picked from commit 41b2312c006fca1f24e1a366174d3203a63fa04a)
+---
+ src/synaptics.c    | 33 +++++++++++++++++++++++++++++++++
+ src/synapticsstr.h |  2 ++
+ 2 files changed, 35 insertions(+)
+
+diff --git a/src/synaptics.c b/src/synaptics.c
+index 08b90f4..4730777 100644
+--- a/src/synaptics.c
++++ b/src/synaptics.c
+@@ -786,6 +786,23 @@ set_default_parameters(InputInfoPtr pInfo)
+         pars->resolution_vert = 1;
+     }
+ 
++    /* Touchpad sampling rate is too low to detect all movements.
++       A user may lift one finger and put another one down within the same
++       EV_SYN or even between samplings so the driver doesn't notice at all.
++
++       We limit the movement to 20 mm within one event, that is more than
++       recordings showed is needed (17mm on a T440).
++      */
++    if (pars->resolution_horiz > 1 &&
++        pars->resolution_vert > 1)
++        pars->maxDeltaMM = 20;
++    else {
++        /* on devices without resolution set the vector length to 0.25 of
++           the touchpad diagonal */
++        pars->maxDeltaMM = diag * 0.25;
++    }
++
++
+     /* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */
+     if (pars->top_edge > pars->bottom_edge) {
+         int tmp = pars->top_edge;
+@@ -2236,6 +2253,13 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
+     *dy = integral;
+ }
+ 
++/* Vector length, but not sqrt'ed, we only need it for comparison */
++static inline double
++vlenpow2(double x, double y)
++{
++    return x * x + y * y;
++}
++
+ /**
+  * Compute relative motion ('deltas') including edge motion.
+  */
+@@ -2245,6 +2269,7 @@ ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw,
+ {
+     enum MovingState moving_state;
+     double dx, dy;
++    double vlen;
+     int delay = 1000000000;
+ 
+     dx = dy = 0;
+@@ -2290,6 +2315,14 @@ ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw,
+  out:
+     priv->prevFingers = hw->numFingers;
+ 
++    vlen = vlenpow2(dx/priv->synpara.resolution_horiz,
++                    dy/priv->synpara.resolution_vert);
++
++    if (vlen > priv->synpara.maxDeltaMM * priv->synpara.maxDeltaMM) {
++        dx = 0;
++        dy = 0;
++    }
++
+     *dxP = dx;
+     *dyP = dy;
+ 
+diff --git a/src/synapticsstr.h b/src/synapticsstr.h
+index e245c60..319fddc 100644
+--- a/src/synapticsstr.h
++++ b/src/synapticsstr.h
+@@ -226,6 +226,8 @@ typedef struct _SynapticsParameters {
+     int area_left_edge, area_right_edge, area_top_edge, area_bottom_edge;       /* area coordinates absolute */
+     int softbutton_areas[4][4]; /* soft button area coordinates, 0 => right, 1 => middle , 2 => secondary right, 3 => secondary middle button */
+     int hyst_x, hyst_y;         /* x and y width of hysteresis box */
++
++    int maxDeltaMM;               /* maximum delta movement (vector length) in mm */
+ } SynapticsParameters;
+ 
+ struct _SynapticsPrivateRec {
+-- 
+2.1.0
+
diff --git a/xorg-x11-drv-synaptics.spec b/xorg-x11-drv-synaptics.spec
index a5a6269..68612ff 100644
--- a/xorg-x11-drv-synaptics.spec
+++ b/xorg-x11-drv-synaptics.spec
@@ -8,7 +8,7 @@
 Name:           xorg-x11-drv-synaptics
 Summary:        Xorg X11 Synaptics touchpad input driver
 Version:        1.8.1
-Release:        3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
+Release:        4%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
 URL:            http://www.x.org
 License:        MIT
 Group:          User Interface/X Hardware Support
@@ -24,6 +24,7 @@ Source3:        50-synaptics.conf
 Source4:        70-touchpad-quirks.rules
 
 Patch01:        0001-Support-the-new-Lenovo-X1-Carbon-3rd-trackpoint-butt.patch
+Patch02:        0001-Limit-the-movement-to-20-mm-per-event.patch
 
 ExcludeArch:    s390 s390x
 
@@ -148,6 +149,9 @@ Development files for the Synaptics TouchPad for X.Org.
 %{_includedir}/xorg/synaptics-properties.h
 
 %changelog
+* Fri Feb 13 2015 Peter Hutterer <peter.hutterer at redhat.com> 1.8.1-4
+- Restore cursor jumping patch (#1149377)
+
 * Thu Feb 05 2015 Peter Hutterer <peter.hutterer at redhat.com> 1.8.1-3
 - Fix missing bits and bobs for the X1 Carbon quirks (#1189329)
 


More information about the scm-commits mailing list