When resetting, reset the open slots to -1

open_slots holds the slot index, resetting it to 0 is a bad idea. And make
sure that we do reset after DEVICE_INIT. We already do so on DEVICE_CLOSE, but
after the first DEVICE_ON the data could still be random.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit afbbcfa10e)
This commit is contained in:
Peter Hutterer
2014-09-05 15:14:47 +10:00
parent fbf8df1669
commit ffd51448fb

View File

@@ -1010,6 +1010,8 @@ DeviceOn(DeviceIntPtr dev)
static void
SynapticsReset(SynapticsPrivate * priv)
{
int i;
SynapticsResetHwState(priv->hwState);
SynapticsResetHwState(priv->local_hw_state);
SynapticsResetHwState(priv->comm.hwState);
@@ -1039,7 +1041,9 @@ SynapticsReset(SynapticsPrivate * priv)
priv->prev_z = 0;
priv->prevFingers = 0;
priv->num_active_touches = 0;
memset(priv->open_slots, 0, priv->num_slots * sizeof(int));
for (i = 0; i < priv->num_slots; i++)
priv->open_slots[i] = -1;
}
static int
@@ -1337,6 +1341,8 @@ DeviceInit(DeviceIntPtr dev)
InitDeviceProperties(pInfo);
XIRegisterPropertyHandler(pInfo->dev, SetProperty, NULL, NULL);
SynapticsReset(priv);
return Success;
fail: