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

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 12 20:24:53 PDT 2010


On Fri, Oct 08, 2010 at 07:22:33PM +0200, Takashi Iwai wrote:
> 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.

if the events are really bogus, why doesn't the kernel driver filter them?

if they're not bogus but valid finger data, I need some more information on
what exactly happens, because this is a bit... odd.
We have a number of devices that send events outside the min/max range and
need to handle those, so I'm not sure this approach is the best.

Cheers,
  Peter
> 
> 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