Commit 7bcbf8eb authored by Chase Douglas's avatar Chase Douglas

Allocate SynapticsPrivate.comm->hwState

This is needed for when SynapticsHwState can't be allocated on the stack.
Signed-off-by: default avatarChase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent a78d55d0
......@@ -211,7 +211,7 @@ ALPSReadHwState(InputInfoPtr pInfo,
struct CommData *comm, struct SynapticsHwState *hwRet)
{
unsigned char *buf = comm->protoBuf;
struct SynapticsHwState *hw = &(comm->hwState);
struct SynapticsHwState *hw = comm->hwState;
if (!ALPS_get_packet(comm, pInfo))
return FALSE;
......
......@@ -708,7 +708,7 @@ EventReadHwState(InputInfoPtr pInfo,
{
struct input_event ev;
Bool v;
struct SynapticsHwState *hw = &(comm->hwState);
struct SynapticsHwState *hw = comm->hwState;
SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
SynapticsParameters *para = &priv->synpara;
......
......@@ -521,7 +521,7 @@ PS2ReadHwStateProto(InputInfoPtr pInfo,
struct CommData *comm, struct SynapticsHwState *hwRet)
{
unsigned char *buf = comm->protoBuf;
struct SynapticsHwState *hw = &(comm->hwState);
struct SynapticsHwState *hw = comm->hwState;
SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
SynapticsParameters *para = &priv->synpara;
struct PS2SynapticsHwInfo *synhw;
......
......@@ -935,6 +935,7 @@ DeviceClose(DeviceIntPtr dev)
priv->timer = NULL;
free_shm_data(priv);
SynapticsHwStateFree(&priv->local_hw_state);
SynapticsHwStateFree(&priv->comm.hwState);
return RetValue;
}
......@@ -1184,6 +1185,8 @@ no_touch:
if (!priv->local_hw_state)
return !Success;
priv->comm.hwState = SynapticsHwStateAlloc(priv);
if (!alloc_shm_data(pInfo))
{
free(priv->local_hw_state);
......
......@@ -64,7 +64,7 @@ struct CommData {
int protoBufTail;
/* Used for keeping track of partial HwState updates. */
struct SynapticsHwState hwState;
struct SynapticsHwState *hwState;
Bool oneFinger;
Bool twoFingers;
Bool threeFingers;
......
......@@ -57,9 +57,11 @@ static void
reset_data(struct SynapticsHwState **hw, struct CommData *comm,
SynapticsPrivate *priv)
{
SynapticsHwStateFree(&comm->hwState);
memset(comm, 0, sizeof(struct CommData));
SynapticsHwStateFree(hw);
*hw = SynapticsHwStateAlloc(priv);
comm->hwState = SynapticsHwStateAlloc(priv);
}
/**
......@@ -190,6 +192,7 @@ test_read_hw_state(void)
free(private.proto_data);
SynapticsHwStateFree(&hw);
SynapticsHwStateFree(&comm.hwState);
}
static Bool
......@@ -315,6 +318,7 @@ test_ignore_hw_state(void)
free(private.proto_data);
SynapticsHwStateFree(&hw);
SynapticsHwStateFree(&hw_zero);
SynapticsHwStateFree(&comm.hwState);
}
int main (int argc, char **argv)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment