summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/synaptics-x11.c6
-rw-r--r--src/synaptics.c18
-rw-r--r--src/synaptics.h10
3 files changed, 30 insertions, 4 deletions
diff --git a/src/synaptics-x11.c b/src/synaptics-x11.c
index 18f587c..0544638 100644
--- a/src/synaptics-x11.c
+++ b/src/synaptics-x11.c
@@ -385,8 +385,7 @@ DeviceOn(DeviceIntPtr dev)
return !Success;
}
- if (priv->proto_ops->DeviceOnHook &&
- !priv->proto_ops->DeviceOnHook(priv, &priv->synpara, pInfo->fd))
+ if (!SynapticsEnableDevice(priv, pInfo->fd))
return !Success;
xf86FlushInput(pInfo->fd);
@@ -417,8 +416,7 @@ DeviceOff(DeviceIntPtr dev)
xf86RemoveEnabledDevice(pInfo);
SynapticsReset(priv);
- if (priv->proto_ops->DeviceOffHook &&
- !priv->proto_ops->DeviceOffHook(priv, pInfo->fd))
+ if (!SynapticsDisableDevice(priv, pInfo->fd))
rc = !Success;
xf86CloseSerial(pInfo->fd);
pInfo->fd = -1;
diff --git a/src/synaptics.c b/src/synaptics.c
index 30de7ac..4c62f0c 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -640,6 +640,24 @@ SynapticsInitDevice(SynapticsPrivate *priv)
return !Success;
}
+Bool
+SynapticsEnableDevice(SynapticsPrivate *priv, int fd)
+{
+ if (priv->proto_ops->DeviceOnHook &&
+ !priv->proto_ops->DeviceOnHook(priv, &priv->synpara, fd))
+ return 1;
+ return 0;
+}
+
+Bool
+SynapticsDisableDevice(SynapticsPrivate *priv, int fd)
+{
+ if (priv->proto_ops->DeviceOffHook &&
+ !priv->proto_ops->DeviceOffHook(priv, fd))
+ return 1;
+ return 0;
+}
+
/* return angle of point relative to center */
static double
angle(SynapticsPrivate * priv, int x, int y)
diff --git a/src/synaptics.h b/src/synaptics.h
index e637e1a..f5805b3 100644
--- a/src/synaptics.h
+++ b/src/synaptics.h
@@ -60,6 +60,16 @@ void SynapticsReadInput(SynapticsPrivate *priv, int fd);
*/
Bool SynapticsInitDevice(SynapticsPrivate *priv);
/**
+ * Enable the backend to start sending events.
+ * Implemented-by: core
+ */
+Bool SynapticsEnableDevice(SynapticsPrivate *priv, int fd);
+/**
+ * Disable the backend to stop sending events.
+ * Implemented-by: core
+ */
+Bool SynapticsDisableDevice(SynapticsPrivate *priv, int fd);
+/**
* Shut down the device. Call this after disabling the file descriptor.
* Implemented-by: core
*/