[PATCH xf86-input-synaptics v2 4/5] Don't initialize touch state if device does is not multitouch

Chase Douglas chase.douglas at canonical.com
Thu Feb 2 13:19:17 PST 2012


And don't attempt to use it either.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
Changes since v1:
* check has_touch before uninitializing touch state. This matches the touch
  initialization.
* Put this commit before "Don't initialize semi-multitouch devices for touch
  device class" so we don't crash during a git bisect.

 src/eventcomm.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 18a0911..26c846e 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -108,7 +108,7 @@ UninitializeTouch(InputInfoPtr pInfo)
     SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
     struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data*)priv->proto_data;
 
-    if (!proto_data->mtdev)
+    if (!priv->has_touch)
         return;
 
     free(proto_data->open_slots);
@@ -136,6 +136,9 @@ InitializeTouch(InputInfoPtr pInfo)
     struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data*)priv->proto_data;
     int i;
 
+    if (!priv->has_touch)
+        return;
+
     proto_data->mtdev = mtdev_new_open(pInfo->fd);
     if (!proto_data->mtdev)
     {
@@ -630,7 +633,7 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct CommData *comm,
     SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
     struct eventcomm_proto_data *proto_data = priv->proto_data;
 
-    if (!proto_data)
+    if (!proto_data || !priv->has_touch)
         return;
 
     if (ev->code == ABS_MT_SLOT)
-- 
1.7.8.3



More information about the xorg-devel mailing list