summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-08-16 14:33:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-20 15:31:25 +0100
commita42db118a74f7b4dc4789969f9761b3c7ee41c11 (patch)
tree79f92f66d6dcbc60104a543fbc4b809b6862bdeb /meta
parenta8d686ba22264e84d4e094744e766bbfd707408d (diff)
downloadpoky-a42db118a74f7b4dc4789969f9761b3c7ee41c11.tar.gz
tslib: update to 1.1
Drop patches merged upstream. 32bitBE-support.patch wasn't merged, but no longer applies and similar changes look to have been made; tslib 1.1 works properly on qemumips without it, so this has also been dropped. (From OE-Core rev: 2e92d845b433f3a1805c310ccda54cfc7dd8b1e1) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-graphics/tslib/tslib/0001-Link-plugins-against-libts.patch57
-rw-r--r--meta/recipes-graphics/tslib/tslib/32bitBE-support.patch55
-rw-r--r--meta/recipes-graphics/tslib/tslib/fix_version.patch34
-rw-r--r--meta/recipes-graphics/tslib/tslib/multievent.patch845
-rw-r--r--meta/recipes-graphics/tslib/tslib/obsolete_automake_macros.patch15
-rw-r--r--meta/recipes-graphics/tslib/tslib/set-open-mode-for-ts_calibrate_c.patch30
-rw-r--r--meta/recipes-graphics/tslib/tslib_1.1.bb (renamed from meta/recipes-graphics/tslib/tslib_1.0.bb)14
7 files changed, 3 insertions, 1047 deletions
diff --git a/meta/recipes-graphics/tslib/tslib/0001-Link-plugins-against-libts.patch b/meta/recipes-graphics/tslib/tslib/0001-Link-plugins-against-libts.patch
deleted file mode 100644
index c6b9f5919b..0000000000
--- a/meta/recipes-graphics/tslib/tslib/0001-Link-plugins-against-libts.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 9623bbedf4ff409e5036edfcfe52b2595932a6d7 Mon Sep 17 00:00:00 2001
2From: Chris Larson <clarson@kergoth.com>
3Date: Sat, 1 Nov 2008 20:46:07 +0000
4Subject: [PATCH] Link plugins against libts
5
6Some plugins use tslib functions. Link those plugins against libts.
7The problem is easy to see with LDFLAGS="-Wl,-no-undefined".
8Without this change DirectFB in unable to use tslib because symbols
9in the tslib plugins can't be resolved.
10
11Signed-off-by: Ville Syrjala <syrjala@sci.fi>
12Signed-off-by: Chris Larson <clarson@kergoth.com>
13
14The patch was imported from git server git://github.com/kergoth/tslib.git
15as of commit id 9623bbedf4ff409e5036edfcfe52b2595932a6d7.
16
17Upstream-Status: Accepted
18Signed-off-by: Dmitry Cherukhin <dima_ch@emcraft.com>
19---
20 plugins/Makefile.am | 5 +++++
21 1 files changed, 5 insertions(+), 0 deletions(-)
22
23diff --git a/plugins/Makefile.am b/plugins/Makefile.am
24index 3b902c2..4c4ef8b 100644
25--- a/plugins/Makefile.am
26+++ b/plugins/Makefile.am
27@@ -114,15 +114,19 @@ pluginexec_LTLIBRARIES = \
28
29 variance_la_SOURCES = variance.c
30 variance_la_LDFLAGS = -module $(LTVSN)
31+variance_la_LIBADD = $(top_builddir)/src/libts.la
32
33 dejitter_la_SOURCES = dejitter.c
34 dejitter_la_LDFLAGS = -module $(LTVSN)
35+dejitter_la_LIBADD = $(top_builddir)/src/libts.la
36
37 linear_la_SOURCES = linear.c
38 linear_la_LDFLAGS = -module $(LTVSN)
39+linear_la_LIBADD = $(top_builddir)/src/libts.la
40
41 pthres_la_SOURCES = pthres.c
42 pthres_la_LDFLAGS = -module $(LTVSN)
43+pthres_la_LIBADD = $(top_builddir)/src/libts.la
44
45 # hw access
46 corgi_la_SOURCES = corgi-raw.c
47@@ -148,6 +152,7 @@ tatung_la_LDFLAGS = -module $(LTVSN)
48
49 input_la_SOURCES = input-raw.c
50 input_la_LDFLAGS = -module $(LTVSN)
51+input_la_LIBADD = $(top_builddir)/src/libts.la
52
53 linear_h2200_la_SOURCES = linear-h2200.c
54 linear_h2200_la_LDFLAGS = -module $(LTVSN)
55--
561.7.6.4
57
diff --git a/meta/recipes-graphics/tslib/tslib/32bitBE-support.patch b/meta/recipes-graphics/tslib/tslib/32bitBE-support.patch
deleted file mode 100644
index 49232ef6e9..0000000000
--- a/meta/recipes-graphics/tslib/tslib/32bitBE-support.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1#! /bin/sh /usr/share/dpatch/dpatch-run
2## 030-32bitBE-support.dpatch by Neil Williams <codehelp@debian.org>
3##
4## All lines beginning with `## DP:' are a description of the patch.
5## DP: See bug #496759 - being tested upstream for 32bit BE devices
6
7@DPATCH@
8
9Upstream-Status: Pending
10
11diff -urNad tslib-1.0~/plugins/input-raw.c tslib-1.0/plugins/input-raw.c
12--- tslib-1.0~/plugins/input-raw.c 2008-12-09 10:56:47.000000000 +0000
13+++ tslib-1.0/plugins/input-raw.c 2008-12-09 11:05:41.000000000 +0000
14@@ -44,25 +44,33 @@
15 int using_syn;
16 };
17
18+#define BITS_PER_LONG (sizeof(long) * 8)
19+#ifndef EV_CNT
20+#define EV_CNT (EV_MAX+1)
21+#endif
22+#ifndef ABS_CNT
23+#define ABS_CNT (ABS_MAX+1)
24+#endif
25+
26 static int check_fd(struct tslib_input *i)
27 {
28 struct tsdev *ts = i->module.dev;
29 int version;
30- u_int32_t bit;
31- u_int64_t absbit;
32+ unsigned long bit[EV_CNT / BITS_PER_LONG + 1];
33+ unsigned long absbit[ABS_MAX / BITS_PER_LONG + 1];
34
35 if (! ((ioctl(ts->fd, EVIOCGVERSION, &version) >= 0) &&
36 (version == EV_VERSION) &&
37- (ioctl(ts->fd, EVIOCGBIT(0, sizeof(bit) * 8), &bit) >= 0) &&
38- (bit & (1 << EV_ABS)) &&
39- (ioctl(ts->fd, EVIOCGBIT(EV_ABS, sizeof(absbit) * 8), &absbit) >= 0) &&
40- (absbit & (1 << ABS_X)) &&
41- (absbit & (1 << ABS_Y)) && (absbit & (1 << ABS_PRESSURE)))) {
42+ (ioctl(ts->fd, EVIOCGBIT(0, sizeof(bit)), bit) >= 0) &&
43+ (bit[0] & (1 << EV_ABS)) &&
44+ (ioctl(ts->fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) >= 0) &&
45+ (absbit[0] & (1 << ABS_X)) &&
46+ (absbit[0] & (1 << ABS_Y)) && (absbit[0] & (1 << ABS_PRESSURE)))) {
47 fprintf(stderr, "selected device is not a touchscreen I understand\n");
48 return -1;
49 }
50
51- if (bit & (1 << EV_SYN))
52+ if (bit[0] & (1 << EV_SYN))
53 i->using_syn = 1;
54
55 return 0;
diff --git a/meta/recipes-graphics/tslib/tslib/fix_version.patch b/meta/recipes-graphics/tslib/tslib/fix_version.patch
deleted file mode 100644
index c3d658ee52..0000000000
--- a/meta/recipes-graphics/tslib/tslib/fix_version.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1---
2 configure.ac | 10 +++++-----
3 1 file changed, 5 insertions(+), 5 deletions(-)
4
5Upstream-Status: Inappropriate [configuration]
6
7Index: tslib-1.0/configure.ac
8===================================================================
9--- tslib-1.0.orig/configure.ac 2006-08-24 22:02:55.000000000 +0100
10+++ tslib-1.0/configure.ac 2007-07-09 21:04:38.000000000 +0100
11@@ -2,7 +2,7 @@
12 # Process this file with autoconf to produce a configure script.
13
14 AC_PREREQ(2.57)
15-AC_INIT(tslib, 0.0.2, kergoth@handhelds.org)
16+AC_INIT(tslib, 1.0.0, kergoth@handhelds.org)
17 # AC_CONFIG_AUX_DIR(config)
18 AM_INIT_AUTOMAKE(dist-bzip2)
19 AC_CONFIG_SRCDIR([src/ts_close.c])
20@@ -193,10 +193,10 @@ TS_CONF='${sysconfdir}/ts.conf'
21 AC_SUBST(TS_CONF)
22
23 # Library versioning
24-LT_RELEASE=0.0
25-LT_CURRENT=1
26-LT_REVISION=1
27-LT_AGE=1
28+LT_RELEASE=1.0
29+LT_CURRENT=0
30+LT_REVISION=0
31+LT_AGE=0
32 AC_SUBST(LT_RELEASE)
33 AC_SUBST(LT_CURRENT)
34 AC_SUBST(LT_REVISION)
diff --git a/meta/recipes-graphics/tslib/tslib/multievent.patch b/meta/recipes-graphics/tslib/tslib/multievent.patch
deleted file mode 100644
index e6803f5a87..0000000000
--- a/meta/recipes-graphics/tslib/tslib/multievent.patch
+++ /dev/null
@@ -1,845 +0,0 @@
1Upstream-Status: Pending
2
3--- tslib/plugins/linear.c~multievent
4+++ tslib/plugins/linear.c
5@@ -39,14 +39,12 @@
6 linear_read(struct tslib_module_info *info, struct ts_sample *samp, int nr)
7 {
8 struct tslib_linear *lin = (struct tslib_linear *)info;
9- int ret;
10+ int ret, i = 0;
11 int xtemp,ytemp;
12
13 ret = info->next->ops->read(info->next, samp, nr);
14 if (ret >= 0) {
15- int nr;
16-
17- for (nr = 0; nr < ret; nr++, samp++) {
18+ for (i = 0; i < ret; i++, samp++) {
19 #ifdef DEBUG
20 fprintf(stderr,"BEFORE CALIB--------------------> %d %d %d\n",samp->x, samp->y, samp->pressure);
21 #endif /*DEBUG*/
22@@ -66,6 +64,7 @@
23 samp->y = tmp;
24 }
25 }
26+ ret = i;
27 }
28
29 return ret;
30--- tslib/plugins/dejitter.c~multievent
31+++ tslib/plugins/dejitter.c
32@@ -24,7 +24,6 @@
33
34 struct tslib_threshold {
35 struct tslib_module_info module;
36- int pthreshold;
37 int xdelta;
38 int ydelta;
39 int delta2;
40@@ -36,40 +35,28 @@
41 static int threshold_read(struct tslib_module_info *info, struct ts_sample *samp, int nr)
42 {
43 struct tslib_threshold *thr = (struct tslib_threshold *)info;
44- struct ts_sample *s;
45- int ret;
46+ struct ts_sample *src = samp, *dest = samp;
47+ int ret, i = 0;
48
49 ret = info->next->ops->read(info->next, samp, nr);
50 if (ret >= 0) {
51- int nr = 0;
52-
53- for (s = samp; s < samp + ret; s++) {
54+ for (i = 0; i < ret; i++, samp++) {
55 int dr2;
56 #ifdef DEBUG
57- fprintf(stderr,"BEFORE DEJITTER---------------> %d %d %d\n",s->x,s->y,s->pressure);
58+ fprintf(stderr,"BEFORE DEJITTER---------------> %d %d %d\n", samp->x, samp->y, samp->pressure);
59 #endif /*DEBUG*/
60- thr->down = (s->pressure >= thr->pthreshold);
61- if (thr->down) {
62- dr2 = (thr->x - s->x)*(thr->x - s->x)
63- + (thr->y - s->y)*(thr->y - s->y);
64- if(dr2 < thr->delta2) {
65- s->x = thr->x;
66- s->y = thr->y;
67- } else {
68- thr->x = s->x;
69- thr->y = s->y;
70- }
71-
72+ dr2 = (thr->x - samp->x)*(thr->x - samp->x)
73+ + (thr->y - samp->y)*(thr->y - samp->y);
74+ if(dr2 < thr->delta2) {
75+ samp->x = thr->x;
76+ samp->y = thr->y;
77 } else {
78- s->x = thr->x;
79- s->y = thr->y;
80+ thr->x = samp->x;
81+ thr->y = samp->y;
82 }
83-
84-
85- samp[nr++] = *s;
86 }
87
88- ret = nr;
89+ ret = i;
90 }
91 return ret;
92 }
93@@ -106,10 +93,6 @@
94 thr->ydelta = v;
95 break;
96
97- case 3:
98- thr->pthreshold = v;
99- break;
100-
101 default:
102 return -1;
103 }
104@@ -120,7 +103,6 @@
105 {
106 { "xdelta", (void *)1, threshold_limit },
107 { "ydelta", (void *)2, threshold_limit },
108- { "pthreshold", (void *)3, threshold_limit }
109 };
110
111 //#define NR_VARS (sizeof(threshold_vars) / sizeof(threshold_vars[0]))
112@@ -138,7 +120,6 @@
113
114 thr->xdelta = 10;
115 thr->ydelta = 10;
116- thr->pthreshold = 100;
117
118 if (tslib_parse_vars(&thr->module, threshold_vars, NR_VARS, params)) {
119 free(thr);
120--- tslib/plugins/variance.c~multievent
121+++ tslib/plugins/variance.c
122@@ -9,25 +9,36 @@
123 * $Id: variance.c,v 1.3 2002/11/08 23:28:55 dlowder Exp $
124 *
125 * Variance filter for touchscreen values
126+ *
127+ * Policy question (applies to all tslib modules that consume events):
128+ * 1) User requests a read of 5 events using nr.
129+ * 2) Lower layers return us 4 events.
130+ * 3) Perform variance calculation, we now only have _1_ event.
131+ * 4) Do we, a) duplicate this data across the user requested 4 events,
132+ * b) push up the single event
133+ * c) loop on the read from the lower layers to obtain
134+ * the user's requested number of events, unless we hit
135+ * a pen_up.
136 */
137+
138 #include <errno.h>
139 #include <stdlib.h>
140 #include <string.h>
141 #include <limits.h>
142-
143 #include <stdio.h>
144
145 #include "tslib.h"
146 #include "tslib-filter.h"
147
148+#define NR_INIT -1
149 #define NR_LAST 4
150
151 struct tslib_variance {
152 struct tslib_module_info module;
153 int nr;
154- unsigned int pthreshold;
155 unsigned int xlimit;
156 unsigned int ylimit;
157+ unsigned int pthreshold;
158 struct ts_sample last[NR_LAST];
159 };
160
161@@ -37,8 +48,7 @@
162 * least variance, and average them.
163 */
164 static int
165-variance_calculate(struct tslib_variance *var, struct ts_sample *samp,
166- struct ts_sample *s)
167+variance_calculate(struct tslib_variance *var, struct ts_sample *dest, struct ts_sample *src)
168 {
169 int i, j;
170 int diff_x, min_x, i_x, j_x;
171@@ -100,11 +110,11 @@
172 }
173 }
174
175- samp->x = (var->last[i_x].x + var->last[j_x].x) / 2;
176- samp->y = (var->last[i_y].y + var->last[j_y].y) / 2;
177- samp->pressure = (var->last[i_p].pressure + var->last[j_p].pressure) / 2;
178- samp->tv.tv_sec = s->tv.tv_sec;
179- samp->tv.tv_usec = s->tv.tv_usec;
180+ dest->x = (var->last[i_x].x + var->last[j_x].x) / 2;
181+ dest->y = (var->last[i_y].y + var->last[j_y].y) / 2;
182+ dest->pressure = (var->last[i_p].pressure + var->last[j_p].pressure) / 2;
183+ dest->tv.tv_sec = src->tv.tv_sec;
184+ dest->tv.tv_usec = src->tv.tv_usec;
185
186 return 1;
187 }
188@@ -112,55 +122,57 @@
189 static int variance_read(struct tslib_module_info *info, struct ts_sample *samp, int nr)
190 {
191 struct tslib_variance *var = (struct tslib_variance *)info;
192- struct ts_sample *s;
193- int ret;
194-
195- ret = info->next->ops->read(info->next, samp, nr);
196- if (ret >= 0) {
197- int nr = 0;
198-
199- for (s = samp; s < samp + ret; s++) {
200- if (s->pressure < var->pthreshold) {
201- /*
202- * Pen was released. Reset our state and
203- * pass up the release information.
204- */
205-// samp[nr].x = 0;
206-// samp[nr].y = 0;
207- samp[nr].pressure = s->pressure;
208- samp[nr].tv.tv_sec = s->tv.tv_sec;
209- samp[nr].tv.tv_usec = s->tv.tv_usec;
210-
211- nr++;
212-
213- var->nr = 0;
214- continue;
215- } else if (var->nr == -1) {
216- /*
217- * Pen was pressed. Inform upper layers
218- * immediately.
219- */
220- samp[nr] = *s;
221- nr++;
222- }
223-
224- if (var->nr >= 0) {
225- var->last[var->nr].x = s->x;
226- var->last[var->nr].y = s->y;
227- var->last[var->nr].pressure = s->pressure;
228- }
229-
230- var->nr++;
231+ struct ts_sample *src = samp, *dest = samp;
232+ int ret, i = 0;
233
234- if (var->nr == NR_LAST) {
235- if (variance_calculate(var, samp + nr, s))
236- nr++;
237- var->nr = 0;
238+ /*
239+ * NOTES:
240+ *
241+ * Loop on read, collecting events until we hit nr, unless
242+ * we hit a pen up or encounter a failure.
243+ */
244+ while ((i < nr) && (ret != -1)) {
245+ ret = info->next->ops->read(info->next, dest + i, nr - i);
246+ if (ret >= 0) {
247+ for (src = dest + i; src < dest + ret; src++) {
248+ if (src->pressure < var->pthreshold) {
249+ /* pen released, reset var->nr,
250+ * do a calc based on what we have so
251+ * far, and let this event flow up */
252+ if (variance_calculate(var, dest + i, src))
253+ i++;
254+ var->nr = NR_INIT;
255+ ret = -1; /* break outer loop, push up event */
256+ break;
257+ } else if (var->nr == NR_INIT) {
258+ /*
259+ * First pen down event. Inform upper layers
260+ * immediately for responsiveness.
261+ */
262+ var->nr = 0;
263+ i++;
264+ ret = -1; /* break outer loop */
265+ break;
266+ }
267+
268+ if (var->nr >= 0) {
269+ var->last[var->nr].x = src->x;
270+ var->last[var->nr].y = src->y;
271+ var->last[var->nr].pressure = src->pressure;
272+ }
273+
274+ var->nr++;
275+
276+ if (var->nr == NR_LAST) {
277+ if (variance_calculate(var, dest + i, src))
278+ i++;
279+ var->nr = 0;
280+ }
281 }
282 }
283-
284- ret = nr;
285 }
286+ /* if we've collected at least one event, send it up */
287+ if (i != 0) ret = i;
288 return ret;
289 }
290
291@@ -196,10 +208,6 @@
292 var->ylimit = v;
293 break;
294
295- case 3:
296- var->pthreshold = v;
297- break;
298-
299 default:
300 return -1;
301 }
302@@ -210,7 +218,6 @@
303 {
304 { "xlimit", (void *)1, variance_limit },
305 { "ylimit", (void *)2, variance_limit },
306- { "pthreshold", (void *)3, variance_limit }
307 };
308
309 #define NR_VARS (sizeof(variance_vars) / sizeof(variance_vars[0]))
310@@ -218,6 +225,7 @@
311 struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
312 {
313 struct tslib_variance *var;
314+ char *pthresvar;
315
316 var = malloc(sizeof(struct tslib_variance));
317 if (var == NULL)
318@@ -225,10 +233,15 @@
319
320 var->module.ops = &variance_ops;
321
322- var->nr = -1;
323+ var->nr = NR_INIT;
324 var->xlimit = 160;
325 var->ylimit = 160;
326 var->pthreshold = 100;
327+ pthresvar = getenv("TSLIB_PTHRES");
328+ if (pthresvar != NULL) {
329+ int p = strtol(pthresvar, (char **)NULL, 10);
330+ if (p != -1) var->pthreshold = p;
331+ }
332
333 if (tslib_parse_vars(&var->module, variance_vars, NR_VARS, params)) {
334 free(var);
335--- tslib/README~multievent
336+++ tslib/README
337@@ -36,6 +36,19 @@
338 usages. They are by no means exhaustive, nor probably even good examples.
339 They are basically the programs I used to test this library.
340
341+Module Creation Notes
342+=====================
343+
344+For those creating tslib modules, it is important to note a couple things with
345+regard to handling of the ability for a user to request more than one ts event
346+at a time. The first thing to note is that the lower layers may send up less
347+events than the user requested, but only if that was a result of a pen release.
348+Next, your module should send up just as many events as the user requested in
349+nr. If your module is one that consumes events, such as variance, then you
350+loop on the read from the lower layers, and only send the events up when
351+1) you have the number of events requested by the user, or 2) one of the events
352+from the lower layers was a pen release.
353+
354
355 Module Parameters
356 =================
357--- tslib/src/ts_read_raw.c~multievent
358+++ tslib/src/ts_read_raw.c
359@@ -14,10 +14,10 @@
360 *
361 * Read raw pressure, x, y, and timestamp from a touchscreen device.
362 */
363+
364 #include "config.h"
365
366 #include <stdio.h>
367-
368 #include <stdlib.h>
369 #ifdef HAVE_UNISTD_H
370 #include <unistd.h>
371@@ -25,79 +25,27 @@
372 #include <sys/time.h>
373 #include <sys/types.h>
374
375-#ifdef USE_INPUT_API
376-#include <linux/input.h>
377-#else
378-struct ts_event { /* Used in UCB1x00 style touchscreens (the default) */
379- unsigned short pressure;
380- unsigned short x;
381- unsigned short y;
382- unsigned short pad;
383- struct timeval stamp;
384-};
385-struct h3600_ts_event { /* Used in the Compaq IPAQ */
386- unsigned short pressure;
387- unsigned short x;
388- unsigned short y;
389- unsigned short pad;
390-};
391-struct mk712_ts_event { /* Used in the Hitachi Webpad */
392- unsigned int header;
393- unsigned int x;
394- unsigned int y;
395- unsigned int reserved;
396-};
397-struct arctic2_ts_event { /* Used in the IBM Arctic II */
398- signed short pressure;
399- signed int x;
400- signed int y;
401- int millisecs;
402- int flags;
403-};
404-struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */
405- long y;
406- long x;
407- long pressure;
408- long long millisecs;
409-};
410-struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */
411- short pressure;
412- short x;
413- short y;
414- short millisecs;
415-};
416-#endif /* USE_INPUT_API */
417-
418 #include "tslib-private.h"
419
420-int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr)
421-{
422 #ifdef USE_INPUT_API
423+#include <linux/input.h>
424+
425+static inline int get_input_event(struct tsdev *ts, struct ts_sample *samp) {
426 struct input_event ev;
427-#else
428- struct ts_event *evt;
429- struct h3600_ts_event *hevt;
430- struct mk712_ts_event *mevt;
431- struct arctic2_ts_event *aevt;
432- struct collie_ts_event *collie_evt;
433- struct corgi_ts_event *corgi_evt;
434-#endif /* USE_INPUT_API */
435- int ret;
436- int total = 0;
437+ struct timeval tv = {0, 0};
438+ fd_set fdset;
439+ int ret = 0;
440
441- char *tseventtype=NULL;
442- char *defaulttseventtype="UCB1x00";
443+ /* event vars */
444+ static int curr_x = 0, curr_y = 0;
445+ int curr_p = 0, next_x = 0, next_y = 0;
446
447-#ifdef USE_INPUT_API
448- /* warning: maybe those static vars should be part of the tsdev struct? */
449- static int curr_x = 0, curr_y = 0, curr_p = 0;
450- static int got_curr_x = 0, got_curr_y = 0;
451- int got_curr_p = 0;
452- int next_x, next_y;
453+ /* state variables */
454+ int got_curr_x = 0, got_curr_y = 0, got_curr_p = 0;
455 int got_next_x = 0, got_next_y = 0;
456 int got_tstamp = 0;
457
458- while (total < nr) {
459+ while (1) {
460 ret = read(ts->fd, &ev, sizeof(struct input_event));
461 if (ret < sizeof(struct input_event)) break;
462
463@@ -146,177 +94,231 @@
464 samp->tv = ev.time;
465 }
466
467- if ( (!got_curr_x || !got_curr_y) && !got_curr_p &&
468- !got_next_x && !got_next_y ) {
469- /*
470- * The current event is not complete yet.
471- * Give the kernel a chance to feed us more.
472- */
473- struct timeval tv = {0, 0};
474- fd_set fdset;
475- FD_ZERO(&fdset);
476- FD_SET(ts->fd, &fdset);
477- ret = select(ts->fd+1, &fdset, NULL, NULL, &tv);
478- if (ret == 1) continue;
479- if (ret == -1) break;
480+ if (got_curr_x && got_curr_y && got_curr_p) {
481+ /* we have a complete event */
482+ samp->x = curr_x;
483+ samp->y = curr_y;
484+ samp->pressure = curr_p;
485+ ret = 0; /* indicate success */
486+ if (got_next_x) curr_x = next_x;
487+ if (got_next_y) curr_y = next_y;
488+ break;
489 }
490
491- /* We consider having a complete ts event */
492- samp->x = curr_x;
493- samp->y = curr_y;
494- samp->pressure = curr_p;
495-#ifdef DEBUG
496- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
497-#endif /*DEBUG*/
498- samp++;
499- total++;
500-
501- /* get ready for next event */
502- if (got_next_x) curr_x = next_x; else got_curr_x = 0;
503- if (got_next_y) curr_y = next_y; else got_curr_y = 0;
504- got_next_x = got_next_y = got_tstamp = 0;
505+ /*
506+ * The current event is not complete yet.
507+ * Give the kernel a chance to feed us more.
508+ */
509+ FD_ZERO(&fdset);
510+ FD_SET(ts->fd, &fdset);
511+ ret = select(ts->fd+1, &fdset, NULL, NULL, &tv);
512+ if (ret == 1) continue;
513+ if (ret == -1) break;
514 }
515
516- if (ret) ret = -1;
517- if (total) ret = total;
518+// fprintf(stdout, "%s: returning %d\n", __FUNCTION__, ret);
519+ if (ret != 0) ret = -1;
520+ return ret;
521+}
522+
523 #else
524+
525+struct ucb1x00_ts_event { /* Used in UCB1x00 style touchscreens (the default) */
526+ unsigned short pressure;
527+ unsigned short x;
528+ unsigned short y;
529+ unsigned short pad;
530+ struct timeval stamp;
531+};
532+struct h3600_ts_event { /* Used in the Compaq IPAQ */
533+ unsigned short pressure;
534+ unsigned short x;
535+ unsigned short y;
536+ unsigned short pad;
537+};
538+struct mk712_ts_event { /* Used in the Hitachi Webpad */
539+ unsigned int header;
540+ unsigned int x;
541+ unsigned int y;
542+ unsigned int reserved;
543+};
544+struct arctic2_ts_event { /* Used in the IBM Arctic II */
545+ signed short pressure;
546+ signed int x;
547+ signed int y;
548+ int millisecs;
549+ int flags;
550+};
551+struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */
552+ long y;
553+ long x;
554+ long pressure;
555+ long long millisecs;
556+};
557+struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */
558+ short pressure;
559+ short x;
560+ short y;
561+ short millisecs;
562+};
563+
564+static inline int get_ucb1x00_event(struct tsdev *ts, struct ts_sample *samp) {
565+ struct ucb1x00_ts_event evt;
566+ int ret = read(ts->fd, &evt, sizeof(struct ucb1x00_ts_event));
567+ if (ret > 0) {
568+ samp->x = evt.x;
569+ samp->y = evt.y;
570+ samp->pressure = evt.pressure;
571+ samp->tv.tv_usec = evt.stamp.tv_usec;
572+ samp->tv.tv_sec = evt.stamp.tv_sec;
573+ ret = 0; /* success */
574+ }
575+ return ret;
576+}
577+
578+static inline int get_h3600_event(struct tsdev *ts, struct ts_sample *samp) {
579+ struct h3600_ts_event evt;
580+ int ret = read(ts->fd, &evt, sizeof(struct h3600_ts_event));
581+ if (ret > 0) {
582+ samp->x = evt.x;
583+ samp->y = evt.y;
584+ samp->pressure = evt.pressure;
585+ gettimeofday(&samp->tv, NULL);
586+ ret = 0; /* success */
587+ }
588+ return ret;
589+}
590+
591+static inline int get_mk712_event(struct tsdev *ts, struct ts_sample *samp) {
592+ struct mk712_ts_event evt;
593+ int ret = read(ts->fd, &evt, sizeof(struct mk712_ts_event));
594+ if (ret > 0) {
595+ samp->x = (short)evt.x;
596+ samp->y = (short)evt.y;
597+ if(evt.header==0)
598+ samp->pressure=1;
599+ else
600+ samp->pressure=0;
601+ gettimeofday(&samp->tv, NULL);
602+ ret = 0; /* success */
603+ }
604+ return ret;
605+}
606+
607+static inline int get_arctic2_event(struct tsdev *ts, struct ts_sample *samp) {
608+ struct arctic2_ts_event evt;
609+ int ret = read(ts->fd, &evt, sizeof(struct arctic2_ts_event));
610+ if (ret > 0) {
611+ samp->x = (short)evt.x;
612+ samp->y = (short)evt.y;
613+ samp->pressure = evt.pressure;
614+ gettimeofday(&samp->tv, NULL);
615+ ret = 0; /* success */
616+ }
617+ return ret;
618+}
619+
620+static inline int get_collie_event(struct tsdev *ts, struct ts_sample *samp) {
621+ struct collie_ts_event evt;
622+ int ret = read(ts->fd, &evt, sizeof(struct collie_ts_event));
623+ if (ret > 0) {
624+ samp->x = evt.x;
625+ samp->y = evt.y;
626+ samp->pressure = evt.pressure;
627+ samp->tv.tv_usec = evt.millisecs % 1000;
628+ samp->tv.tv_sec = evt.millisecs / 1000;
629+ ret = 0; /* success */
630+ }
631+ return ret;
632+}
633+
634+static inline int get_corgi_event(struct tsdev *ts, struct ts_sample *samp) {
635+ struct corgi_ts_event evt;
636+ int ret = read(ts->fd, &evt, sizeof(struct corgi_ts_event));
637+ if (ret > 0) {
638+ samp->x = evt.x;
639+ samp->y = evt.y;
640+ samp->pressure = evt.pressure;
641+ samp->tv.tv_usec = evt.millisecs % 1000;
642+ samp->tv.tv_sec = evt.millisecs / 1000;
643+ ret = 0; /* success */
644+ }
645+ return ret;
646+}
647+
648+#endif
649+
650+int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr)
651+{
652+ int ret;
653+ int total = 0;
654+ int pen_down = 1;
655+ static short x_save = 0, y_save = 0;
656+ static int pthres = -1;
657+
658+#ifndef USE_INPUT_API
659+ char *tseventtype=NULL;
660+ char *defaulttseventtype="UCB1x00";
661 tseventtype = getenv("TSLIB_TSEVENTTYPE");
662 if(tseventtype==NULL) tseventtype=defaulttseventtype;
663+#endif
664
665- if( strcmp(tseventtype,"H3600") == 0) { /* iPAQ style h3600 touchscreen events */
666- hevt = alloca(sizeof(*hevt) * nr);
667- ret = read(ts->fd, hevt, sizeof(*hevt) * nr);
668- if(ret > 0) {
669- int nr = ret / sizeof(*hevt);
670- while(ret >= sizeof(*hevt)) {
671- samp->x = hevt->x;
672- samp->y = hevt->y;
673- samp->pressure = hevt->pressure;
674-#ifdef DEBUG
675- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
676-#endif /*DEBUG*/
677- gettimeofday(&samp->tv,NULL);
678- samp++;
679- hevt++;
680- ret -= sizeof(*hevt);
681- }
682- } else {
683- return -1;
684- }
685- } else if( strcmp(tseventtype,"MK712") == 0) { /* Hitachi Webpad events */
686- mevt = alloca(sizeof(*mevt) * nr);
687- ret = read(ts->fd, mevt, sizeof(*mevt) * nr);
688- if(ret > 0) {
689- int nr = ret / sizeof(*mevt);
690- while(ret >= sizeof(*mevt)) {
691- samp->x = (short)mevt->x;
692- samp->y = (short)mevt->y;
693- if(mevt->header==0)
694- samp->pressure=1;
695- else
696- samp->pressure=0;
697-#ifdef DEBUG
698- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
699-#endif /*DEBUG*/
700- gettimeofday(&samp->tv,NULL);
701- samp++;
702- mevt++;
703- ret -= sizeof(*mevt);
704- }
705- } else {
706- return -1;
707- }
708-
709- } else if( strcmp(tseventtype,"ARCTIC2") == 0) { /* IBM Arctic II events */
710- aevt = alloca(sizeof(*aevt) * nr);
711- ret = read(ts->fd, aevt, sizeof(*aevt) * nr);
712- if(ret > 0) {
713- int nr = ret / sizeof(*aevt);
714- while(ret >= sizeof(*aevt)) {
715- samp->x = (short)aevt->x;
716- samp->y = (short)aevt->y;
717- samp->pressure = aevt->pressure;
718-#ifdef DEBUG
719- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
720-#endif /*DEBUG*/
721- gettimeofday(&samp->tv,NULL);
722- samp++;
723- aevt++;
724- ret -= sizeof(*aevt);
725- }
726+ while ((total < nr) && pen_down) {
727+// fprintf(stdout, "total: %d, nr: %d\n", total, nr);
728+#ifdef USE_INPUT_API
729+ ret = get_input_event(ts, samp);
730+#else
731+ if (strcmp(tseventtype, "H3600") == 0) {
732+ /* iPAQ style h3600 touchscreen events */
733+ ret = get_h3600_event(ts, samp);
734+ } else if (strcmp(tseventtype, "MK712") == 0) {
735+ /* Hitachi Webpad events */
736+ ret = get_mk712_event(ts, samp);
737+ } else if (strcmp(tseventtype, "ARCTIC2") == 0) {
738+ /* IBM Arctic II events */
739+ ret = get_arctic2_event(ts, samp);
740+ } else if (strcmp(tseventtype, "COLLIE") == 0) {
741+ /* Sharp Zaurus SL-5000d/5500 events */
742+ ret = get_collie_event(ts, samp);
743+ } else if (strcmp(tseventtype,"CORGI") == 0) {
744+ /* Sharp Zaurus SL-C700 events */
745+ ret = get_corgi_event(ts, samp);
746 } else {
747- return -1;
748+ /* Use normal UCB1x00 type events */
749+ ret = get_ucb1x00_event(ts, samp);
750 }
751+#endif
752+ if (ret != 0) break;
753
754- } else if( strcmp(tseventtype,"COLLIE") == 0) { /* Sharp Zaurus SL-5000d/5500 events */
755- collie_evt = alloca(sizeof(*collie_evt) * nr);
756- ret = read(ts->fd, collie_evt, sizeof(*collie_evt) * nr);
757- if(ret > 0) {
758- int nr = ret / sizeof(*collie_evt);
759- while(ret >= sizeof(*collie_evt)) {
760- samp->x = collie_evt->x;
761- samp->y = collie_evt->y;
762- samp->pressure = collie_evt->pressure;
763-#ifdef DEBUG
764- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
765-#endif /*DEBUG*/
766- samp->tv.tv_usec = collie_evt->millisecs % 1000;
767- samp->tv.tv_sec = collie_evt->millisecs / 1000;
768- samp++;
769- collie_evt++;
770- ret -= sizeof(*collie_evt);
771+ if (pthres == -1) {
772+ char *pthresvar = getenv("TSLIB_PTHRES");
773+ pthres = 100;
774+ if (pthresvar != NULL) {
775+ int p = strtol(pthresvar, (char **)NULL, 10);
776+ if (p != -1) pthres = p;
777 }
778- } else {
779- return -1;
780 }
781
782- } else if( strcmp(tseventtype,"CORGI") == 0) { /* Sharp Zaurus SL-C700 events */
783- corgi_evt = alloca(sizeof(*corgi_evt) * nr);
784- ret = read(ts->fd, corgi_evt, sizeof(*corgi_evt) * nr);
785- if(ret > 0) {
786- int nr = ret / sizeof(*corgi_evt);
787- while(ret >= sizeof(*corgi_evt)) {
788- samp->x = corgi_evt->x;
789- samp->y = corgi_evt->y;
790- samp->pressure = corgi_evt->pressure;
791-#ifdef DEBUG
792- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
793-#endif /*DEBUG*/
794- samp->tv.tv_usec = corgi_evt->millisecs % 1000;
795- samp->tv.tv_sec = corgi_evt->millisecs / 1000;
796- samp++;
797- corgi_evt++;
798- ret -= sizeof(*corgi_evt);
799- }
800+ if (samp->pressure < pthres) {
801+ /* pen released, send events up */
802+ pen_down = 0;
803+ /* set x and y to previous values */
804+ samp->x = x_save;
805+ samp->y = y_save;
806 } else {
807- return -1;
808+ pen_down = 1;
809+ x_save = samp->x;
810+ y_save = samp->y;
811 }
812-
813- } else { /* Use normal UCB1x00 type events */
814- evt = alloca(sizeof(*evt) * nr);
815- ret = read(ts->fd, evt, sizeof(*evt) * nr);
816- if(ret > 0) {
817- int nr = ret / sizeof(*evt);
818- while(ret >= sizeof(*evt)) {
819- samp->x = evt->x;
820- samp->y = evt->y;
821- samp->pressure = evt->pressure;
822 #ifdef DEBUG
823- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
824+ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x, samp->y, samp->pressure);
825 #endif /*DEBUG*/
826- samp->tv.tv_usec = evt->stamp.tv_usec;
827- samp->tv.tv_sec = evt->stamp.tv_sec;
828- samp++;
829- evt++;
830- ret -= sizeof(*evt);
831- }
832- } else {
833- return -1;
834- }
835+ samp++;
836+ total++;
837 }
838- ret = nr;
839-#endif /* USE_INPUT_API */
840
841+ if (ret != 0) ret = -1;
842+ if (total) ret = total;
843 return ret;
844 }
845
diff --git a/meta/recipes-graphics/tslib/tslib/obsolete_automake_macros.patch b/meta/recipes-graphics/tslib/tslib/obsolete_automake_macros.patch
deleted file mode 100644
index 982413e859..0000000000
--- a/meta/recipes-graphics/tslib/tslib/obsolete_automake_macros.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1Upstream-Status: Submitted [https://github.com/kergoth/tslib/pull/14]
2
3Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
4diff -Nurd tslib-1.0/configure.ac tslib-1.0/configure.ac
5--- tslib-1.0/configure.ac 2006-08-25 00:02:55.000000000 +0300
6+++ tslib-1.0/configure.ac 2013-01-03 06:05:02.486882412 +0200
7@@ -6,7 +6,7 @@
8 # AC_CONFIG_AUX_DIR(config)
9 AM_INIT_AUTOMAKE(dist-bzip2)
10 AC_CONFIG_SRCDIR([src/ts_close.c])
11-AM_CONFIG_HEADER(config.h)
12+AC_CONFIG_HEADERS(config.h)
13
14 PACKAGE_DESCRIPTION="Touchscreen Access Library"
15 AC_SUBST(PACKAGE_DESCRIPTION)
diff --git a/meta/recipes-graphics/tslib/tslib/set-open-mode-for-ts_calibrate_c.patch b/meta/recipes-graphics/tslib/tslib/set-open-mode-for-ts_calibrate_c.patch
deleted file mode 100644
index 738ef9aad1..0000000000
--- a/meta/recipes-graphics/tslib/tslib/set-open-mode-for-ts_calibrate_c.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1Get patch from: http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/27614
2
3Upstream-Status: Inappropriate [configuration]
4
5diff --git a/tests/ts_calibrate.c b/tests/ts_calibrate.c
6index 004517b..c0a9771 100644
7--- a/tests/ts_calibrate.c
8+++ b/tests/ts_calibrate.c
9@@ -21,6 +21,7 @@
10 #include <sys/ioctl.h>
11 #include <sys/mman.h>
12 #include <sys/time.h>
13+#include <sys/stat.h>
14 #include <linux/kd.h>
15 #include <linux/vt.h>
16 #include <linux/fb.h>
17@@ -224,9 +225,11 @@ int main()
18 for (i = 0; i < 7; i++) printf("%d ", cal.a [i]);
19 printf("\n");
20 if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
21- cal_fd = open (calfile, O_CREAT | O_RDWR);
22+ cal_fd = open (calfile, O_CREAT | O_RDWR,
23+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
24 } else {
25- cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);
26+ cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR,
27+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
28 }
29 sprintf (cal_buffer,"%d %d %d %d %d %d %d",
30 cal.a[1], cal.a[2], cal.a[0],
diff --git a/meta/recipes-graphics/tslib/tslib_1.0.bb b/meta/recipes-graphics/tslib/tslib_1.1.bb
index 84bc1ebdc2..4dce8a79dc 100644
--- a/meta/recipes-graphics/tslib/tslib_1.0.bb
+++ b/meta/recipes-graphics/tslib/tslib_1.1.bb
@@ -10,21 +10,13 @@ SECTION = "base"
10LICENSE = "LGPLv2" 10LICENSE = "LGPLv2"
11LIC_FILES_CHKSUM = "file://COPYING;md5=f30a9716ef3762e3467a2f62bf790f0a" 11LIC_FILES_CHKSUM = "file://COPYING;md5=f30a9716ef3762e3467a2f62bf790f0a"
12 12
13PR = "r21" 13SRC_URI = "https://github.com/kergoth/tslib/releases/download/${PV}/tslib-${PV}.tar.xz;downloadfilename=tslib-${PV}.tar.xz \
14
15SRC_URI = "http://download.berlios.de/tslib/tslib-${PV}.tar.bz2 \
16 file://fix_version.patch \
17 file://0001-Link-plugins-against-libts.patch \
18 file://ts.conf \ 14 file://ts.conf \
19 file://tslib.sh \ 15 file://tslib.sh \
20 file://set-open-mode-for-ts_calibrate_c.patch \
21 file://obsolete_automake_macros.patch \
22" 16"
23 17
24SRC_URI[md5sum] = "92b2eb55b1e4ef7e2c0347069389390e" 18SRC_URI[md5sum] = "14771f8607b341bb4b297819d37e837d"
25SRC_URI[sha256sum] = "9c40d914e4f6fe00bdd77137d671c7ce4f211686228f2eb8b2d3c2360bc249c8" 19SRC_URI[sha256sum] = "fe35e5f710ea933b118f710e2ce4403ac076fe69926b570333867d4de082a51c"
26SRC_URI_append_qemumips = " file://32bitBE-support.patch"
27SRC_URI_append_qemuppc = " file://32bitBE-support.patch"
28 20
29 21
30inherit autotools pkgconfig 22inherit autotools pkgconfig