summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-09-26 09:51:17 +0000
committerRichard Purdie <richard@openedhand.com>2006-09-26 09:51:17 +0000
commit80e181e05ac6b3de2e2de4eeab4994fff4de893f (patch)
tree263a7f4c8996e725996256d87a0cd526339a2113 /meta
parent82819635b896209fa1586727d92f2b3789c5b2cb (diff)
downloadpoky-80e181e05ac6b3de2e2de4eeab4994fff4de893f.tar.gz
tslib-maemo: die, die, die
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@764 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/tslib/tslib-maemo/multievent.patch843
-rw-r--r--meta/packages/tslib/tslib-maemo/nokia770/ts.conf2
-rw-r--r--meta/packages/tslib/tslib-maemo/nokia770/tslib.sh5
-rw-r--r--meta/packages/tslib/tslib-maemo/ts.conf25
-rw-r--r--meta/packages/tslib/tslib-maemo_0.0.1-15.bb49
5 files changed, 0 insertions, 924 deletions
diff --git a/meta/packages/tslib/tslib-maemo/multievent.patch b/meta/packages/tslib/tslib-maemo/multievent.patch
deleted file mode 100644
index 854e7af5dd..0000000000
--- a/meta/packages/tslib/tslib-maemo/multievent.patch
+++ /dev/null
@@ -1,843 +0,0 @@
1--- tslib/plugins/linear.c~multievent
2+++ tslib/plugins/linear.c
3@@ -39,14 +39,12 @@
4 linear_read(struct tslib_module_info *info, struct ts_sample *samp, int nr)
5 {
6 struct tslib_linear *lin = (struct tslib_linear *)info;
7- int ret;
8+ int ret, i = 0;
9 int xtemp,ytemp;
10
11 ret = info->next->ops->read(info->next, samp, nr);
12 if (ret >= 0) {
13- int nr;
14-
15- for (nr = 0; nr < ret; nr++, samp++) {
16+ for (i = 0; i < ret; i++, samp++) {
17 #ifdef DEBUG
18 fprintf(stderr,"BEFORE CALIB--------------------> %d %d %d\n",samp->x, samp->y, samp->pressure);
19 #endif /*DEBUG*/
20@@ -66,6 +64,7 @@
21 samp->y = tmp;
22 }
23 }
24+ ret = i;
25 }
26
27 return ret;
28--- tslib/plugins/dejitter.c~multievent
29+++ tslib/plugins/dejitter.c
30@@ -24,7 +24,6 @@
31
32 struct tslib_threshold {
33 struct tslib_module_info module;
34- int pthreshold;
35 int xdelta;
36 int ydelta;
37 int delta2;
38@@ -36,40 +35,28 @@
39 static int threshold_read(struct tslib_module_info *info, struct ts_sample *samp, int nr)
40 {
41 struct tslib_threshold *thr = (struct tslib_threshold *)info;
42- struct ts_sample *s;
43- int ret;
44+ struct ts_sample *src = samp, *dest = samp;
45+ int ret, i = 0;
46
47 ret = info->next->ops->read(info->next, samp, nr);
48 if (ret >= 0) {
49- int nr = 0;
50-
51- for (s = samp; s < samp + ret; s++) {
52+ for (i = 0; i < ret; i++, samp++) {
53 int dr2;
54 #ifdef DEBUG
55- fprintf(stderr,"BEFORE DEJITTER---------------> %d %d %d\n",s->x,s->y,s->pressure);
56+ fprintf(stderr,"BEFORE DEJITTER---------------> %d %d %d\n", samp->x, samp->y, samp->pressure);
57 #endif /*DEBUG*/
58- thr->down = (s->pressure >= thr->pthreshold);
59- if (thr->down) {
60- dr2 = (thr->x - s->x)*(thr->x - s->x)
61- + (thr->y - s->y)*(thr->y - s->y);
62- if(dr2 < thr->delta2) {
63- s->x = thr->x;
64- s->y = thr->y;
65- } else {
66- thr->x = s->x;
67- thr->y = s->y;
68- }
69-
70+ dr2 = (thr->x - samp->x)*(thr->x - samp->x)
71+ + (thr->y - samp->y)*(thr->y - samp->y);
72+ if(dr2 < thr->delta2) {
73+ samp->x = thr->x;
74+ samp->y = thr->y;
75 } else {
76- s->x = thr->x;
77- s->y = thr->y;
78+ thr->x = samp->x;
79+ thr->y = samp->y;
80 }
81-
82-
83- samp[nr++] = *s;
84 }
85
86- ret = nr;
87+ ret = i;
88 }
89 return ret;
90 }
91@@ -106,10 +93,6 @@
92 thr->ydelta = v;
93 break;
94
95- case 3:
96- thr->pthreshold = v;
97- break;
98-
99 default:
100 return -1;
101 }
102@@ -120,7 +103,6 @@
103 {
104 { "xdelta", (void *)1, threshold_limit },
105 { "ydelta", (void *)2, threshold_limit },
106- { "pthreshold", (void *)3, threshold_limit }
107 };
108
109 //#define NR_VARS (sizeof(threshold_vars) / sizeof(threshold_vars[0]))
110@@ -138,7 +120,6 @@
111
112 thr->xdelta = 10;
113 thr->ydelta = 10;
114- thr->pthreshold = 100;
115
116 if (tslib_parse_vars(&thr->module, threshold_vars, NR_VARS, params)) {
117 free(thr);
118--- tslib/plugins/variance.c~multievent
119+++ tslib/plugins/variance.c
120@@ -9,25 +9,36 @@
121 * $Id: variance.c,v 1.3 2002/11/08 23:28:55 dlowder Exp $
122 *
123 * Variance filter for touchscreen values
124+ *
125+ * Policy question (applies to all tslib modules that consume events):
126+ * 1) User requests a read of 5 events using nr.
127+ * 2) Lower layers return us 4 events.
128+ * 3) Perform variance calculation, we now only have _1_ event.
129+ * 4) Do we, a) duplicate this data across the user requested 4 events,
130+ * b) push up the single event
131+ * c) loop on the read from the lower layers to obtain
132+ * the user's requested number of events, unless we hit
133+ * a pen_up.
134 */
135+
136 #include <errno.h>
137 #include <stdlib.h>
138 #include <string.h>
139 #include <limits.h>
140-
141 #include <stdio.h>
142
143 #include "tslib.h"
144 #include "tslib-filter.h"
145
146+#define NR_INIT -1
147 #define NR_LAST 4
148
149 struct tslib_variance {
150 struct tslib_module_info module;
151 int nr;
152- unsigned int pthreshold;
153 unsigned int xlimit;
154 unsigned int ylimit;
155+ unsigned int pthreshold;
156 struct ts_sample last[NR_LAST];
157 };
158
159@@ -37,8 +48,7 @@
160 * least variance, and average them.
161 */
162 static int
163-variance_calculate(struct tslib_variance *var, struct ts_sample *samp,
164- struct ts_sample *s)
165+variance_calculate(struct tslib_variance *var, struct ts_sample *dest, struct ts_sample *src)
166 {
167 int i, j;
168 int diff_x, min_x, i_x, j_x;
169@@ -100,11 +110,11 @@
170 }
171 }
172
173- samp->x = (var->last[i_x].x + var->last[j_x].x) / 2;
174- samp->y = (var->last[i_y].y + var->last[j_y].y) / 2;
175- samp->pressure = (var->last[i_p].pressure + var->last[j_p].pressure) / 2;
176- samp->tv.tv_sec = s->tv.tv_sec;
177- samp->tv.tv_usec = s->tv.tv_usec;
178+ dest->x = (var->last[i_x].x + var->last[j_x].x) / 2;
179+ dest->y = (var->last[i_y].y + var->last[j_y].y) / 2;
180+ dest->pressure = (var->last[i_p].pressure + var->last[j_p].pressure) / 2;
181+ dest->tv.tv_sec = src->tv.tv_sec;
182+ dest->tv.tv_usec = src->tv.tv_usec;
183
184 return 1;
185 }
186@@ -112,55 +122,57 @@
187 static int variance_read(struct tslib_module_info *info, struct ts_sample *samp, int nr)
188 {
189 struct tslib_variance *var = (struct tslib_variance *)info;
190- struct ts_sample *s;
191- int ret;
192-
193- ret = info->next->ops->read(info->next, samp, nr);
194- if (ret >= 0) {
195- int nr = 0;
196-
197- for (s = samp; s < samp + ret; s++) {
198- if (s->pressure < var->pthreshold) {
199- /*
200- * Pen was released. Reset our state and
201- * pass up the release information.
202- */
203-// samp[nr].x = 0;
204-// samp[nr].y = 0;
205- samp[nr].pressure = s->pressure;
206- samp[nr].tv.tv_sec = s->tv.tv_sec;
207- samp[nr].tv.tv_usec = s->tv.tv_usec;
208-
209- nr++;
210-
211- var->nr = 0;
212- continue;
213- } else if (var->nr == -1) {
214- /*
215- * Pen was pressed. Inform upper layers
216- * immediately.
217- */
218- samp[nr] = *s;
219- nr++;
220- }
221-
222- if (var->nr >= 0) {
223- var->last[var->nr].x = s->x;
224- var->last[var->nr].y = s->y;
225- var->last[var->nr].pressure = s->pressure;
226- }
227-
228- var->nr++;
229+ struct ts_sample *src = samp, *dest = samp;
230+ int ret, i = 0;
231
232- if (var->nr == NR_LAST) {
233- if (variance_calculate(var, samp + nr, s))
234- nr++;
235- var->nr = 0;
236+ /*
237+ * NOTES:
238+ *
239+ * Loop on read, collecting events until we hit nr, unless
240+ * we hit a pen up or encounter a failure.
241+ */
242+ while ((i < nr) && (ret != -1)) {
243+ ret = info->next->ops->read(info->next, dest + i, nr - i);
244+ if (ret >= 0) {
245+ for (src = dest + i; src < dest + ret; src++) {
246+ if (src->pressure < var->pthreshold) {
247+ /* pen released, reset var->nr,
248+ * do a calc based on what we have so
249+ * far, and let this event flow up */
250+ if (variance_calculate(var, dest + i, src))
251+ i++;
252+ var->nr = NR_INIT;
253+ ret = -1; /* break outer loop, push up event */
254+ break;
255+ } else if (var->nr == NR_INIT) {
256+ /*
257+ * First pen down event. Inform upper layers
258+ * immediately for responsiveness.
259+ */
260+ var->nr = 0;
261+ i++;
262+ ret = -1; /* break outer loop */
263+ break;
264+ }
265+
266+ if (var->nr >= 0) {
267+ var->last[var->nr].x = src->x;
268+ var->last[var->nr].y = src->y;
269+ var->last[var->nr].pressure = src->pressure;
270+ }
271+
272+ var->nr++;
273+
274+ if (var->nr == NR_LAST) {
275+ if (variance_calculate(var, dest + i, src))
276+ i++;
277+ var->nr = 0;
278+ }
279 }
280 }
281-
282- ret = nr;
283 }
284+ /* if we've collected at least one event, send it up */
285+ if (i != 0) ret = i;
286 return ret;
287 }
288
289@@ -196,10 +208,6 @@
290 var->ylimit = v;
291 break;
292
293- case 3:
294- var->pthreshold = v;
295- break;
296-
297 default:
298 return -1;
299 }
300@@ -210,7 +218,6 @@
301 {
302 { "xlimit", (void *)1, variance_limit },
303 { "ylimit", (void *)2, variance_limit },
304- { "pthreshold", (void *)3, variance_limit }
305 };
306
307 #define NR_VARS (sizeof(variance_vars) / sizeof(variance_vars[0]))
308@@ -218,6 +225,7 @@
309 struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
310 {
311 struct tslib_variance *var;
312+ char *pthresvar;
313
314 var = malloc(sizeof(struct tslib_variance));
315 if (var == NULL)
316@@ -225,10 +233,15 @@
317
318 var->module.ops = &variance_ops;
319
320- var->nr = -1;
321+ var->nr = NR_INIT;
322 var->xlimit = 160;
323 var->ylimit = 160;
324 var->pthreshold = 100;
325+ pthresvar = getenv("TSLIB_PTHRES");
326+ if (pthresvar != NULL) {
327+ int p = strtol(pthresvar, (char **)NULL, 10);
328+ if (p != -1) var->pthreshold = p;
329+ }
330
331 if (tslib_parse_vars(&var->module, variance_vars, NR_VARS, params)) {
332 free(var);
333--- tslib/README~multievent
334+++ tslib/README
335@@ -36,6 +36,19 @@
336 usages. They are by no means exhaustive, nor probably even good examples.
337 They are basically the programs I used to test this library.
338
339+Module Creation Notes
340+=====================
341+
342+For those creating tslib modules, it is important to note a couple things with
343+regard to handling of the ability for a user to request more than one ts event
344+at a time. The first thing to note is that the lower layers may send up less
345+events than the user requested, but only if that was a result of a pen release.
346+Next, your module should send up just as many events as the user requested in
347+nr. If your module is one that consumes events, such as variance, then you
348+loop on the read from the lower layers, and only send the events up when
349+1) you have the number of events requested by the user, or 2) one of the events
350+from the lower layers was a pen release.
351+
352
353 Module Parameters
354 =================
355--- tslib/src/ts_read_raw.c~multievent
356+++ tslib/src/ts_read_raw.c
357@@ -14,10 +14,10 @@
358 *
359 * Read raw pressure, x, y, and timestamp from a touchscreen device.
360 */
361+
362 #include "config.h"
363
364 #include <stdio.h>
365-
366 #include <stdlib.h>
367 #ifdef HAVE_UNISTD_H
368 #include <unistd.h>
369@@ -25,79 +25,27 @@
370 #include <sys/time.h>
371 #include <sys/types.h>
372
373-#ifdef USE_INPUT_API
374-#include <linux/input.h>
375-#else
376-struct ts_event { /* Used in UCB1x00 style touchscreens (the default) */
377- unsigned short pressure;
378- unsigned short x;
379- unsigned short y;
380- unsigned short pad;
381- struct timeval stamp;
382-};
383-struct h3600_ts_event { /* Used in the Compaq IPAQ */
384- unsigned short pressure;
385- unsigned short x;
386- unsigned short y;
387- unsigned short pad;
388-};
389-struct mk712_ts_event { /* Used in the Hitachi Webpad */
390- unsigned int header;
391- unsigned int x;
392- unsigned int y;
393- unsigned int reserved;
394-};
395-struct arctic2_ts_event { /* Used in the IBM Arctic II */
396- signed short pressure;
397- signed int x;
398- signed int y;
399- int millisecs;
400- int flags;
401-};
402-struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */
403- long y;
404- long x;
405- long pressure;
406- long long millisecs;
407-};
408-struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */
409- short pressure;
410- short x;
411- short y;
412- short millisecs;
413-};
414-#endif /* USE_INPUT_API */
415-
416 #include "tslib-private.h"
417
418-int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr)
419-{
420 #ifdef USE_INPUT_API
421+#include <linux/input.h>
422+
423+static inline int get_input_event(struct tsdev *ts, struct ts_sample *samp) {
424 struct input_event ev;
425-#else
426- struct ts_event *evt;
427- struct h3600_ts_event *hevt;
428- struct mk712_ts_event *mevt;
429- struct arctic2_ts_event *aevt;
430- struct collie_ts_event *collie_evt;
431- struct corgi_ts_event *corgi_evt;
432-#endif /* USE_INPUT_API */
433- int ret;
434- int total = 0;
435+ struct timeval tv = {0, 0};
436+ fd_set fdset;
437+ int ret = 0;
438
439- char *tseventtype=NULL;
440- char *defaulttseventtype="UCB1x00";
441+ /* event vars */
442+ static int curr_x = 0, curr_y = 0;
443+ int curr_p = 0, next_x = 0, next_y = 0;
444
445-#ifdef USE_INPUT_API
446- /* warning: maybe those static vars should be part of the tsdev struct? */
447- static int curr_x = 0, curr_y = 0, curr_p = 0;
448- static int got_curr_x = 0, got_curr_y = 0;
449- int got_curr_p = 0;
450- int next_x, next_y;
451+ /* state variables */
452+ int got_curr_x = 0, got_curr_y = 0, got_curr_p = 0;
453 int got_next_x = 0, got_next_y = 0;
454 int got_tstamp = 0;
455
456- while (total < nr) {
457+ while (1) {
458 ret = read(ts->fd, &ev, sizeof(struct input_event));
459 if (ret < sizeof(struct input_event)) break;
460
461@@ -146,177 +94,231 @@
462 samp->tv = ev.time;
463 }
464
465- if ( (!got_curr_x || !got_curr_y) && !got_curr_p &&
466- !got_next_x && !got_next_y ) {
467- /*
468- * The current event is not complete yet.
469- * Give the kernel a chance to feed us more.
470- */
471- struct timeval tv = {0, 0};
472- fd_set fdset;
473- FD_ZERO(&fdset);
474- FD_SET(ts->fd, &fdset);
475- ret = select(ts->fd+1, &fdset, NULL, NULL, &tv);
476- if (ret == 1) continue;
477- if (ret == -1) break;
478+ if (got_curr_x && got_curr_y && got_curr_p) {
479+ /* we have a complete event */
480+ samp->x = curr_x;
481+ samp->y = curr_y;
482+ samp->pressure = curr_p;
483+ ret = 0; /* indicate success */
484+ if (got_next_x) curr_x = next_x;
485+ if (got_next_y) curr_y = next_y;
486+ break;
487 }
488
489- /* We consider having a complete ts event */
490- samp->x = curr_x;
491- samp->y = curr_y;
492- samp->pressure = curr_p;
493-#ifdef DEBUG
494- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
495-#endif /*DEBUG*/
496- samp++;
497- total++;
498-
499- /* get ready for next event */
500- if (got_next_x) curr_x = next_x; else got_curr_x = 0;
501- if (got_next_y) curr_y = next_y; else got_curr_y = 0;
502- got_next_x = got_next_y = got_tstamp = 0;
503+ /*
504+ * The current event is not complete yet.
505+ * Give the kernel a chance to feed us more.
506+ */
507+ FD_ZERO(&fdset);
508+ FD_SET(ts->fd, &fdset);
509+ ret = select(ts->fd+1, &fdset, NULL, NULL, &tv);
510+ if (ret == 1) continue;
511+ if (ret == -1) break;
512 }
513
514- if (ret) ret = -1;
515- if (total) ret = total;
516+// fprintf(stdout, "%s: returning %d\n", __FUNCTION__, ret);
517+ if (ret != 0) ret = -1;
518+ return ret;
519+}
520+
521 #else
522+
523+struct ucb1x00_ts_event { /* Used in UCB1x00 style touchscreens (the default) */
524+ unsigned short pressure;
525+ unsigned short x;
526+ unsigned short y;
527+ unsigned short pad;
528+ struct timeval stamp;
529+};
530+struct h3600_ts_event { /* Used in the Compaq IPAQ */
531+ unsigned short pressure;
532+ unsigned short x;
533+ unsigned short y;
534+ unsigned short pad;
535+};
536+struct mk712_ts_event { /* Used in the Hitachi Webpad */
537+ unsigned int header;
538+ unsigned int x;
539+ unsigned int y;
540+ unsigned int reserved;
541+};
542+struct arctic2_ts_event { /* Used in the IBM Arctic II */
543+ signed short pressure;
544+ signed int x;
545+ signed int y;
546+ int millisecs;
547+ int flags;
548+};
549+struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */
550+ long y;
551+ long x;
552+ long pressure;
553+ long long millisecs;
554+};
555+struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */
556+ short pressure;
557+ short x;
558+ short y;
559+ short millisecs;
560+};
561+
562+static inline int get_ucb1x00_event(struct tsdev *ts, struct ts_sample *samp) {
563+ struct ucb1x00_ts_event evt;
564+ int ret = read(ts->fd, &evt, sizeof(struct ucb1x00_ts_event));
565+ if (ret > 0) {
566+ samp->x = evt.x;
567+ samp->y = evt.y;
568+ samp->pressure = evt.pressure;
569+ samp->tv.tv_usec = evt.stamp.tv_usec;
570+ samp->tv.tv_sec = evt.stamp.tv_sec;
571+ ret = 0; /* success */
572+ }
573+ return ret;
574+}
575+
576+static inline int get_h3600_event(struct tsdev *ts, struct ts_sample *samp) {
577+ struct h3600_ts_event evt;
578+ int ret = read(ts->fd, &evt, sizeof(struct h3600_ts_event));
579+ if (ret > 0) {
580+ samp->x = evt.x;
581+ samp->y = evt.y;
582+ samp->pressure = evt.pressure;
583+ gettimeofday(&samp->tv, NULL);
584+ ret = 0; /* success */
585+ }
586+ return ret;
587+}
588+
589+static inline int get_mk712_event(struct tsdev *ts, struct ts_sample *samp) {
590+ struct mk712_ts_event evt;
591+ int ret = read(ts->fd, &evt, sizeof(struct mk712_ts_event));
592+ if (ret > 0) {
593+ samp->x = (short)evt.x;
594+ samp->y = (short)evt.y;
595+ if(evt.header==0)
596+ samp->pressure=1;
597+ else
598+ samp->pressure=0;
599+ gettimeofday(&samp->tv, NULL);
600+ ret = 0; /* success */
601+ }
602+ return ret;
603+}
604+
605+static inline int get_arctic2_event(struct tsdev *ts, struct ts_sample *samp) {
606+ struct arctic2_ts_event evt;
607+ int ret = read(ts->fd, &evt, sizeof(struct arctic2_ts_event));
608+ if (ret > 0) {
609+ samp->x = (short)evt.x;
610+ samp->y = (short)evt.y;
611+ samp->pressure = evt.pressure;
612+ gettimeofday(&samp->tv, NULL);
613+ ret = 0; /* success */
614+ }
615+ return ret;
616+}
617+
618+static inline int get_collie_event(struct tsdev *ts, struct ts_sample *samp) {
619+ struct collie_ts_event evt;
620+ int ret = read(ts->fd, &evt, sizeof(struct collie_ts_event));
621+ if (ret > 0) {
622+ samp->x = evt.x;
623+ samp->y = evt.y;
624+ samp->pressure = evt.pressure;
625+ samp->tv.tv_usec = evt.millisecs % 1000;
626+ samp->tv.tv_sec = evt.millisecs / 1000;
627+ ret = 0; /* success */
628+ }
629+ return ret;
630+}
631+
632+static inline int get_corgi_event(struct tsdev *ts, struct ts_sample *samp) {
633+ struct corgi_ts_event evt;
634+ int ret = read(ts->fd, &evt, sizeof(struct corgi_ts_event));
635+ if (ret > 0) {
636+ samp->x = evt.x;
637+ samp->y = evt.y;
638+ samp->pressure = evt.pressure;
639+ samp->tv.tv_usec = evt.millisecs % 1000;
640+ samp->tv.tv_sec = evt.millisecs / 1000;
641+ ret = 0; /* success */
642+ }
643+ return ret;
644+}
645+
646+#endif
647+
648+int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr)
649+{
650+ int ret;
651+ int total = 0;
652+ int pen_down = 1;
653+ static short x_save = 0, y_save = 0;
654+ static int pthres = -1;
655+
656+#ifndef USE_INPUT_API
657+ char *tseventtype=NULL;
658+ char *defaulttseventtype="UCB1x00";
659 tseventtype = getenv("TSLIB_TSEVENTTYPE");
660 if(tseventtype==NULL) tseventtype=defaulttseventtype;
661+#endif
662
663- if( strcmp(tseventtype,"H3600") == 0) { /* iPAQ style h3600 touchscreen events */
664- hevt = alloca(sizeof(*hevt) * nr);
665- ret = read(ts->fd, hevt, sizeof(*hevt) * nr);
666- if(ret > 0) {
667- int nr = ret / sizeof(*hevt);
668- while(ret >= sizeof(*hevt)) {
669- samp->x = hevt->x;
670- samp->y = hevt->y;
671- samp->pressure = hevt->pressure;
672-#ifdef DEBUG
673- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
674-#endif /*DEBUG*/
675- gettimeofday(&samp->tv,NULL);
676- samp++;
677- hevt++;
678- ret -= sizeof(*hevt);
679- }
680- } else {
681- return -1;
682- }
683- } else if( strcmp(tseventtype,"MK712") == 0) { /* Hitachi Webpad events */
684- mevt = alloca(sizeof(*mevt) * nr);
685- ret = read(ts->fd, mevt, sizeof(*mevt) * nr);
686- if(ret > 0) {
687- int nr = ret / sizeof(*mevt);
688- while(ret >= sizeof(*mevt)) {
689- samp->x = (short)mevt->x;
690- samp->y = (short)mevt->y;
691- if(mevt->header==0)
692- samp->pressure=1;
693- else
694- samp->pressure=0;
695-#ifdef DEBUG
696- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
697-#endif /*DEBUG*/
698- gettimeofday(&samp->tv,NULL);
699- samp++;
700- mevt++;
701- ret -= sizeof(*mevt);
702- }
703- } else {
704- return -1;
705- }
706-
707- } else if( strcmp(tseventtype,"ARCTIC2") == 0) { /* IBM Arctic II events */
708- aevt = alloca(sizeof(*aevt) * nr);
709- ret = read(ts->fd, aevt, sizeof(*aevt) * nr);
710- if(ret > 0) {
711- int nr = ret / sizeof(*aevt);
712- while(ret >= sizeof(*aevt)) {
713- samp->x = (short)aevt->x;
714- samp->y = (short)aevt->y;
715- samp->pressure = aevt->pressure;
716-#ifdef DEBUG
717- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
718-#endif /*DEBUG*/
719- gettimeofday(&samp->tv,NULL);
720- samp++;
721- aevt++;
722- ret -= sizeof(*aevt);
723- }
724+ while ((total < nr) && pen_down) {
725+// fprintf(stdout, "total: %d, nr: %d\n", total, nr);
726+#ifdef USE_INPUT_API
727+ ret = get_input_event(ts, samp);
728+#else
729+ if (strcmp(tseventtype, "H3600") == 0) {
730+ /* iPAQ style h3600 touchscreen events */
731+ ret = get_h3600_event(ts, samp);
732+ } else if (strcmp(tseventtype, "MK712") == 0) {
733+ /* Hitachi Webpad events */
734+ ret = get_mk712_event(ts, samp);
735+ } else if (strcmp(tseventtype, "ARCTIC2") == 0) {
736+ /* IBM Arctic II events */
737+ ret = get_arctic2_event(ts, samp);
738+ } else if (strcmp(tseventtype, "COLLIE") == 0) {
739+ /* Sharp Zaurus SL-5000d/5500 events */
740+ ret = get_collie_event(ts, samp);
741+ } else if (strcmp(tseventtype,"CORGI") == 0) {
742+ /* Sharp Zaurus SL-C700 events */
743+ ret = get_corgi_event(ts, samp);
744 } else {
745- return -1;
746+ /* Use normal UCB1x00 type events */
747+ ret = get_ucb1x00_event(ts, samp);
748 }
749+#endif
750+ if (ret != 0) break;
751
752- } else if( strcmp(tseventtype,"COLLIE") == 0) { /* Sharp Zaurus SL-5000d/5500 events */
753- collie_evt = alloca(sizeof(*collie_evt) * nr);
754- ret = read(ts->fd, collie_evt, sizeof(*collie_evt) * nr);
755- if(ret > 0) {
756- int nr = ret / sizeof(*collie_evt);
757- while(ret >= sizeof(*collie_evt)) {
758- samp->x = collie_evt->x;
759- samp->y = collie_evt->y;
760- samp->pressure = collie_evt->pressure;
761-#ifdef DEBUG
762- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
763-#endif /*DEBUG*/
764- samp->tv.tv_usec = collie_evt->millisecs % 1000;
765- samp->tv.tv_sec = collie_evt->millisecs / 1000;
766- samp++;
767- collie_evt++;
768- ret -= sizeof(*collie_evt);
769+ if (pthres == -1) {
770+ char *pthresvar = getenv("TSLIB_PTHRES");
771+ pthres = 100;
772+ if (pthresvar != NULL) {
773+ int p = strtol(pthresvar, (char **)NULL, 10);
774+ if (p != -1) pthres = p;
775 }
776- } else {
777- return -1;
778 }
779
780- } else if( strcmp(tseventtype,"CORGI") == 0) { /* Sharp Zaurus SL-C700 events */
781- corgi_evt = alloca(sizeof(*corgi_evt) * nr);
782- ret = read(ts->fd, corgi_evt, sizeof(*corgi_evt) * nr);
783- if(ret > 0) {
784- int nr = ret / sizeof(*corgi_evt);
785- while(ret >= sizeof(*corgi_evt)) {
786- samp->x = corgi_evt->x;
787- samp->y = corgi_evt->y;
788- samp->pressure = corgi_evt->pressure;
789-#ifdef DEBUG
790- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
791-#endif /*DEBUG*/
792- samp->tv.tv_usec = corgi_evt->millisecs % 1000;
793- samp->tv.tv_sec = corgi_evt->millisecs / 1000;
794- samp++;
795- corgi_evt++;
796- ret -= sizeof(*corgi_evt);
797- }
798+ if (samp->pressure < pthres) {
799+ /* pen released, send events up */
800+ pen_down = 0;
801+ /* set x and y to previous values */
802+ samp->x = x_save;
803+ samp->y = y_save;
804 } else {
805- return -1;
806+ pen_down = 1;
807+ x_save = samp->x;
808+ y_save = samp->y;
809 }
810-
811- } else { /* Use normal UCB1x00 type events */
812- evt = alloca(sizeof(*evt) * nr);
813- ret = read(ts->fd, evt, sizeof(*evt) * nr);
814- if(ret > 0) {
815- int nr = ret / sizeof(*evt);
816- while(ret >= sizeof(*evt)) {
817- samp->x = evt->x;
818- samp->y = evt->y;
819- samp->pressure = evt->pressure;
820 #ifdef DEBUG
821- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
822+ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x, samp->y, samp->pressure);
823 #endif /*DEBUG*/
824- samp->tv.tv_usec = evt->stamp.tv_usec;
825- samp->tv.tv_sec = evt->stamp.tv_sec;
826- samp++;
827- evt++;
828- ret -= sizeof(*evt);
829- }
830- } else {
831- return -1;
832- }
833+ samp++;
834+ total++;
835 }
836- ret = nr;
837-#endif /* USE_INPUT_API */
838
839+ if (ret != 0) ret = -1;
840+ if (total) ret = total;
841 return ret;
842 }
843
diff --git a/meta/packages/tslib/tslib-maemo/nokia770/ts.conf b/meta/packages/tslib/tslib-maemo/nokia770/ts.conf
deleted file mode 100644
index 8eed62f7b9..0000000000
--- a/meta/packages/tslib/tslib-maemo/nokia770/ts.conf
+++ /dev/null
@@ -1,2 +0,0 @@
1module pressure
2module linear
diff --git a/meta/packages/tslib/tslib-maemo/nokia770/tslib.sh b/meta/packages/tslib/tslib-maemo/nokia770/tslib.sh
deleted file mode 100644
index b7acc274c0..0000000000
--- a/meta/packages/tslib/tslib-maemo/nokia770/tslib.sh
+++ /dev/null
@@ -1,5 +0,0 @@
1#!/bin/sh
2
3TSLIB_TSDEVICE=/dev/input/touchscreen0
4
5export TSLIB_TSDEVICE
diff --git a/meta/packages/tslib/tslib-maemo/ts.conf b/meta/packages/tslib/tslib-maemo/ts.conf
deleted file mode 100644
index dc5c4ded09..0000000000
--- a/meta/packages/tslib/tslib-maemo/ts.conf
+++ /dev/null
@@ -1,25 +0,0 @@
1# Uncomment if you wish to use the linux input layer event interface
2# module_raw input
3
4# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
5# module_raw collie
6
7# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
8# module_raw corgi
9
10# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
11# module_raw ucb1x00
12
13# Uncomment if you're using an HP iPaq h3600 or similar
14# module_raw h3600
15
16# Uncomment if you're using a Hitachi Webpad
17# module_raw mk712
18
19# Uncomment if you're using an IBM Arctic II
20# module_raw arctic2
21
22module pthres pmin=1
23module variance delta=30
24module dejitter delta=100
25module linear
diff --git a/meta/packages/tslib/tslib-maemo_0.0.1-15.bb b/meta/packages/tslib/tslib-maemo_0.0.1-15.bb
deleted file mode 100644
index e797f5bdce..0000000000
--- a/meta/packages/tslib/tslib-maemo_0.0.1-15.bb
+++ /dev/null
@@ -1,49 +0,0 @@
1DEFAULT_PREFERENCE = "-1"
2SECTION = "base"
3DESCRIPTION = "tslib is a touchscreen access library (maemo patched version)."
4PR = "r2"
5PROVIDES = "tslib"
6
7SRC_URI_OVERRIDES_PACKAGE_ARCH = "0"
8PACKAGE_ARCH_tslib-conf = "${MACHINE_ARCH}"
9
10SRC_URI = "http://repository.maemo.org/pool/maemo/ossw/source/t/tslib/tslib_${PV}.tar.gz \
11 file://ts.conf \
12 file://tslib.sh"
13
14S = "${WORKDIR}/tslib"
15LICENSE = "LGPL"
16CONFFILES_${PN} = "${sysconfdir}/ts.conf"
17
18inherit autotools
19
20PACKAGES = "tslib-maemo-conf libts-maemo libts-maemo-dev tslib-maemo-tests tslib-maemo-calibrate"
21EXTRA_OECONF = "--enable-shared"
22
23do_stage () {
24 autotools_stage_all
25}
26
27
28do_install_prepend () {
29 install -m 0644 ${WORKDIR}/ts.conf ${S}/etc/ts.conf
30}
31
32do_install_append() {
33 install -d ${D}${sysconfdir}/profile.d/
34 install -m 0755 ${WORKDIR}/tslib.sh ${D}${sysconfdir}/profile.d/
35}
36
37RDEPENDS_libts-maemo = "tslib-maemo-conf"
38
39RPROVIDES_tslib-maemo-conf = "tslib-conf"
40RPROVIDES_libts-maemo = "libts"
41RPROVIDES_libts-maemo-dev = "libts-dev"
42RPROVIDES_tslib-maemo-calibrate = "tslib-calibrate"
43RPROVIDES_tslib-maemo-tests = "tslib-tests"
44
45FILES_tslib-maemo-conf = "${sysconfdir}/ts.conf ${sysconfdir}/profile.d/tslib.sh ${datadir}/tslib"
46FILES_libts-maemo = "${libdir}/*.so.* ${datadir}/ts/plugins/*.so*"
47FILES_libts-maemo-dev = "${FILES_tslib-maemo-dev}"
48FILES_tslib-maemo-calibrate += "${bindir}/ts_calibrate"
49FILES_tslib-maemo-tests = "${bindir}/ts_harvest ${bindir}/ts_print ${bindir}/ts_print_raw ${bindir}/ts_test"