[PATCH 09/18] Avoid bogus coord reporting with clickpad devices

Takashi Iwai tiwai at suse.de
Fri Oct 8 10:22:33 PDT 2010


When a clickpad device without multi-touch kernel support is used,
it gives wrong positions and leads to the annoying pointer jumps.
Filter the bogus events out in such a case.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 src/eventcomm.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 517e6c3..76ff69d 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -363,6 +363,21 @@ EventReadHwState(InputInfoPtr pInfo,
     struct SynapticsHwState *hw = &(comm->hwState);
     SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
     SynapticsParameters *para = &priv->synpara;
+    int minx, miny, maxx, maxy, x;
+
+    /* range to filger out; a bit wider range is allowed since some devices
+     * are too fuzzy and give slightly shifted positions
+     */
+    minx = priv->minx;
+    maxx = priv->maxx;
+    x = (maxx - minx) / 5;
+    minx -= (minx > x) ? x : minx;
+    maxx += x;
+    miny = priv->miny;
+    maxy = priv->maxy;
+    x = (maxy - miny) / 5;
+    maxy += miny;
+    miny -= (miny > x) ? x : miny;
 
     while (SynapticsReadEvent(pInfo, &ev)) {
 	switch (ev.type) {
@@ -377,6 +392,9 @@ EventReadHwState(InputInfoPtr pInfo,
 		    hw->numFingers = 3;
 		else
 		    hw->numFingers = 0;
+		/* if the coord is out of range, we filter it out */
+		if (priv->is_clickpad && hw->z > 0 && (hw->x < minx || hw->x > maxx || hw->y < miny || hw->y > maxy))
+			return FALSE;
 		*hwRet = *hw;
 		return TRUE;
 	    }
-- 
1.7.3.1



More information about the xorg-devel mailing list