aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/evdev.c39
-rw-r--r--src/evdev.h5
3 files changed, 42 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b3a5671..cca1b0c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,6 +30,7 @@ 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_LIBADD = $(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 16f7339..48bfaea 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -998,7 +998,17 @@ EvdevReadInput(InputInfoPtr pInfo)
while (len == sizeof(ev))
{
- len = read(pInfo->fd, &ev, sizeof(ev));
+#ifdef MULTITOUCH
+ EvdevPtr pEvdev = pInfo->private;
+
+ 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));
+#else
+ len = read(pInfo->fd, &ev, sizeof(ev));
+#endif
if (len <= 0)
{
if (errno == ENODEV) /* May happen after resume */
@@ -1199,8 +1209,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
int mode = pEvdev->flags & EVDEV_TOUCHPAD ?
XIDependentTouch : XIDirectTouch;
- if (pEvdev->absinfo[ABS_MT_SLOT].maximum > 0)
- num_touches = pEvdev->absinfo[ABS_MT_SLOT].maximum;
+ if (pEvdev->mtdev->caps.slot.maximum > 0)
+ num_touches = pEvdev->mtdev->caps.slot.maximum;
if (!InitTouchClassDeviceStruct(device, num_touches, mode,
num_mt_axes)) {
@@ -1685,6 +1695,8 @@ EvdevProc(DeviceIntPtr device, int what)
valuator_mask_free(&pEvdev->mt_mask);
for (i = 0; i < EVDEV_MAXQUEUE; i++)
valuator_mask_free(&pEvdev->queue[i].touchMask);
+ if (pEvdev->mtdev)
+ mtdev_close(pEvdev->mtdev);
#endif
EvdevRemoveDevice(pInfo);
pEvdev->min_maj = 0;
@@ -2084,6 +2096,16 @@ EvdevOpenDevice(InputInfoPtr pInfo)
pEvdev->device = device;
xf86IDrvMsg(pInfo, X_CONFIG, "Device: \"%s\"\n", device);
+
+#ifdef MULTITOUCH
+ pEvdev->mtdev = malloc(sizeof(struct mtdev));
+ if (!pEvdev->mtdev)
+ {
+ xf86Msg(X_ERROR, "%s: Couldn't allocate mtdev structure\n",
+ pInfo->name);
+ return BadAlloc;
+ }
+#endif
}
if (pInfo->fd < 0)
@@ -2098,6 +2120,17 @@ EvdevOpenDevice(InputInfoPtr pInfo)
}
}
+#ifdef MULTITOUCH
+ if (mtdev_open(pEvdev->mtdev, pInfo->fd) == 0)
+ pEvdev->cur_slot = pEvdev->mtdev->caps.slot.value;
+ else {
+ free(pEvdev->mtdev);
+ pEvdev->mtdev = NULL;
+ xf86Msg(X_ERROR, "%s: Couldn't open mtdev device\n", pInfo->name);
+ return FALSE;
+ }
+#endif
+
/* 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 6e3b850..c588b5d 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -39,6 +39,10 @@
#include <xf86_OSproc.h>
#include <xkbstr.h>
+#ifdef MULTITOUCH
+#include <mtdev.h>
+#endif
+
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
#define EV_CNT (EV_MAX+1)
#endif
@@ -142,6 +146,7 @@ typedef struct {
int cur_slot;
BOOL close_slot;
BOOL open_slot;
+ struct mtdev *mtdev;
#endif
int flags;