Reset the touchpad if it has been out of sync for too long.

(By Hartwig Felger, cleaned up somewhat by me.) The synaptics manual
explains that the touchpad can revert to relative mode after a power
glitch or electrostatic discharge.
This commit is contained in:
Peter Osterlund
2003-08-02 13:07:33 +02:00
parent 106ccc8b50
commit 4b975c2b50
2 changed files with 13 additions and 4 deletions

View File

@@ -70,6 +70,8 @@
* Local Variables and Types
****************************************************************************/
#define MAX_UNSYNC_PACKETS 10 /* i.e. 10 to 60 bytes */
typedef enum {
BOTTOM_EDGE = 1,
TOP_EDGE = 2,
@@ -1604,17 +1606,24 @@ SynapticsGetPacket(LocalDevicePtr local, SynapticsPrivatePtr priv)
if (priv->protoBufTail >= 6) {
if (!PacketOk(priv)) {
int i;
priv->inSync = FALSE;
for (i = 0; i < priv->protoBufTail - 1; i++)
priv->protoBuf[i] = priv->protoBuf[i + 1];
priv->protoBufTail--;
priv->outOfSync++;
if(priv->outOfSync > MAX_UNSYNC_PACKETS)
{
priv->outOfSync = 0;
DBG(3, ErrorF("Synaptics synchronization lost too long -> reset touchpad.\n"));
QueryHardware(local); /* including a reset */
continue;
}
}
}
if(priv->protoBufTail >= 6)
{ /* Full packet received */
if(!priv->inSync) {
priv->inSync = TRUE;
if(priv->outOfSync > 0) {
priv->outOfSync = 0;
DBG(4, ErrorF("Synaptics driver resynced.\n"));
}
priv->protoBufTail = 0;

View File

@@ -111,7 +111,7 @@ typedef struct _SynapticsPrivateRec
XISBuffer *buffer;
unsigned char protoBuf[6]; /* Buffer for Packet */
unsigned char lastByte; /* letztes gelesene byte */
Bool inSync; /* Packets in sync */
int outOfSync; /* How many consecutive incorrect packets we have received */
int protoBufTail;
int fifofd; /* fd for fifo */
SynapticsTapRec touch_on; /* data when the touchpad is touched */