From df1a1e05a95e24ef7d9704362b6c35e5ae8678e6 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 31 Jan 2017 10:54:09 -0500 Subject: [PATCH] elput: Don't add devices which we are not going to use If an input device is not a pointer, keyboard, or touch device then we are not going to be handling events for it, so do not create a new Elput device for it. @fix Signed-off-by: Chris Michael --- src/lib/elput/elput_evdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c index 8bbb5917b5..c7698538c3 100644 --- a/src/lib/elput/elput_evdev.c +++ b/src/lib/elput/elput_evdev.c @@ -1239,6 +1239,7 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device) edev->seat = seat; edev->device = device; + edev->caps = 0; if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) && (libinput_device_keyboard_has_key(device, KEY_ENTER))) @@ -1260,6 +1261,11 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device) edev->caps |= EVDEV_SEAT_TOUCH; } + if (!((edev->caps & EVDEV_SEAT_KEYBOARD) || + (edev->caps & EVDEV_SEAT_POINTER) || + (edev->caps & EVDEV_SEAT_TOUCH))) + goto err; + libinput_device_set_user_data(device, edev); libinput_device_ref(edev->device); @@ -1277,6 +1283,10 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device) * elput would handle outputs, and make calls to calibrate */ return edev; + +err: + free(edev); + return NULL; } void