external/tslib
Révision | 0cf7f1407c6c3a5ba2ba5f9886814bd81a891fbe (tree) |
---|---|
l'heure | 2011-10-24 08:19:22 |
Auteur | Bryan Hundven <bryanhundven@gmai...> |
Commiter | Bryan Hundven |
Merge branch 'master' into gingerbread-x86
@@ -40,6 +40,11 @@ | ||
40 | 40 | # define KEY_CNT (KEY_MAX+1) |
41 | 41 | #endif |
42 | 42 | |
43 | +#ifndef ABS_MT_POSITION_X | |
44 | +# define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */ | |
45 | +# define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ | |
46 | +#endif | |
47 | + | |
43 | 48 | #include "tslib-private.h" |
44 | 49 | |
45 | 50 | #define GRAB_EVENTS_WANTED 1 |
@@ -161,16 +166,17 @@ static int ts_input_read(struct tslib_module_info *inf, | ||
161 | 166 | } |
162 | 167 | break; |
163 | 168 | case EV_SYN: |
164 | - /* Fill out a new complete event */ | |
165 | - if (pen_up) { | |
166 | - samp->x = 0; | |
167 | - samp->y = 0; | |
168 | - samp->pressure = 0; | |
169 | - pen_up = 0; | |
170 | - } else { | |
171 | - samp->x = i->current_x; | |
172 | - samp->y = i->current_y; | |
173 | - samp->pressure = i->current_p; | |
169 | + if (ev.code == SYN_REPORT) { | |
170 | + /* Fill out a new complete event */ | |
171 | + if (pen_up) { | |
172 | + samp->x = 0; | |
173 | + samp->y = 0; | |
174 | + samp->pressure = 0; | |
175 | + pen_up = 0; | |
176 | + } else { | |
177 | + samp->x = i->current_x; | |
178 | + samp->y = i->current_y; | |
179 | + samp->pressure = i->current_p; | |
174 | 180 | } |
175 | 181 | samp->tv = ev.time; |
176 | 182 | #ifdef DEBUG |
@@ -180,6 +186,7 @@ static int ts_input_read(struct tslib_module_info *inf, | ||
180 | 186 | #endif /* DEBUG */ |
181 | 187 | samp++; |
182 | 188 | total++; |
189 | + } | |
183 | 190 | break; |
184 | 191 | case EV_ABS: |
185 | 192 | switch (ev.code) { |
@@ -191,6 +198,12 @@ static int ts_input_read(struct tslib_module_info *inf, | ||
191 | 198 | case ABS_RX: |
192 | 199 | i->current_y = ev.value; |
193 | 200 | break; |
201 | + case ABS_MT_POSITION_X: | |
202 | + i->current_x = ev.value; | |
203 | + break; | |
204 | + case ABS_MT_POSITION_Y: | |
205 | + i->current_y = ev.value; | |
206 | + break; | |
194 | 207 | case ABS_PRESSURE: |
195 | 208 | i->current_p = ev.value; |
196 | 209 | break; |
@@ -14,12 +14,24 @@ | ||
14 | 14 | #ifdef HAVE_UNISTD_H |
15 | 15 | #include <unistd.h> |
16 | 16 | #endif |
17 | +#include <dlfcn.h> | |
17 | 18 | |
18 | 19 | #include "tslib-private.h" |
19 | 20 | |
20 | 21 | int ts_close(struct tsdev *ts) |
21 | 22 | { |
23 | + void *handle; | |
22 | 24 | int ret; |
25 | + struct tslib_module_info *info, *prev; | |
26 | + | |
27 | + for(info = ts->list, prev = info; | |
28 | + info != NULL; | |
29 | + info = prev->next, prev = info) { | |
30 | + handle = info->handle; | |
31 | + info->ops->fini(info); | |
32 | + if (handle) | |
33 | + dlclose(handle); | |
34 | + } | |
23 | 35 | |
24 | 36 | ret = close(ts->fd); |
25 | 37 | free(ts); |
@@ -152,6 +152,7 @@ static struct tslib_module_info *__ts_load_module_shared(struct tsdev *ts, const | ||
152 | 152 | static int __ts_load_module(struct tsdev *ts, const char *module, const char *params, int raw) |
153 | 153 | { |
154 | 154 | struct tslib_module_info *info; |
155 | + void *handle; | |
155 | 156 | int ret; |
156 | 157 | |
157 | 158 | #ifdef DEBUG |
@@ -173,9 +174,10 @@ static int __ts_load_module(struct tsdev *ts, const char *module, const char *pa | ||
173 | 174 | #ifdef DEBUG |
174 | 175 | fprintf (stderr, "Can't attach %s\n", module); |
175 | 176 | #endif |
177 | + handle = info->handle; | |
176 | 178 | info->ops->fini(info); |
177 | - if (info->handle) | |
178 | - dlclose(info->handle); | |
179 | + if (handle) | |
180 | + dlclose(handle); | |
179 | 181 | } |
180 | 182 | |
181 | 183 | return ret; |