Debouncing the touch panel
The A5 touch panel produces touch events at /dev/input/touchscreen0, assuming you're using udev. Unfortunately, it produces events in a deluge whenever the pointer is anywhere near the screen. Most X applications cope well enough with a torrent of motion and proximity events, but the torrent of button events is a bigger problem. Essentially, anything that expects screen taps is likely to have a problem.
A quick-and-dirty fix can be implemented in the tslib input driver. In the Angstrom source distribution this is in the package `xf86-input-tslib'.
At around line 177 in tslib.c, change:
xf86PostButtonEvent(local->dev, TRUE,
1, !!samp.pressure, 0, 2,
priv->lastx,
priv->lasty);
To
long t = samp.tv.tv_usec + samp.tv.tv_sec * 1000000;
if (t - lastButton > buttonIntervalUsec || !samp.pressure)
{
xf86PostButtonEvent(local->dev, TRUE,
1, !!samp.pressure, 0, 2,
priv->lastx,
priv->lasty);
}
lastButton = t;
and add at the top:
long lastButton = 0; long buttonIntervalUsec = 100000;
The effect of this change is to ignore all button-down events that are less that buttonInternalUsec microseconds apart.
This is a very crude fix but I've found it to work reasonably well in practice.
Attachments
-
tslib.c
(10.4 KB) - added by kevin
2 years ago.
Patched tslib.c
-
tslib_drv.so
(6.7 KB) - added by kevin
2 years ago.
Patched driver binary
