Hardware Reference
In-Depth Information
325 /
326
Close uinput device :
327
/
328 static void
329 uinput_close(int fd) {
330 int rc;
331
332 rc = ioctl(fd,UI_DEV_DESTROY);
333 assert(!rc);
334 close(fd);
335 }
336
337 /
338
Signal handler to quit the program:
339
/
340 static void
341 sigint_handler(int signo) {
342 is_signaled = 1; /
Signal to exit program
/
343 }
344
345 /
346
Curve the adjustment :
347
/
348 static int
349 curve(int relxy) {
350 int ax = abs(relxy); /
abs (relxy)
/
351 int sgn = relxy < 0 ? −1 : 1; /
sign (relxy)
/
352 int mv = 1; /
Smallest step
/
353
354 if ( ax > 100 )
355 mv = 10; /
Take large steps
/
356 else if ( ax > 65 )
357 mv = 7;
358 else if ( ax > 35 )
359 mv = 5;
360 else if ( ax > 15 )
361 mv = 2; /
2nd smallest step
/
362 return mv
sgn;
363 }
364
365 /
366
Main program:
Search WWH ::




Custom Search