mirror of
https://github.com/X11Libre/xf86-input-synaptics.git
synced 2026-04-14 11:54:16 +00:00
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:
15
synaptics.c
15
synaptics.c
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user