From f54656ecc145caa69bd54c5cade332bf000e4668 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 13 Jan 2015 10:45:22 +1000 Subject: [PATCH] tools: complain about devices that don't have abs x/y axes in the edge detector Signed-off-by: Peter Hutterer --- tools/touchpad-edge-detector.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/touchpad-edge-detector.c b/tools/touchpad-edge-detector.c index e5420cf..fdc496e 100644 --- a/tools/touchpad-edge-detector.c +++ b/tools/touchpad-edge-detector.c @@ -169,6 +169,13 @@ int main (int argc, char **argv) { } libevdev_grab(dev, LIBEVDEV_UNGRAB); + if (!libevdev_has_event_code(dev, EV_ABS, ABS_X) || + !libevdev_has_event_code(dev, EV_ABS, ABS_Y)) { + fprintf(stderr, "Error: this device does not have abs axes\n"); + rc = EXIT_FAILURE; + goto out; + } + dim.left = INT_MAX; dim.right = INT_MIN; dim.top = INT_MAX; @@ -188,6 +195,7 @@ int main (int argc, char **argv) { printf("\n"); +out: libevdev_free(dev); close(fd);