diff options
author | Alexandr Shadchin <alexandr.shadchin@gmail.com> | 2011-08-26 18:42:07 +0600 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-08-29 13:48:20 +1000 |
commit | 45d4a6bec01deac5cca6639c55062b110462155f (patch) | |
tree | 78826b10687c4bff548726ff7f3a92ee56b03af7 | |
parent | 2034e1e26497bce815eae0429f7e29faf2d9adaf (diff) |
On/Off hooks to return boolean so we can bail out of the caller
Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/eventcomm.c | 5 | ||||
-rw-r--r-- | src/ps2comm.c | 4 | ||||
-rw-r--r-- | src/synaptics.c | 13 | ||||
-rw-r--r-- | src/synproto.h | 4 |
4 files changed, 17 insertions, 9 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index d70e735..e0a6965 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -61,7 +61,7 @@ struct eventcomm_proto_data BOOL need_grab; }; -static void +static Bool EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) { SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; @@ -79,10 +79,13 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) if (ret < 0) { xf86IDrvMsg(pInfo, X_WARNING, "can't grab event device, errno=%d\n", errno); + return FALSE; } } proto_data->need_grab = FALSE; + + return TRUE; } /** diff --git a/src/ps2comm.c b/src/ps2comm.c index 3178175..b7995ee 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -369,11 +369,13 @@ ps2_print_ident(InputInfoPtr pInfo, const struct PS2SynapticsHwInfo *synhw) } } -static void +static Bool PS2DeviceOffHook(InputInfoPtr pInfo) { ps2_synaptics_reset(pInfo->fd); ps2_synaptics_enable_device(pInfo->fd); + + return TRUE; } static Bool diff --git a/src/synaptics.c b/src/synaptics.c index 106b4b8..994bf4c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -845,8 +845,9 @@ DeviceOn(DeviceIntPtr dev) return !Success; } - if (priv->proto_ops->DeviceOnHook) - priv->proto_ops->DeviceOnHook(pInfo, &priv->synpara); + if (priv->proto_ops->DeviceOnHook && + !priv->proto_ops->DeviceOnHook(pInfo, &priv->synpara)) + return !Success; priv->comm.buffer = XisbNew(pInfo->fd, INPUT_BUFFER_SIZE); if (!priv->comm.buffer) { @@ -878,14 +879,16 @@ DeviceOff(DeviceIntPtr dev) { InputInfoPtr pInfo = dev->public.devicePrivate; SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + Bool rc = Success; DBG(3, "Synaptics DeviceOff called\n"); if (pInfo->fd != -1) { TimerCancel(priv->timer); xf86RemoveEnabledDevice(pInfo); - if (priv->proto_ops->DeviceOffHook) - priv->proto_ops->DeviceOffHook(pInfo); + if (priv->proto_ops->DeviceOffHook && + !priv->proto_ops->DeviceOffHook(pInfo)) + rc = !Success; if (priv->comm.buffer) { XisbFree(priv->comm.buffer); priv->comm.buffer = NULL; @@ -894,7 +897,7 @@ DeviceOff(DeviceIntPtr dev) pInfo->fd = -1; } dev->public.on = FALSE; - return Success; + return rc; } static Bool diff --git a/src/synproto.h b/src/synproto.h index f9af37c..6962bbf 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -70,8 +70,8 @@ struct CommData { struct _SynapticsParameters; struct SynapticsProtocolOperations { - void (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); - void (*DeviceOffHook)(InputInfoPtr pInfo); + Bool (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); + Bool (*DeviceOffHook)(InputInfoPtr pInfo); Bool (*QueryHardware)(InputInfoPtr pInfo); Bool (*ReadHwState)(InputInfoPtr pInfo, struct CommData *comm, struct SynapticsHwState *hwRet); |