OSDN Git Service

ts_calibrate: add skip function donut-x86 eclair-x86 froyo-x86 android-x86-2.2 android-x86-2.2-r2
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 15 Jan 2010 12:09:49 +0000 (20:09 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 15 Jan 2010 12:09:49 +0000 (20:09 +0800)
You may press Enter to skip the calibration.

tests/ts_calibrate.c

index 8e26ad7..d5f8159 100644 (file)
@@ -198,6 +198,17 @@ int main()
        char *tsdevice = NULL;
        char *calfile = NULL;
        unsigned int i, len;
+       pid_t child;
+
+       child = fork();
+       if (child > 0) {
+               getchar();
+               kill(child, SIGKILL);
+               exit(0);
+       } else if (child < 0) {
+               perror("fork");
+               exit(-1);
+       }
 
        signal(SIGSEGV, sig);
        signal(SIGINT, sig);
@@ -240,8 +251,11 @@ int main()
                           "TSLIB calibration utility", 1);
        put_string_center (xres / 2, yres / 4 + 20,
                           "Touch crosshair to calibrate", 2);
+       put_string_center (xres / 2, yres / 4 + 40,
+                          "Press Enter to skip", 2);
 
-       printf("xres = %d, yres = %d\n", xres, yres);
+       sprintf(cal_buffer, "Resolution %d x %d", xres, yres);
+       put_string_center (xres / 2, yres / 4 + 70, cal_buffer, 3);
 
        // Clear the buffer
        clearbuf(ts);
@@ -284,5 +298,6 @@ int main()
 
        free(tset);
        close_framebuffer();
+       kill(getppid(), SIGTERM);
        return i;
 }