summaryrefslogtreecommitdiff
path: root/src/lib/elput/elput_evdev.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-01-31 10:54:09 -0500
committerChris Michael <cp.michael@samsung.com>2017-01-31 10:54:09 -0500
commitdf1a1e05a95e24ef7d9704362b6c35e5ae8678e6 (patch)
treeb9ff282ffbe860684316a7c326b5d42af8ddbee6 /src/lib/elput/elput_evdev.c
parentd90be60e474e40ecd314367c35168a727a8c6c0c (diff)
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 <cp.michael@samsung.com>
Diffstat (limited to '')
-rw-r--r--src/lib/elput/elput_evdev.c10
1 files changed, 10 insertions, 0 deletions
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)
1239 1239
1240 edev->seat = seat; 1240 edev->seat = seat;
1241 edev->device = device; 1241 edev->device = device;
1242 edev->caps = 0;
1242 1243
1243 if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) && 1244 if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) &&
1244 (libinput_device_keyboard_has_key(device, KEY_ENTER))) 1245 (libinput_device_keyboard_has_key(device, KEY_ENTER)))
@@ -1260,6 +1261,11 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device)
1260 edev->caps |= EVDEV_SEAT_TOUCH; 1261 edev->caps |= EVDEV_SEAT_TOUCH;
1261 } 1262 }
1262 1263
1264 if (!((edev->caps & EVDEV_SEAT_KEYBOARD) ||
1265 (edev->caps & EVDEV_SEAT_POINTER) ||
1266 (edev->caps & EVDEV_SEAT_TOUCH)))
1267 goto err;
1268
1263 libinput_device_set_user_data(device, edev); 1269 libinput_device_set_user_data(device, edev);
1264 libinput_device_ref(edev->device); 1270 libinput_device_ref(edev->device);
1265 1271
@@ -1277,6 +1283,10 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device)
1277 * elput would handle outputs, and make calls to calibrate */ 1283 * elput would handle outputs, and make calls to calibrate */
1278 1284
1279 return edev; 1285 return edev;
1286
1287err:
1288 free(edev);
1289 return NULL;
1280} 1290}
1281 1291
1282void 1292void