summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-08-07 11:04:45 +1000
committerKristian Høgsberg <krh@bitplanet.net>2013-08-20 16:11:07 -0700
commit765eee9cdf96beff066d7215f464ff869d996c8f (patch)
treeb879226e9577b643ec61174fb13e3d2a5c171529 /src
parent08b70c1c38d547ac562bdfa086bc87d23d471ac5 (diff)
downloadweston-765eee9cdf96beff066d7215f464ff869d996c8f.tar.gz
weston-765eee9cdf96beff066d7215f464ff869d996c8f.tar.bz2
weston-765eee9cdf96beff066d7215f464ff869d996c8f.zip
evdev: only use mtdev for Protocol A devices
For Protocol B devices, mtdev merely routes the events and is not needed. For Protocol A devices, mtdev is needed, so fail for those devices now if we mtdev fails.
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 895de7fb..76463192 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -471,6 +471,15 @@ evdev_handle_device(struct evdev_device *device)
device->is_mt = 1;
device->mt.slot = 0;
device->caps |= EVDEV_TOUCH;
+
+ if (!TEST_BIT(abs_bits, ABS_MT_SLOT)) {
+ device->mtdev = mtdev_new_open(device->fd);
+ if (!device->mtdev) {
+ weston_log("mtdev required but failed to open for %s\n",
+ device->devnode);
+ return 0;
+ }
+ }
}
}
if (TEST_BIT(ev_bits, EV_REL)) {
@@ -581,6 +590,8 @@ evdev_device_create(struct weston_seat *seat, const char *path, int device_fd)
device->devname = strdup(devname);
if (!evdev_handle_device(device)) {
+ if (device->mtdev)
+ mtdev_close_delete(device->mtdev);
free(device->devnode);
free(device->devname);
free(device);
@@ -596,13 +607,6 @@ evdev_device_create(struct weston_seat *seat, const char *path, int device_fd)
if (device->dispatch == NULL)
goto err1;
-
- if (device->is_mt) {
- device->mtdev = mtdev_new_open(device->fd);
- if (!device->mtdev)
- weston_log("mtdev failed to open for %s\n", path);
- }
-
device->source = wl_event_loop_add_fd(ec->input_loop, device->fd,
WL_EVENT_READABLE,
evdev_device_data, device);
@@ -614,6 +618,8 @@ evdev_device_create(struct weston_seat *seat, const char *path, int device_fd)
err2:
device->dispatch->interface->destroy(device->dispatch);
err1:
+ if (device->mtdev)
+ mtdev_close_delete(device->mtdev);
free(device->devname);
free(device->devnode);
free(device);