[PATCH libevdev 3/3] tools: complain about devices that aren't touchpads in the edge detector

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 12 16:57:57 PST 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 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 df0f032..94cd71a 100644
--- a/tools/touchpad-edge-detector.c
+++ b/tools/touchpad-edge-detector.c
@@ -140,6 +140,13 @@ touchpad_edge_detector (int argc, char **argv) {
 	if (!dev)
 		return EXIT_FAILURE;
 
+	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;
@@ -159,6 +166,7 @@ touchpad_edge_detector (int argc, char **argv) {
 
 	printf("\n");
 
+out:
 	close_device(dev);
 
 	return rc;
-- 
2.1.0



More information about the Input-tools mailing list