diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-08-07 11:04:45 +1000 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-08-08 14:00:30 -0700 |
commit | 0d061e38022e7b6a1d81e12cd70f9db1401e70ca (patch) | |
tree | 0c0e2ef482ab09892096ca07221d6b9633ddf91a /src/evdev.c | |
parent | 89af60e6f59abc8f63e276ef7035870312a38361 (diff) | |
download | weston-0d061e38022e7b6a1d81e12cd70f9db1401e70ca.tar.gz |
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/evdev.c')
-rw-r--r-- | src/evdev.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/evdev.c b/src/evdev.c index c05bb788..0cf5aa2e 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)) { @@ -580,6 +589,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); @@ -595,13 +606,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); @@ -613,6 +617,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); |