summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@ubuntu.com>2010-11-08 14:35:02 -0500
committerChase Douglas <chase.douglas@ubuntu.com>2010-11-08 15:20:43 -0500
commitf2d2c8bd25392dc0ceb0b50b147c1a311ed1cd2a (patch)
tree3ff70027eaccb77b582933374b7de4a0dede7f60
parent61dc536c92f6597e0a16115972d3f39886bbec74 (diff)
Use MTDev for multitouch devicesmasked
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--configure.ac3
-rw-r--r--src/Makefile.am2
-rw-r--r--src/evdev.c24
-rw-r--r--src/evdev.h3
4 files changed, 30 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 07cd64e..34dbbd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,9 @@ XORG_DEFAULT_OPTIONS
# Obtain compiler/linker options from server and required extensions
PKG_CHECK_MODULES(XORG, xorg-server xproto inputproto)
+# Obtain compiler/linker options for mtdev
+PKG_CHECK_MODULES(MTDEV, mtdev)
+
# Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir,
AC_HELP_STRING([--with-xorg-module-dir=DIR],
diff --git a/src/Makefile.am b/src/Makefile.am
index a5c89ac..89137bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,7 @@ AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
AM_CPPFLAGS =-I$(top_srcdir)/include
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
-@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
+@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version $(MTDEV_LIBS)
@DRIVER_NAME@_drv_ladir = @inputdir@
@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \
diff --git a/src/evdev.c b/src/evdev.c
index 41da4ff..f31451a 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1036,11 +1036,16 @@ static void
EvdevReadInput(InputInfoPtr pInfo)
{
struct input_event ev[NUM_EVENTS];
+ EvdevPtr pEvdev = pInfo->private;
int i, len = sizeof(ev);
while (len == sizeof(ev))
{
- len = read(pInfo->fd, &ev, sizeof(ev));
+ if (pEvdev->mtdev)
+ len = mtdev_get(pEvdev->mtdev, pInfo->fd, ev, NUM_EVENTS) *
+ sizeof(struct input_event);
+ else
+ len = read(pInfo->fd, &ev, sizeof(ev));
if (len <= 0)
{
if (errno == ENODEV) /* May happen after resume */
@@ -2020,6 +2025,8 @@ EvdevProc(DeviceIntPtr device, int what)
free(pEvdev->mask);
free(pEvdev->oldMask);
free(pEvdev->proxMask);
+ if (pEvdev->mtdev)
+ mtdev_close(pEvdev->mtdev);
EvdevRemoveDevice(pInfo);
pEvdev->min_maj = 0;
break;
@@ -2447,6 +2454,14 @@ EvdevOpenDevice(InputInfoPtr pInfo)
pEvdev->device = device;
xf86Msg(X_CONFIG, "%s: Device: \"%s\"\n", pInfo->name, device);
+
+ pEvdev->mtdev = malloc(sizeof(struct mtdev));
+ if (!pEvdev->mtdev)
+ {
+ xf86Msg(X_ERROR, "%s: Couldn't allocate mtdev structure\n",
+ pInfo->name);
+ return BadAlloc;
+ }
}
if (pInfo->fd < 0)
@@ -2461,6 +2476,13 @@ EvdevOpenDevice(InputInfoPtr pInfo)
}
}
+ if (mtdev_open(pEvdev->mtdev, pInfo->fd))
+ {
+ free(pEvdev->mtdev);
+ pEvdev->mtdev = NULL;
+ xf86Msg(X_INFO, "%s: Couldn't open mtdev device\n", pInfo->name);
+ }
+
/* Check major/minor of device node to avoid adding duplicate devices. */
pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
if (EvdevIsDuplicate(pInfo))
diff --git a/src/evdev.h b/src/evdev.h
index 6a0d8e9..b108b86 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -39,6 +39,8 @@
#include <xf86_OSproc.h>
#include <xkbstr.h>
+#include <mtdev.h>
+
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
#define EV_CNT (EV_MAX+1)
#endif
@@ -211,6 +213,7 @@ typedef struct {
/* Event queue used to defer keyboard/button events until EV_SYN time. */
int num_queue;
EventQueueRec queue[EVDEV_MAXQUEUE];
+ struct mtdev *mtdev;
} EvdevRec, *EvdevPtr;
/* Event posting functions */