Changeset 942
- Timestamp:
- 02/10/07 13:30:06 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oe/packages/tslib/tslib-1.0/tslib-input_raw-grab_events.patch
r939 r942 20 20 #include <stdlib.h> 21 21 #ifdef HAVE_UNISTD_H 22 @@ -42,6 +43,7 @@ 22 @@ -33,6 +34,9 @@ 23 24 #include "tslib-private.h" 25 26 +#define GRAB_EVENTS_WANTED 1 27 +#define GRAB_EVENTS_ACTIVE 2 28 + 29 struct tslib_input { 30 struct tslib_module_info module; 31 32 @@ -42,6 +46,7 @@ 23 33 24 34 int sane_fd; … … 28 38 29 39 static int check_fd(struct tslib_input *i) 30 @@ -64,6 +6 6,13@@40 @@ -64,6 +69,14 @@ 31 41 32 42 if (bit & (1 << EV_SYN)) 33 43 i->using_syn = 1; 34 44 + 35 + if (i->grab_events ) {45 + if (i->grab_events == GRAB_EVENTS_WANTED) { 36 46 + if (ioctl(ts->fd, EVIOCGRAB, (void *)1)) { 37 47 + fprintf(stderr, "Unable to grab selected input device\n"); 38 48 + return -1; 39 49 + } 50 + i->grab_events = GRAB_EVENTS_ACTIVE; 40 51 + } 41 52 42 53 return 0; 43 54 } 44 @@ -231,6 +240,35 @@ 55 @@ -222,6 +235,15 @@ 56 57 static int ts_input_fini(struct tslib_module_info *inf) 58 { 59 + struct tslib_input *i = (struct tslib_input *)inf; 60 + struct tsdev *ts = inf->dev; 61 + 62 + if (i->grab_events == GRAB_EVENTS_ACTIVE) { 63 + if (ioctl(ts->fd, EVIOCGRAB, (void *)0)) { 64 + fprintf(stderr, "Unable to un-grab selected input device\n"); 65 + } 66 + } 67 + 68 free(inf); 69 return 0; 70 } 71 @@ -231,6 +253,36 @@ 45 72 .fini = ts_input_fini, 46 73 }; … … 60 87 + switch ((int)data) { 61 88 + case 1: 62 + i->grab_events = v; 89 + if (v) 90 + i->grab_events = GRAB_EVENTS_WANTED; 63 91 + break; 64 92 + default: … … 78 106 { 79 107 struct tslib_input *i; 80 @@ -245,5 +2 83,12 @@108 @@ -245,5 +297,12 @@ 81 109 i->current_p = 0; 82 110 i->sane_fd = 0;
Note: See TracChangeset
for help on using the changeset viewer.
