summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-01-19 13:05:49 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2012-01-26 15:53:18 +1000
commitefdc34859bdbcf0622e88aaf8af99944c1fc2141 (patch)
tree1ad7822b11537c04f02cc6c2736848090911a597
parentb1b9745979babd480574b41af155dfe5c06591f8 (diff)
eventcomm: Read evdev events from mtdev where multitouch is available
Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/eventcomm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 7c34bbe..43b8796 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -66,6 +66,7 @@ struct eventcomm_proto_data
*/
BOOL need_grab;
#ifdef HAVE_MTDEV
+ struct mtdev *mtdev;
int axis_map[MT_ABS_SIZE];
#endif
};
@@ -89,6 +90,16 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para)
proto_data->need_grab = FALSE;
+#ifdef HAVE_MTDEV
+ proto_data->mtdev = mtdev_new_open(pInfo->fd);
+ if (!proto_data->mtdev)
+ {
+ xf86IDrvMsg(pInfo, X_WARNING,
+ "failed to create mtdev instance, ignoring touch events\n");
+ priv->has_touch = FALSE;
+ }
+#endif
+
return TRUE;
}
@@ -354,10 +365,20 @@ EventQueryHardware(InputInfoPtr pInfo)
static Bool
SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
{
+#ifdef HAVE_MTDEV
+ SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
+ struct eventcomm_proto_data *proto_data = priv->proto_data;
+#endif
int rc = TRUE;
ssize_t len;
- len = read(pInfo->fd, ev, sizeof(*ev));
+#ifdef HAVE_MTDEV
+ if (proto_data->mtdev)
+ len = mtdev_get(proto_data->mtdev, pInfo->fd, ev, 1) *
+ sizeof(struct input_event);
+ else
+#endif
+ len = read(pInfo->fd, ev, sizeof(*ev));
if (len <= 0)
{
/* We use X_NONE here because it doesn't alloc */