Commit 45d4a6be authored by Alexandr Shadchin's avatar Alexandr Shadchin Committed by Peter Hutterer

On/Off hooks to return boolean so we can bail out of the caller

Signed-off-by: default avatarAlexandr Shadchin <Alexandr.Shadchin@gmail.com>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 2034e1e2
......@@ -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;
}
/**
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
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