aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-10-25 14:55:47 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-11-11 15:50:36 +1000
commit91d90a79593369ba1079d06a75f09ceaa9143768 (patch)
treebbc5b7458d4ce78f7e1e4336628f0b10bbedc6d1
parentRemove duplicate line (diff)
downloadxf86-input-evdev-91d90a79593369ba1079d06a75f09ceaa9143768.tar.gz
xf86-input-evdev-91d90a79593369ba1079d06a75f09ceaa9143768.tar.bz2
xf86-input-evdev-91d90a79593369ba1079d06a75f09ceaa9143768.zip
Use mtdev API to allocate/free mtdev structs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 9e3cc4e..ce7cb7f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2096,16 +2096,6 @@ 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)
@@ -2121,11 +2111,10 @@ EvdevOpenDevice(InputInfoPtr pInfo)
}
#ifdef MULTITOUCH
- if (mtdev_open(pEvdev->mtdev, pInfo->fd) == 0)
+ pEvdev->mtdev = mtdev_new_open(pInfo->fd);
+ if (pEvdev->mtdev)
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;
}
@@ -2137,6 +2126,10 @@ EvdevOpenDevice(InputInfoPtr pInfo)
{
xf86IDrvMsg(pInfo, X_WARNING, "device file is duplicate. Ignoring.\n");
close(pInfo->fd);
+#ifdef MULTITOUCH
+ mtdev_close_delete(pEvdev->mtdev);
+ pEvdev->mtdev = NULL;
+#endif
return BadMatch;
}