tools: require a minimum size for touchpads
authorPeter Hutterer <peter.hutterer@who-t.net>
Sun, 31 Jul 2016 21:45:46 +0000 (07:45 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Sun, 31 Jul 2016 21:47:46 +0000 (07:47 +1000)
This mostly aims to catch users trying to specify the size in inches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools/touchpad-edge-detector.c

index 1cf4d5db91f132de33bc7fc73a03034ba9b12a48..e09f028269799f07bbab31c0fe67e7b7e379137b 100644 (file)
@@ -240,6 +240,14 @@ int main (int argc, char **argv) {
            size.w <= 0 || size.h <= 0)
                return usage();
 
+       if (size.w < 30 || size.h < 30) {
+               fprintf(stderr,
+                       "%dx%dmm is too small for a touchpad.\n"
+                       "Please specify the touchpad size in mm.\n",
+                       size.w, size.h);
+               return 1;
+       }
+
        path = argv[2];
        if (path[0] == '-')
                return usage();