リビジョン | faba330f5d9766c73b761c79963e98b2dda08042 (tree) |
---|---|
日時 | 2010-01-15 21:09:49 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
コミッター | Chih-Wei Huang |
ts_calibrate: add skip function
You may press Enter to skip the calibration.
@@ -198,6 +198,17 @@ int main() | ||
198 | 198 | char *tsdevice = NULL; |
199 | 199 | char *calfile = NULL; |
200 | 200 | unsigned int i, len; |
201 | + pid_t child; | |
202 | + | |
203 | + child = fork(); | |
204 | + if (child > 0) { | |
205 | + getchar(); | |
206 | + kill(child, SIGKILL); | |
207 | + exit(0); | |
208 | + } else if (child < 0) { | |
209 | + perror("fork"); | |
210 | + exit(-1); | |
211 | + } | |
201 | 212 | |
202 | 213 | signal(SIGSEGV, sig); |
203 | 214 | signal(SIGINT, sig); |
@@ -240,8 +251,11 @@ int main() | ||
240 | 251 | "TSLIB calibration utility", 1); |
241 | 252 | put_string_center (xres / 2, yres / 4 + 20, |
242 | 253 | "Touch crosshair to calibrate", 2); |
254 | + put_string_center (xres / 2, yres / 4 + 40, | |
255 | + "Press Enter to skip", 2); | |
243 | 256 | |
244 | - printf("xres = %d, yres = %d\n", xres, yres); | |
257 | + sprintf(cal_buffer, "Resolution %d x %d", xres, yres); | |
258 | + put_string_center (xres / 2, yres / 4 + 70, cal_buffer, 3); | |
245 | 259 | |
246 | 260 | // Clear the buffer |
247 | 261 | clearbuf(ts); |
@@ -284,5 +298,6 @@ int main() | ||
284 | 298 | |
285 | 299 | free(tset); |
286 | 300 | close_framebuffer(); |
301 | + kill(getppid(), SIGTERM); | |
287 | 302 | return i; |
288 | 303 | } |