diff options
author | Chris Larson <clarson@kergoth.com> | 2004-11-09 00:36:47 +0000 |
---|---|---|
committer | Chris Larson <clarson@kergoth.com> | 2004-11-09 00:36:47 +0000 |
commit | f96441b9faf769c9ecdd4d338b605ea3d0cc4010 (patch) | |
tree | edb17ec2c4ea13c5acb1c7350957a249a820e28d /tslib | |
parent | b6588aa6851fb220cedc387d21c51513ef8d67f4 (diff) |
Disable bk EOLN_NATIVE conversions on all files in packages FILESPATHs, to prevent it screwing up patches.
BKrev: 4190111fA4MuVozAqwE7xOSL9fr-TA
Diffstat (limited to 'tslib')
-rw-r--r-- | tslib/tslib/collie/tslib.sh | 10 | ||||
-rw-r--r-- | tslib/tslib/corgi/tslib.sh | 6 | ||||
-rw-r--r-- | tslib/tslib/doc.patch | 50 | ||||
-rw-r--r-- | tslib/tslib/event1.patch | 44 | ||||
-rw-r--r-- | tslib/tslib/h3900/tslib.sh | 6 | ||||
-rw-r--r-- | tslib/tslib/husky/tslib.sh | 6 | ||||
-rw-r--r-- | tslib/tslib/jornada56x/tslib.sh | 6 | ||||
-rw-r--r-- | tslib/tslib/multievent.patch | 843 | ||||
-rw-r--r-- | tslib/tslib/pointercal.patch | 13 | ||||
-rw-r--r-- | tslib/tslib/poodle/tslib.sh | 10 | ||||
-rw-r--r-- | tslib/tslib/raw-hwread.patch | 706 | ||||
-rw-r--r-- | tslib/tslib/shepherd/tslib.sh | 6 | ||||
-rw-r--r-- | tslib/tslib/tosa/tslib.sh | 6 | ||||
-rw-r--r-- | tslib/tslib/ts_calibrate.patch | 23 |
14 files changed, 1735 insertions, 0 deletions
diff --git a/tslib/tslib/collie/tslib.sh b/tslib/tslib/collie/tslib.sh index e69de29bb2..187b7ce6d2 100644 --- a/tslib/tslib/collie/tslib.sh +++ b/tslib/tslib/collie/tslib.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +if (uname -r|grep -q 'embedix'); then + TSLIB_TSDEVICE=/dev/ts + TSLIB_TSEVENTTYPE=COLLIE +else + TSLIB_TSDEVICE=/dev/input/event0 +fi + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/corgi/tslib.sh b/tslib/tslib/corgi/tslib.sh index e69de29bb2..417ccd06ba 100644 --- a/tslib/tslib/corgi/tslib.sh +++ b/tslib/tslib/corgi/tslib.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TSLIB_TSDEVICE=/dev/ts +TSLIB_TSEVENTTYPE=CORGI + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/doc.patch b/tslib/tslib/doc.patch index e69de29bb2..d8f51b1e19 100644 --- a/tslib/tslib/doc.patch +++ b/tslib/tslib/doc.patch @@ -0,0 +1,50 @@ + +# +# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher +# + +--- tslib/README~doc ++++ tslib/README +@@ -35,8 +35,42 @@ + There are a couple of programs in the tslib/test directory which give example + usages. They are by no means exhaustive, nor probably even good examples. + They are basically the programs I used to test this library. ++ ++ ++Environment Variables ++===================== ++ ++TSLIB_TSEVENTTYPE Event type for non input api raw reads. ++ Default: UCB1x00 ++TSLIB_TSDEVICE TS device file name. ++ Default (non inputapi): /dev/touchscreen/ucb1x00 ++ Default (inputapi): /dev/input/event0 ++TSLIB_CALIBFILE Calibration file. ++ Default: ${sysconfdir}/pointercal ++TSLIB_CONFFILE Config file. ++ Default: ${sysconfdir}/ts.conf ++TSLIB_PLUGINDIR Plugin directory. ++ Default: ${datadir}/plugins ++TSLIB_CONSOLEDEVICE Console device. ++ Default: /dev/tty ++TSLIB_FBDEVICE Framebuffer device. ++ Default: /dev/fb0 + + ++Module Creation Notes ++===================== ++ ++For those creating tslib modules, it is important to note a couple things with ++regard to handling of the ability for a user to request more than one ts event ++at a time. The first thing to note is that the lower layers may send up less ++events than the user requested, but only if that was a result of a pen release. ++Next, your module should send up just as many events as the user requested in ++nr. If your module is one that consumes events, such as variance, then you ++loop on the read from the lower layers, and only send the events up when ++1) you have the number of events requested by the user, or 2) one of the events ++from the lower layers was a pen release. ++ ++ + Module Parameters + ================= + diff --git a/tslib/tslib/event1.patch b/tslib/tslib/event1.patch index e69de29bb2..33daded000 100644 --- a/tslib/tslib/event1.patch +++ b/tslib/tslib/event1.patch @@ -0,0 +1,44 @@ +--- tslib/tests/ts_calibrate.c~event1 ++++ tslib/tests/ts_calibrate.c +@@ -212,7 +212,7 @@ + ts = ts_open(tsdevice,0); + } else { + #ifdef USE_INPUT_API +- ts = ts_open("/dev/input/event0", 0); ++ ts = ts_open("/dev/input/event1", 0); + #else + ts = ts_open("/dev/touchscreen/ucb1x00", 0); + #endif /* USE_INPUT_API */ +--- tslib/tests/ts_print.c~event1 ++++ tslib/tests/ts_print.c +@@ -30,7 +30,7 @@ + ts = ts_open(tsdevice,0); + } else { + #ifdef USE_INPUT_API +- ts = ts_open("/dev/input/event0", 0); ++ ts = ts_open("/dev/input/event1", 0); + #else + ts = ts_open("/dev/touchscreen/ucb1x00", 0); + #endif /* USE_INPUT_API */ +--- tslib/tests/ts_test.c~event1 ++++ tslib/tests/ts_test.c +@@ -50,7 +50,7 @@ + ts = ts_open(tsdevice,0); + } else { + #ifdef USE_INPUT_API +- ts = ts_open("/dev/input/event0", 0); ++ ts = ts_open("/dev/input/event1", 0); + #else + ts = ts_open("/dev/touchscreen/ucb1x00", 0); + #endif /* USE_INPUT_API */ +--- tslib/tests/ts_print_raw.c~event1 ++++ tslib/tests/ts_print_raw.c +@@ -30,7 +30,7 @@ + ts = ts_open(tsdevice,0); + } else { + #ifdef USE_INPUT_API +- ts = ts_open("/dev/input/event0", 0); ++ ts = ts_open("/dev/input/event1", 0); + #else + ts = ts_open("/dev/touchscreen/ucb1x00", 0); + #endif /* USE_INPUT_API */ diff --git a/tslib/tslib/h3900/tslib.sh b/tslib/tslib/h3900/tslib.sh index e69de29bb2..0c7bef2b09 100644 --- a/tslib/tslib/h3900/tslib.sh +++ b/tslib/tslib/h3900/tslib.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TSLIB_TSDEVICE=/dev/touchscreen/0 +TSLIB_TSEVENTTYPE=H3600 + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/husky/tslib.sh b/tslib/tslib/husky/tslib.sh index e69de29bb2..417ccd06ba 100644 --- a/tslib/tslib/husky/tslib.sh +++ b/tslib/tslib/husky/tslib.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TSLIB_TSDEVICE=/dev/ts +TSLIB_TSEVENTTYPE=CORGI + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/jornada56x/tslib.sh b/tslib/tslib/jornada56x/tslib.sh index e69de29bb2..e64f644b74 100644 --- a/tslib/tslib/jornada56x/tslib.sh +++ b/tslib/tslib/jornada56x/tslib.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TSLIB_TSDEVICE=/dev/input/ts0 +TSLIB_TSEVENTTYPE=H3600 + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/multievent.patch b/tslib/tslib/multievent.patch index e69de29bb2..a4522324c3 100644 --- a/tslib/tslib/multievent.patch +++ b/tslib/tslib/multievent.patch @@ -0,0 +1,843 @@ +--- tslib/plugins/linear.c~multievent ++++ tslib/plugins/linear.c +@@ -39,14 +39,12 @@ + linear_read(struct tslib_module_info *info, struct ts_sample *samp, int nr) + { + struct tslib_linear *lin = (struct tslib_linear *)info; +- int ret; ++ int ret, i = 0; + int xtemp,ytemp; + + ret = info->next->ops->read(info->next, samp, nr); + if (ret >= 0) { +- int nr; +- +- for (nr = 0; nr < ret; nr++, samp++) { ++ for (i = 0; i < ret; i++, samp++) { + #ifdef DEBUG + fprintf(stderr,"BEFORE CALIB--------------------> %d %d %d\n",samp->x, samp->y, samp->pressure); + #endif /*DEBUG*/ +@@ -66,6 +64,7 @@ + samp->y = tmp; + } + } ++ ret = i; + } + + return ret; +--- tslib/plugins/dejitter.c~multievent ++++ tslib/plugins/dejitter.c +@@ -24,7 +24,6 @@ + + struct tslib_threshold { + struct tslib_module_info module; +- int pthreshold; + int xdelta; + int ydelta; + int delta2; +@@ -36,40 +35,28 @@ + static int threshold_read(struct tslib_module_info *info, struct ts_sample *samp, int nr) + { + struct tslib_threshold *thr = (struct tslib_threshold *)info; +- struct ts_sample *s; +- int ret; ++ struct ts_sample *src = samp, *dest = samp; ++ int ret, i = 0; + + ret = info->next->ops->read(info->next, samp, nr); + if (ret >= 0) { +- int nr = 0; +- +- for (s = samp; s < samp + ret; s++) { ++ for (i = 0; i < ret; i++, samp++) { + int dr2; + #ifdef DEBUG +- fprintf(stderr,"BEFORE DEJITTER---------------> %d %d %d\n",s->x,s->y,s->pressure); ++ fprintf(stderr,"BEFORE DEJITTER---------------> %d %d %d\n", samp->x, samp->y, samp->pressure); + #endif /*DEBUG*/ +- thr->down = (s->pressure >= thr->pthreshold); +- if (thr->down) { +- dr2 = (thr->x - s->x)*(thr->x - s->x) +- + (thr->y - s->y)*(thr->y - s->y); +- if(dr2 < thr->delta2) { +- s->x = thr->x; +- s->y = thr->y; +- } else { +- thr->x = s->x; +- thr->y = s->y; +- } +- ++ dr2 = (thr->x - samp->x)*(thr->x - samp->x) ++ + (thr->y - samp->y)*(thr->y - samp->y); ++ if(dr2 < thr->delta2) { ++ samp->x = thr->x; ++ samp->y = thr->y; + } else { +- s->x = thr->x; +- s->y = thr->y; ++ thr->x = samp->x; ++ thr->y = samp->y; + } +- +- +- samp[nr++] = *s; + } + +- ret = nr; ++ ret = i; + } + return ret; + } +@@ -106,10 +93,6 @@ + thr->ydelta = v; + break; + +- case 3: +- thr->pthreshold = v; +- break; +- + default: + return -1; + } +@@ -120,7 +103,6 @@ + { + { "xdelta", (void *)1, threshold_limit }, + { "ydelta", (void *)2, threshold_limit }, +- { "pthreshold", (void *)3, threshold_limit } + }; + + //#define NR_VARS (sizeof(threshold_vars) / sizeof(threshold_vars[0])) +@@ -138,7 +120,6 @@ + + thr->xdelta = 10; + thr->ydelta = 10; +- thr->pthreshold = 100; + + if (tslib_parse_vars(&thr->module, threshold_vars, NR_VARS, params)) { + free(thr); +--- tslib/plugins/variance.c~multievent ++++ tslib/plugins/variance.c +@@ -9,25 +9,36 @@ + * $Id$ + * + * Variance filter for touchscreen values ++ * ++ * Policy question (applies to all tslib modules that consume events): ++ * 1) User requests a read of 5 events using nr. ++ * 2) Lower layers return us 4 events. ++ * 3) Perform variance calculation, we now only have _1_ event. ++ * 4) Do we, a) duplicate this data across the user requested 4 events, ++ * b) push up the single event ++ * c) loop on the read from the lower layers to obtain ++ * the user's requested number of events, unless we hit ++ * a pen_up. + */ ++ + #include <errno.h> + #include <stdlib.h> + #include <string.h> + #include <limits.h> +- + #include <stdio.h> + + #include "tslib.h" + #include "tslib-filter.h" + ++#define NR_INIT -1 + #define NR_LAST 4 + + struct tslib_variance { + struct tslib_module_info module; + int nr; +- unsigned int pthreshold; + unsigned int xlimit; + unsigned int ylimit; ++ unsigned int pthreshold; + struct ts_sample last[NR_LAST]; + }; + +@@ -37,8 +48,7 @@ + * least variance, and average them. + */ + static int +-variance_calculate(struct tslib_variance *var, struct ts_sample *samp, +- struct ts_sample *s) ++variance_calculate(struct tslib_variance *var, struct ts_sample *dest, struct ts_sample *src) + { + int i, j; + int diff_x, min_x, i_x, j_x; +@@ -100,11 +110,11 @@ + } + } + +- samp->x = (var->last[i_x].x + var->last[j_x].x) / 2; +- samp->y = (var->last[i_y].y + var->last[j_y].y) / 2; +- samp->pressure = (var->last[i_p].pressure + var->last[j_p].pressure) / 2; +- samp->tv.tv_sec = s->tv.tv_sec; +- samp->tv.tv_usec = s->tv.tv_usec; ++ dest->x = (var->last[i_x].x + var->last[j_x].x) / 2; ++ dest->y = (var->last[i_y].y + var->last[j_y].y) / 2; ++ dest->pressure = (var->last[i_p].pressure + var->last[j_p].pressure) / 2; ++ dest->tv.tv_sec = src->tv.tv_sec; ++ dest->tv.tv_usec = src->tv.tv_usec; + + return 1; + } +@@ -112,55 +122,57 @@ + static int variance_read(struct tslib_module_info *info, struct ts_sample *samp, int nr) + { + struct tslib_variance *var = (struct tslib_variance *)info; +- struct ts_sample *s; +- int ret; +- +- ret = info->next->ops->read(info->next, samp, nr); +- if (ret >= 0) { +- int nr = 0; +- +- for (s = samp; s < samp + ret; s++) { +- if (s->pressure < var->pthreshold) { +- /* +- * Pen was released. Reset our state and +- * pass up the release information. +- */ +-// samp[nr].x = 0; +-// samp[nr].y = 0; +- samp[nr].pressure = s->pressure; +- samp[nr].tv.tv_sec = s->tv.tv_sec; +- samp[nr].tv.tv_usec = s->tv.tv_usec; +- +- nr++; +- +- var->nr = 0; +- continue; +- } else if (var->nr == -1) { +- /* +- * Pen was pressed. Inform upper layers +- * immediately. +- */ +- samp[nr] = *s; +- nr++; +- } +- +- if (var->nr >= 0) { +- var->last[var->nr].x = s->x; +- var->last[var->nr].y = s->y; +- var->last[var->nr].pressure = s->pressure; +- } +- +- var->nr++; ++ struct ts_sample *src = samp, *dest = samp; ++ int ret, i = 0; + +- if (var->nr == NR_LAST) { +- if (variance_calculate(var, samp + nr, s)) +- nr++; +- var->nr = 0; ++ /* ++ * NOTES: ++ * ++ * Loop on read, collecting events until we hit nr, unless ++ * we hit a pen up or encounter a failure. ++ */ ++ while ((i < nr) && (ret != -1)) { ++ ret = info->next->ops->read(info->next, dest + i, nr - i); ++ if (ret >= 0) { ++ for (src = dest + i; src < dest + ret; src++) { ++ if (src->pressure < var->pthreshold) { ++ /* pen released, reset var->nr, ++ * do a calc based on what we have so ++ * far, and let this event flow up */ ++ if (variance_calculate(var, dest + i, src)) ++ i++; ++ var->nr = NR_INIT; ++ ret = -1; /* break outer loop, push up event */ ++ break; ++ } else if (var->nr == NR_INIT) { ++ /* ++ * First pen down event. Inform upper layers ++ * immediately for responsiveness. ++ */ ++ var->nr = 0; ++ i++; ++ ret = -1; /* break outer loop */ ++ break; ++ } ++ ++ if (var->nr >= 0) { ++ var->last[var->nr].x = src->x; ++ var->last[var->nr].y = src->y; ++ var->last[var->nr].pressure = src->pressure; ++ } ++ ++ var->nr++; ++ ++ if (var->nr == NR_LAST) { ++ if (variance_calculate(var, dest + i, src)) ++ i++; ++ var->nr = 0; ++ } + } + } +- +- ret = nr; + } ++ /* if we've collected at least one event, send it up */ ++ if (i != 0) ret = i; + return ret; + } + +@@ -196,10 +208,6 @@ + var->ylimit = v; + break; + +- case 3: +- var->pthreshold = v; +- break; +- + default: + return -1; + } +@@ -210,7 +218,6 @@ + { + { "xlimit", (void *)1, variance_limit }, + { "ylimit", (void *)2, variance_limit }, +- { "pthreshold", (void *)3, variance_limit } + }; + + #define NR_VARS (sizeof(variance_vars) / sizeof(variance_vars[0])) +@@ -218,6 +225,7 @@ + struct tslib_module_info *mod_init(struct tsdev *dev, const char *params) + { + struct tslib_variance *var; ++ char *pthresvar; + + var = malloc(sizeof(struct tslib_variance)); + if (var == NULL) +@@ -225,10 +233,15 @@ + + var->module.ops = &variance_ops; + +- var->nr = -1; ++ var->nr = NR_INIT; + var->xlimit = 160; + var->ylimit = 160; + var->pthreshold = 100; ++ pthresvar = getenv("TSLIB_PTHRES"); ++ if (pthresvar != NULL) { ++ int p = strtol(pthresvar, (char **)NULL, 10); ++ if (p != -1) var->pthreshold = p; ++ } + + if (tslib_parse_vars(&var->module, variance_vars, NR_VARS, params)) { + free(var); +--- tslib/README~multievent ++++ tslib/README +@@ -36,6 +36,19 @@ + usages. They are by no means exhaustive, nor probably even good examples. + They are basically the programs I used to test this library. + ++Module Creation Notes ++===================== ++ ++For those creating tslib modules, it is important to note a couple things with ++regard to handling of the ability for a user to request more than one ts event ++at a time. The first thing to note is that the lower layers may send up less ++events than the user requested, but only if that was a result of a pen release. ++Next, your module should send up just as many events as the user requested in ++nr. If your module is one that consumes events, such as variance, then you ++loop on the read from the lower layers, and only send the events up when ++1) you have the number of events requested by the user, or 2) one of the events ++from the lower layers was a pen release. ++ + + Module Parameters + ================= +--- tslib/src/ts_read_raw.c~multievent ++++ tslib/src/ts_read_raw.c +@@ -14,10 +14,10 @@ + * + * Read raw pressure, x, y, and timestamp from a touchscreen device. + */ ++ + #include "config.h" + + #include <stdio.h> +- + #include <stdlib.h> + #ifdef HAVE_UNISTD_H + #include <unistd.h> +@@ -25,79 +25,27 @@ + #include <sys/time.h> + #include <sys/types.h> + +-#ifdef USE_INPUT_API +-#include <linux/input.h> +-#else +-struct ts_event { /* Used in UCB1x00 style touchscreens (the default) */ +- unsigned short pressure; +- unsigned short x; +- unsigned short y; +- unsigned short pad; +- struct timeval stamp; +-}; +-struct h3600_ts_event { /* Used in the Compaq IPAQ */ +- unsigned short pressure; +- unsigned short x; +- unsigned short y; +- unsigned short pad; +-}; +-struct mk712_ts_event { /* Used in the Hitachi Webpad */ +- unsigned int header; +- unsigned int x; +- unsigned int y; +- unsigned int reserved; +-}; +-struct arctic2_ts_event { /* Used in the IBM Arctic II */ +- signed short pressure; +- signed int x; +- signed int y; +- int millisecs; +- int flags; +-}; +-struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */ +- long y; +- long x; +- long pressure; +- long long millisecs; +-}; +-struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */ +- short pressure; +- short x; +- short y; +- short millisecs; +-}; +-#endif /* USE_INPUT_API */ +- + #include "tslib-private.h" + +-int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr) +-{ + #ifdef USE_INPUT_API ++#include <linux/input.h> ++ ++static inline int get_input_event(struct tsdev *ts, struct ts_sample *samp) { + struct input_event ev; +-#else +- struct ts_event *evt; +- struct h3600_ts_event *hevt; +- struct mk712_ts_event *mevt; +- struct arctic2_ts_event *aevt; +- struct collie_ts_event *collie_evt; +- struct corgi_ts_event *corgi_evt; +-#endif /* USE_INPUT_API */ +- int ret; +- int total = 0; ++ struct timeval tv = {0, 0}; ++ fd_set fdset; ++ int ret = 0; + +- char *tseventtype=NULL; +- char *defaulttseventtype="UCB1x00"; ++ /* event vars */ ++ static int curr_x = 0, curr_y = 0; ++ int curr_p = 0, next_x = 0, next_y = 0; + +-#ifdef USE_INPUT_API +- /* warning: maybe those static vars should be part of the tsdev struct? */ +- static int curr_x = 0, curr_y = 0, curr_p = 0; +- static int got_curr_x = 0, got_curr_y = 0; +- int got_curr_p = 0; +- int next_x, next_y; ++ /* state variables */ ++ int got_curr_x = 0, got_curr_y = 0, got_curr_p = 0; + int got_next_x = 0, got_next_y = 0; + int got_tstamp = 0; + +- while (total < nr) { ++ while (1) { + ret = read(ts->fd, &ev, sizeof(struct input_event)); + if (ret < sizeof(struct input_event)) break; + +@@ -146,177 +94,231 @@ + samp->tv = ev.time; + } + +- if ( (!got_curr_x || !got_curr_y) && !got_curr_p && +- !got_next_x && !got_next_y ) { +- /* +- * The current event is not complete yet. +- * Give the kernel a chance to feed us more. +- */ +- struct timeval tv = {0, 0}; +- fd_set fdset; +- FD_ZERO(&fdset); +- FD_SET(ts->fd, &fdset); +- ret = select(ts->fd+1, &fdset, NULL, NULL, &tv); +- if (ret == 1) continue; +- if (ret == -1) break; ++ if (got_curr_x && got_curr_y && got_curr_p) { ++ /* we have a complete event */ ++ samp->x = curr_x; ++ samp->y = curr_y; ++ samp->pressure = curr_p; ++ ret = 0; /* indicate success */ ++ if (got_next_x) curr_x = next_x; ++ if (got_next_y) curr_y = next_y; ++ break; + } + +- /* We consider having a complete ts event */ +- samp->x = curr_x; +- samp->y = curr_y; +- samp->pressure = curr_p; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- samp++; +- total++; +- +- /* get ready for next event */ +- if (got_next_x) curr_x = next_x; else got_curr_x = 0; +- if (got_next_y) curr_y = next_y; else got_curr_y = 0; +- got_next_x = got_next_y = got_tstamp = 0; ++ /* ++ * The current event is not complete yet. ++ * Give the kernel a chance to feed us more. ++ */ ++ FD_ZERO(&fdset); ++ FD_SET(ts->fd, &fdset); ++ ret = select(ts->fd+1, &fdset, NULL, NULL, &tv); ++ if (ret == 1) continue; ++ if (ret == -1) break; + } + +- if (ret) ret = -1; +- if (total) ret = total; ++// fprintf(stdout, "%s: returning %d\n", __FUNCTION__, ret); ++ if (ret != 0) ret = -1; ++ return ret; ++} ++ + #else ++ ++struct ucb1x00_ts_event { /* Used in UCB1x00 style touchscreens (the default) */ ++ unsigned short pressure; ++ unsigned short x; ++ unsigned short y; ++ unsigned short pad; ++ struct timeval stamp; ++}; ++struct h3600_ts_event { /* Used in the Compaq IPAQ */ ++ unsigned short pressure; ++ unsigned short x; ++ unsigned short y; ++ unsigned short pad; ++}; ++struct mk712_ts_event { /* Used in the Hitachi Webpad */ ++ unsigned int header; ++ unsigned int x; ++ unsigned int y; ++ unsigned int reserved; ++}; ++struct arctic2_ts_event { /* Used in the IBM Arctic II */ ++ signed short pressure; ++ signed int x; ++ signed int y; ++ int millisecs; ++ int flags; ++}; ++struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */ ++ long y; ++ long x; ++ long pressure; ++ long long millisecs; ++}; ++struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */ ++ short pressure; ++ short x; ++ short y; ++ short millisecs; ++}; ++ ++static inline int get_ucb1x00_event(struct tsdev *ts, struct ts_sample *samp) { ++ struct ucb1x00_ts_event evt; ++ int ret = read(ts->fd, &evt, sizeof(struct ucb1x00_ts_event)); ++ if (ret > 0) { ++ samp->x = evt.x; ++ samp->y = evt.y; ++ samp->pressure = evt.pressure; ++ samp->tv.tv_usec = evt.stamp.tv_usec; ++ samp->tv.tv_sec = evt.stamp.tv_sec; ++ ret = 0; /* success */ ++ } ++ return ret; ++} ++ ++static inline int get_h3600_event(struct tsdev *ts, struct ts_sample *samp) { ++ struct h3600_ts_event evt; ++ int ret = read(ts->fd, &evt, sizeof(struct h3600_ts_event)); ++ if (ret > 0) { ++ samp->x = evt.x; ++ samp->y = evt.y; ++ samp->pressure = evt.pressure; ++ gettimeofday(&samp->tv, NULL); ++ ret = 0; /* success */ ++ } ++ return ret; ++} ++ ++static inline int get_mk712_event(struct tsdev *ts, struct ts_sample *samp) { ++ struct mk712_ts_event evt; ++ int ret = read(ts->fd, &evt, sizeof(struct mk712_ts_event)); ++ if (ret > 0) { ++ samp->x = (short)evt.x; ++ samp->y = (short)evt.y; ++ if(evt.header==0) ++ samp->pressure=1; ++ else ++ samp->pressure=0; ++ gettimeofday(&samp->tv, NULL); ++ ret = 0; /* success */ ++ } ++ return ret; ++} ++ ++static inline int get_arctic2_event(struct tsdev *ts, struct ts_sample *samp) { ++ struct arctic2_ts_event evt; ++ int ret = read(ts->fd, &evt, sizeof(struct arctic2_ts_event)); ++ if (ret > 0) { ++ samp->x = (short)evt.x; ++ samp->y = (short)evt.y; ++ samp->pressure = evt.pressure; ++ gettimeofday(&samp->tv, NULL); ++ ret = 0; /* success */ ++ } ++ return ret; ++} ++ ++static inline int get_collie_event(struct tsdev *ts, struct ts_sample *samp) { ++ struct collie_ts_event evt; ++ int ret = read(ts->fd, &evt, sizeof(struct collie_ts_event)); ++ if (ret > 0) { ++ samp->x = evt.x; ++ samp->y = evt.y; ++ samp->pressure = evt.pressure; ++ samp->tv.tv_usec = evt.millisecs % 1000; ++ samp->tv.tv_sec = evt.millisecs / 1000; ++ ret = 0; /* success */ ++ } ++ return ret; ++} ++ ++static inline int get_corgi_event(struct tsdev *ts, struct ts_sample *samp) { ++ struct corgi_ts_event evt; ++ int ret = read(ts->fd, &evt, sizeof(struct corgi_ts_event)); ++ if (ret > 0) { ++ samp->x = evt.x; ++ samp->y = evt.y; ++ samp->pressure = evt.pressure; ++ samp->tv.tv_usec = evt.millisecs % 1000; ++ samp->tv.tv_sec = evt.millisecs / 1000; ++ ret = 0; /* success */ ++ } ++ return ret; ++} ++ ++#endif ++ ++int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr) ++{ ++ int ret; ++ int total = 0; ++ int pen_down = 1; ++ static short x_save = 0, y_save = 0; ++ static int pthres = -1; ++ ++#ifndef USE_INPUT_API ++ char *tseventtype=NULL; ++ char *defaulttseventtype="UCB1x00"; + tseventtype = getenv("TSLIB_TSEVENTTYPE"); + if(tseventtype==NULL) tseventtype=defaulttseventtype; ++#endif + +- if( strcmp(tseventtype,"H3600") == 0) { /* iPAQ style h3600 touchscreen events */ +- hevt = alloca(sizeof(*hevt) * nr); +- ret = read(ts->fd, hevt, sizeof(*hevt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*hevt); +- while(ret >= sizeof(*hevt)) { +- samp->x = hevt->x; +- samp->y = hevt->y; +- samp->pressure = hevt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- gettimeofday(&samp->tv,NULL); +- samp++; +- hevt++; +- ret -= sizeof(*hevt); +- } +- } else { +- return -1; +- } +- } else if( strcmp(tseventtype,"MK712") == 0) { /* Hitachi Webpad events */ +- mevt = alloca(sizeof(*mevt) * nr); +- ret = read(ts->fd, mevt, sizeof(*mevt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*mevt); +- while(ret >= sizeof(*mevt)) { +- samp->x = (short)mevt->x; +- samp->y = (short)mevt->y; +- if(mevt->header==0) +- samp->pressure=1; +- else +- samp->pressure=0; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- gettimeofday(&samp->tv,NULL); +- samp++; +- mevt++; +- ret -= sizeof(*mevt); +- } +- } else { +- return -1; +- } +- +- } else if( strcmp(tseventtype,"ARCTIC2") == 0) { /* IBM Arctic II events */ +- aevt = alloca(sizeof(*aevt) * nr); +- ret = read(ts->fd, aevt, sizeof(*aevt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*aevt); +- while(ret >= sizeof(*aevt)) { +- samp->x = (short)aevt->x; +- samp->y = (short)aevt->y; +- samp->pressure = aevt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- gettimeofday(&samp->tv,NULL); +- samp++; +- aevt++; +- ret -= sizeof(*aevt); +- } ++ while ((total < nr) && pen_down) { ++// fprintf(stdout, "total: %d, nr: %d\n", total, nr); ++#ifdef USE_INPUT_API ++ ret = get_input_event(ts, samp); ++#else ++ if (strcmp(tseventtype, "H3600") == 0) { ++ /* iPAQ style h3600 touchscreen events */ ++ ret = get_h3600_event(ts, samp); ++ } else if (strcmp(tseventtype, "MK712") == 0) { ++ /* Hitachi Webpad events */ ++ ret = get_mk712_event(ts, samp); ++ } else if (strcmp(tseventtype, "ARCTIC2") == 0) { ++ /* IBM Arctic II events */ ++ ret = get_arctic2_event(ts, samp); ++ } else if (strcmp(tseventtype, "COLLIE") == 0) { ++ /* Sharp Zaurus SL-5000d/5500 events */ ++ ret = get_collie_event(ts, samp); ++ } else if (strcmp(tseventtype,"CORGI") == 0) { ++ /* Sharp Zaurus SL-C700 events */ ++ ret = get_corgi_event(ts, samp); + } else { +- return -1; ++ /* Use normal UCB1x00 type events */ ++ ret = get_ucb1x00_event(ts, samp); + } ++#endif ++ if (ret != 0) break; + +- } else if( strcmp(tseventtype,"COLLIE") == 0) { /* Sharp Zaurus SL-5000d/5500 events */ +- collie_evt = alloca(sizeof(*collie_evt) * nr); +- ret = read(ts->fd, collie_evt, sizeof(*collie_evt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*collie_evt); +- while(ret >= sizeof(*collie_evt)) { +- samp->x = collie_evt->x; +- samp->y = collie_evt->y; +- samp->pressure = collie_evt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- samp->tv.tv_usec = collie_evt->millisecs % 1000; +- samp->tv.tv_sec = collie_evt->millisecs / 1000; +- samp++; +- collie_evt++; +- ret -= sizeof(*collie_evt); ++ if (pthres == -1) { ++ char *pthresvar = getenv("TSLIB_PTHRES"); ++ pthres = 100; ++ if (pthresvar != NULL) { ++ int p = strtol(pthresvar, (char **)NULL, 10); ++ if (p != -1) pthres = p; + } +- } else { +- return -1; + } + +- } else if( strcmp(tseventtype,"CORGI") == 0) { /* Sharp Zaurus SL-C700 events */ +- corgi_evt = alloca(sizeof(*corgi_evt) * nr); +- ret = read(ts->fd, corgi_evt, sizeof(*corgi_evt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*corgi_evt); +- while(ret >= sizeof(*corgi_evt)) { +- samp->x = corgi_evt->x; +- samp->y = corgi_evt->y; +- samp->pressure = corgi_evt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- samp->tv.tv_usec = corgi_evt->millisecs % 1000; +- samp->tv.tv_sec = corgi_evt->millisecs / 1000; +- samp++; +- corgi_evt++; +- ret -= sizeof(*corgi_evt); +- } ++ if (samp->pressure < pthres) { ++ /* pen released, send events up */ ++ pen_down = 0; ++ /* set x and y to previous values */ ++ samp->x = x_save; ++ samp->y = y_save; + } else { +- return -1; ++ pen_down = 1; ++ x_save = samp->x; ++ y_save = samp->y; + } +- +- } else { /* Use normal UCB1x00 type events */ +- evt = alloca(sizeof(*evt) * nr); +- ret = read(ts->fd, evt, sizeof(*evt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*evt); +- while(ret >= sizeof(*evt)) { +- samp->x = evt->x; +- samp->y = evt->y; +- samp->pressure = evt->pressure; + #ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); ++ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x, samp->y, samp->pressure); + #endif /*DEBUG*/ +- samp->tv.tv_usec = evt->stamp.tv_usec; +- samp->tv.tv_sec = evt->stamp.tv_sec; +- samp++; +- evt++; +- ret -= sizeof(*evt); +- } +- } else { +- return -1; +- } ++ samp++; ++ total++; + } +- ret = nr; +-#endif /* USE_INPUT_API */ + ++ if (ret != 0) ret = -1; ++ if (total) ret = total; + return ret; + } + diff --git a/tslib/tslib/pointercal.patch b/tslib/tslib/pointercal.patch index e69de29bb2..02c056ce2e 100644 --- a/tslib/tslib/pointercal.patch +++ b/tslib/tslib/pointercal.patch @@ -0,0 +1,13 @@ +--- tslib/tests/ts_calibrate.c~pointercal ++++ tslib/tests/ts_calibrate.c +@@ -303,8 +303,8 @@ + } else { + cal_fd = open("/etc/pointercal",O_CREAT|O_RDWR); + } +- sprintf(cal_buffer,"%d %d %d %d %d %d %d",cal.a[1],cal.a[2],cal.a[0],cal.a[4],cal.a[5],cal.a[3],cal.a[6]); +- write(cal_fd,cal_buffer,strlen(cal_buffer)+1); ++ sprintf(cal_buffer,"%d %d %d %d %d %d %d\n",cal.a[1],cal.a[2],cal.a[0],cal.a[4],cal.a[5],cal.a[3],cal.a[6]); ++ write(cal_fd,cal_buffer,strlen(cal_buffer)); + close(cal_fd); + } else { + printf("Calibration failed.\n"); diff --git a/tslib/tslib/poodle/tslib.sh b/tslib/tslib/poodle/tslib.sh index e69de29bb2..187b7ce6d2 100644 --- a/tslib/tslib/poodle/tslib.sh +++ b/tslib/tslib/poodle/tslib.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +if (uname -r|grep -q 'embedix'); then + TSLIB_TSDEVICE=/dev/ts + TSLIB_TSEVENTTYPE=COLLIE +else + TSLIB_TSDEVICE=/dev/input/event0 +fi + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/raw-hwread.patch b/tslib/tslib/raw-hwread.patch index e69de29bb2..fff8045f13 100644 --- a/tslib/tslib/raw-hwread.patch +++ b/tslib/tslib/raw-hwread.patch @@ -0,0 +1,706 @@ + +# +# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher +# + +--- tslib/plugins/Makefile.am~raw-hwread ++++ tslib/plugins/Makefile.am +@@ -19,9 +19,10 @@ + LIBS = + plugindir = $(PLUGIN_DIR) + +-EXTRA_LTLIBRARIES = variance.la dejitter.la linear.la pthres.la ++EXTRA_LTLIBRARIES = variance.la dejitter.la linear.la pthres.la corgi.la collie.la ucb1x00.la h3600.la mk712.la arctic2.la + plugin_LTLIBRARIES = $(PLUGINS) + ++# filters + variance_la_SOURCES = variance.c + variance_la_LDFLAGS = -module $(LTVSN) + +@@ -33,3 +34,22 @@ + + pthres_la_SOURCES = pthres.c + pthres_la_LDFLAGS = -module $(LTVSN) ++ ++# hw access ++corgi_la_SOURCES = corgi-raw.c ++corgi_la_LDFLAGS = -module $(LTVSN) ++ ++collie_la_SOURCES = collie-raw.c ++collie_la_LDFLAGS = -module $(LTVSN) ++ ++ucb1x00_la_SOURCES = ucb1x00-raw.c ++ucb1x00_la_LDFLAGS = -module $(LTVSN) ++ ++h3600_la_SOURCES = h3600-raw.c ++h3600_la_LDFLAGS = -module $(LTVSN) ++ ++mk712_la_SOURCES = mk712-raw.c ++mk712_la_LDFLAGS = -module $(LTVSN) ++ ++arctic2_la_SOURCES = arctic2-raw.c ++arctic2_la_LDFLAGS = -module $(LTVSN) +--- /dev/null ++++ tslib/plugins/corgi-raw.c +@@ -0,0 +1,60 @@ ++#include <stdlib.h> ++#include <stdio.h> ++#include <unistd.h> ++ ++#include "config.h" ++#include "tslib-private.h" ++ ++struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */ ++ short pressure; ++ short x; ++ short y; ++ short millisecs; ++}; ++ ++static int corgi_read(struct tslib_module_info *inf, struct ts_sample *samp, int nr) ++{ ++ struct tsdev *ts = inf->dev; ++ struct corgi_ts_event *corgi_evt; ++ int ret; ++ int total = 0; ++ corgi_evt = alloca(sizeof(*corgi_evt) * nr); ++ ret = read(ts->fd, corgi_evt, sizeof(*corgi_evt) * nr); ++ if(ret > 0) { ++ int nr = ret / sizeof(*corgi_evt); ++ while(ret >= sizeof(*corgi_evt)) { ++ samp->x = corgi_evt->x; ++ samp->y = corgi_evt->y; ++ samp->pressure = corgi_evt->pressure; ++#ifdef DEBUG ++ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); ++#endif /*DEBUG*/ ++ samp->tv.tv_usec = corgi_evt->millisecs % 1000; ++ samp->tv.tv_sec = corgi_evt->millisecs / 1000; ++ samp++; ++ corgi_evt++; ++ ret -= sizeof(*corgi_evt); ++ } ++ } else { ++ return -1; ++ } ++ ret = nr; ++ return ret; ++} ++ ++static const struct tslib_ops corgi_ops = ++{ ++ read: corgi_read, ++}; ++ ++struct tslib_module_info *mod_init(struct tsdev *dev, const char *params) ++{ ++ struct tslib_module_info *m; ++ ++ m = malloc(sizeof(struct tslib_module_info)); ++ if (m == NULL) ++ return NULL; ++ ++ m->ops = &corgi_ops; ++ return m; ++} +--- tslib/src/ts_read_raw_module.c~raw-hwread ++++ tslib/src/ts_read_raw_module.c +@@ -28,44 +28,6 @@ + #ifdef USE_INPUT_API + #include <linux/input.h> + #else +-struct ts_event { /* Used in UCB1x00 style touchscreens (the default) */ +- unsigned short pressure; +- unsigned short x; +- unsigned short y; +- unsigned short pad; +- struct timeval stamp; +-}; +-struct h3600_ts_event { /* Used in the Compaq IPAQ */ +- unsigned short pressure; +- unsigned short x; +- unsigned short y; +- unsigned short pad; +-}; +-struct mk712_ts_event { /* Used in the Hitachi Webpad */ +- unsigned int header; +- unsigned int x; +- unsigned int y; +- unsigned int reserved; +-}; +-struct arctic2_ts_event { /* Used in the IBM Arctic II */ +- signed short pressure; +- signed int x; +- signed int y; +- int millisecs; +- int flags; +-}; +-struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */ +- long y; +- long x; +- long pressure; +- long long millisecs; +-}; +-struct corgi_ts_event { /* Used in the Sharp Zaurus SL-C700 */ +- short pressure; +- short x; +- short y; +- short millisecs; +-}; + #endif /* USE_INPUT_API */ + + #include "tslib-private.h" +@@ -75,17 +37,8 @@ + struct tsdev *ts = inf->dev; + #ifdef USE_INPUT_API + struct input_event ev; +-#else +- struct ts_event *evt; +- struct h3600_ts_event *hevt; +- struct mk712_ts_event *mevt; +- struct arctic2_ts_event *aevt; +- struct collie_ts_event *collie_evt; +- struct corgi_ts_event *corgi_evt; +- char *tseventtype=NULL; +- char *defaulttseventtype="UCB1x00"; + #endif /* USE_INPUT_API */ +- int ret; ++ int ret = nr; + int total = 0; + + #ifdef USE_INPUT_API +@@ -220,143 +173,6 @@ + if (ret) ret = -1; + if (total) ret = total; + #endif +- +-#else +- tseventtype = getenv("TSLIB_TSEVENTTYPE"); +- if(tseventtype==NULL) tseventtype=defaulttseventtype; +- +- if( strcmp(tseventtype,"H3600") == 0) { /* iPAQ style h3600 touchscreen events */ +- hevt = alloca(sizeof(*hevt) * nr); +- ret = read(ts->fd, hevt, sizeof(*hevt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*hevt); +- while(ret >= sizeof(*hevt)) { +- samp->x = hevt->x; +- samp->y = hevt->y; +- samp->pressure = hevt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- gettimeofday(&samp->tv,NULL); +- samp++; +- hevt++; +- ret -= sizeof(*hevt); +- } +- } else { +- return -1; +- } +- } else if( strcmp(tseventtype,"MK712") == 0) { /* Hitachi Webpad events */ +- mevt = alloca(sizeof(*mevt) * nr); +- ret = read(ts->fd, mevt, sizeof(*mevt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*mevt); +- while(ret >= sizeof(*mevt)) { +- samp->x = (short)mevt->x; +- samp->y = (short)mevt->y; +- if(mevt->header==0) +- samp->pressure=1; +- else +- samp->pressure=0; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- gettimeofday(&samp->tv,NULL); +- samp++; +- mevt++; +- ret -= sizeof(*mevt); +- } +- } else { +- return -1; +- } +- +- } else if( strcmp(tseventtype,"ARCTIC2") == 0) { /* IBM Arctic II events */ +- aevt = alloca(sizeof(*aevt) * nr); +- ret = read(ts->fd, aevt, sizeof(*aevt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*aevt); +- while(ret >= sizeof(*aevt)) { +- samp->x = (short)aevt->x; +- samp->y = (short)aevt->y; +- samp->pressure = aevt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- gettimeofday(&samp->tv,NULL); +- samp++; +- aevt++; +- ret -= sizeof(*aevt); +- } +- } else { +- return -1; +- } +- +- } else if( strcmp(tseventtype,"COLLIE") == 0) { /* Sharp Zaurus SL-5000d/5500 events */ +- collie_evt = alloca(sizeof(*collie_evt) * nr); +- ret = read(ts->fd, collie_evt, sizeof(*collie_evt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*collie_evt); +- while(ret >= sizeof(*collie_evt)) { +- samp->x = collie_evt->x; +- samp->y = collie_evt->y; +- samp->pressure = collie_evt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- samp->tv.tv_usec = collie_evt->millisecs % 1000; +- samp->tv.tv_sec = collie_evt->millisecs / 1000; +- samp++; +- collie_evt++; +- ret -= sizeof(*collie_evt); +- } +- } else { +- return -1; +- } +- +- } else if( strcmp(tseventtype,"CORGI") == 0) { /* Sharp Zaurus SL-C700 events */ +- corgi_evt = alloca(sizeof(*corgi_evt) * nr); +- ret = read(ts->fd, corgi_evt, sizeof(*corgi_evt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*corgi_evt); +- while(ret >= sizeof(*corgi_evt)) { +- samp->x = corgi_evt->x; +- samp->y = corgi_evt->y; +- samp->pressure = corgi_evt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- samp->tv.tv_usec = corgi_evt->millisecs % 1000; +- samp->tv.tv_sec = corgi_evt->millisecs / 1000; +- samp++; +- corgi_evt++; +- ret -= sizeof(*corgi_evt); +- } +- } else { +- return -1; +- } +- +- } else { /* Use normal UCB1x00 type events */ +- evt = alloca(sizeof(*evt) * nr); +- ret = read(ts->fd, evt, sizeof(*evt) * nr); +- if(ret > 0) { +- int nr = ret / sizeof(*evt); +- while(ret >= sizeof(*evt)) { +- samp->x = evt->x; +- samp->y = evt->y; +- samp->pressure = evt->pressure; +-#ifdef DEBUG +- fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); +-#endif /*DEBUG*/ +- samp->tv.tv_usec = evt->stamp.tv_usec; +- samp->tv.tv_sec = evt->stamp.tv_sec; +- samp++; +- evt++; +- ret -= sizeof(*evt); +- } +- } else { +- return -1; +- } +- } +- ret = nr; + #endif /* USE_INPUT_API */ + + return ret; +--- /dev/null ++++ tslib/plugins/collie-raw.c +@@ -0,0 +1,61 @@ ++#include <stdlib.h> ++#include <stdio.h> ++#include <unistd.h> ++ ++#include "config.h" ++#include "tslib-private.h" ++ ++struct collie_ts_event { /* Used in the Sharp Zaurus SL-5000d and SL-5500 */ ++ long y; ++ long x; ++ long pressure; ++ long long millisecs; ++}; ++ ++static int collie_read(struct tslib_module_info *inf, struct ts_sample *samp, int nr) ++{ ++ struct tsdev *ts = inf->dev; ++ struct collie_ts_event *collie_evt; ++ int ret; ++ int total = 0; ++ collie_evt = alloca(sizeof(*collie_evt) * nr); ++ ret = read(ts->fd, collie_evt, sizeof(*collie_evt) * nr); ++ if(ret > 0) { ++ int nr = ret / sizeof(*collie_evt); ++ while(ret >= sizeof(*collie_evt)) { ++ samp->x = collie_evt->x; ++ samp->y = collie_evt->y; ++ samp->pressure = collie_evt->pressure; ++#ifdef DEBUG ++ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); ++#endif /*DEBUG*/ ++ samp->tv.tv_usec = collie_evt->millisecs % 1000; ++ samp->tv.tv_sec = collie_evt->millisecs / 1000; ++ samp++; ++ collie_evt++; ++ ret -= sizeof(*collie_evt); ++ } ++ } else { ++ return -1; ++ } ++ ++ ret = nr; ++ return ret; ++} ++ ++static const struct tslib_ops collie_ops = ++{ ++ read: collie_read, ++}; ++ ++struct tslib_module_info *mod_init(struct tsdev *dev, const char *params) ++{ ++ struct tslib_module_info *m; ++ ++ m = malloc(sizeof(struct tslib_module_info)); ++ if (m == NULL) ++ return NULL; ++ ++ m->ops = &collie_ops; ++ return m; ++} +--- tslib/configure.in~raw-hwread ++++ tslib/configure.in +@@ -4,15 +4,30 @@ + AM_INIT_AUTOMAKE(libts,0.0.1) + AM_CONFIG_HEADER(config.h) + ++# filters + AC_ARG_ENABLE(linear, [ --enable-linear Enable building of linear scaling [default=yes]], + [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS linear.la", PLUGINS="$PLUGINS linear.la") + AC_ARG_ENABLE(dejitter, [ --enable-dejitter Enable building of dejitter filter [default=yes]], + [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS dejitter.la", PLUGINS="$PLUGINS dejitter.la") + AC_ARG_ENABLE(variance, [ --enable-variance Enable building of variance filter [default=yes]], + [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS variance.la", PLUGINS="$PLUGINS variance.la") +-AC_ARG_ENABLE(pthres, [ --enable-pthres Enable building of pthres filter [default=yes]], ++AC_ARG_ENABLE(pthres, [ --enable-pthres Enable building of pthres filter [default=yes]], + [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS pthres.la", PLUGINS="$PLUGINS pthres.la") + ++# hardware access modules ++AC_ARG_ENABLE(ucb1x00, [ --enable-ucb1x00 Enable building of ucb1x00 raw module (UCB1x00 support) [default=yes]], ++ [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS ucb1x00.la", PLUGINS="$PLUGINS ucb1x00.la") ++AC_ARG_ENABLE(corgi, [ --enable-corgi Enable building of corgi raw module (Sharp Zaurus sl-c7x0 support) [default=yes]], ++ [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS corgi.la", PLUGINS="$PLUGINS corgi.la") ++AC_ARG_ENABLE(collie, [ --enable-collie Enable building of collie raw module (Sharp Zaurus sl-5500/5000d support) [default=yes]], ++ [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS collie.la", PLUGINS="$PLUGINS collie.la") ++AC_ARG_ENABLE(h3600, [ --enable-h3600 Enable building of h3600 raw module (HP iPaq H3600 support) [default=yes]], ++ [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS h3600.la", PLUGINS="$PLUGINS h3600.la") ++AC_ARG_ENABLE(mk712, [ --enable-mk712 Enable building of mk712 raw module (Hitachi Webpad support) [default=yes]], ++ [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS mk712.la", PLUGINS="$PLUGINS mk712.la") ++AC_ARG_ENABLE(arctic2, [ --enable-arctic2 Enable building of arctic2 raw module (IBM Arctic II support) [default=yes]], ++ [ "x$enableval" = "xyes" ] && PLUGINS="$PLUGINS arctic2.la", PLUGINS="$PLUGINS arctic2.la") ++ + AC_MSG_CHECKING(--enable-debug argument) + AC_ARG_ENABLE(debug, [ --enable-debug Enable debug messages from filters [default=no]], + , [enable_debug="no"]) +--- /dev/null ++++ tslib/plugins/h3600-raw.c +@@ -0,0 +1,60 @@ ++#include <stdlib.h> ++#include <stdio.h> ++#include <unistd.h> ++ ++#include "config.h" ++#include "tslib-private.h" ++ ++struct h3600_ts_event { /* Used in the Compaq IPAQ */ ++ unsigned short pressure; ++ unsigned short x; ++ unsigned short y; ++ unsigned short pad; ++}; ++ ++static int h3600_read(struct tslib_module_info *inf, struct ts_sample *samp, int nr) ++{ ++ struct tsdev *ts = inf->dev; ++ struct h3600_ts_event *h3600_evt; ++ int ret; ++ int total = 0; ++ h3600_evt = alloca(sizeof(*h3600_evt) * nr); ++ ret = read(ts->fd, h3600_evt, sizeof(*h3600_evt) * nr); ++ if(ret > 0) { ++ int nr = ret / sizeof(*h3600_evt); ++ while(ret >= sizeof(*h3600_evt)) { ++ samp->x = h3600_evt->x; ++ samp->y = h3600_evt->y; ++ samp->pressure = h3600_evt->pressure; ++#ifdef DEBUG ++ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); ++#endif /*DEBUG*/ ++ gettimeofday(&samp->tv,NULL); ++ samp++; ++ h3600_evt++; ++ ret -= sizeof(*h3600_evt); ++ } ++ } else { ++ return -1; ++ } ++ ++ ret = nr; ++ return ret; ++} ++ ++static const struct tslib_ops h3600_ops = ++{ ++ read: h3600_read, ++}; ++ ++struct tslib_module_info *mod_init(struct tsdev *dev, const char *params) ++{ ++ struct tslib_module_info *m; ++ ++ m = malloc(sizeof(struct tslib_module_info)); ++ if (m == NULL) ++ return NULL; ++ ++ m->ops = &h3600_ops; ++ return m; ++} +--- tslib/etc/ts.conf~raw-hwread ++++ tslib/etc/ts.conf +@@ -1,3 +1,21 @@ ++# Uncomment collie if you're using a Sharp Zaurus SL-5500/SL-5000d ++# module_raw collie ++ ++# Uncomment corgi if you're using a Sharp Zaurus SL-C700/C750/C760/C860 ++# module_raw corgi ++ ++# Uncomment ucb1x00 if you're using a device with a UCB1200/1300/1400 TS interface ++# module_raw ucb1x00 ++ ++# Uncomment h3600 if you're using an HP iPaq h3600 or similar ++# module_raw h3600 ++ ++# Uncomment mk712 if you're using a Hitachi Webpad ++# module_raw mk712 ++ ++# Uncomment arctic2 if you're using an IBM Arctic II ++# module_raw arctic2 ++ + module pthres pmin=1 + module variance delta=30 + module dejitter delta=100 +--- /dev/null ++++ tslib/plugins/mk712-raw.c +@@ -0,0 +1,63 @@ ++#include <stdlib.h> ++#include <stdio.h> ++#include <unistd.h> ++ ++#include "config.h" ++#include "tslib-private.h" ++ ++struct mk712_ts_event { /* Used in the Hitachi Webpad */ ++ unsigned int header; ++ unsigned int x; ++ unsigned int y; ++ unsigned int reserved; ++}; ++ ++static int mk712_read(struct tslib_module_info *inf, struct ts_sample *samp, int nr) ++{ ++ struct tsdev *ts = inf->dev; ++ struct mk712_ts_event *mk712_evt; ++ int ret; ++ int total = 0; ++ mk712_evt = alloca(sizeof(*mk712_evt) * nr); ++ ret = read(ts->fd, mk712_evt, sizeof(*mk712_evt) * nr); ++ if(ret > 0) { ++ int nr = ret / sizeof(*mk712_evt); ++ while(ret >= sizeof(*mk712_evt)) { ++ samp->x = (short)mk712_evt->x; ++ samp->y = (short)mk712_evt->y; ++ if(mk712_evt->header==0) ++ samp->pressure=1; ++ else ++ samp->pressure=0; ++#ifdef DEBUG ++ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); ++#endif /*DEBUG*/ ++ gettimeofday(&samp->tv,NULL); ++ samp++; ++ mk712_evt++; ++ ret -= sizeof(*mk712_evt); ++ } ++ } else { ++ return -1; ++ } ++ ++ ret = nr; ++ return ret; ++} ++ ++static const struct tslib_ops mk712_ops = ++{ ++ read: mk712_read, ++}; ++ ++struct tslib_module_info *mod_init(struct tsdev *dev, const char *params) ++{ ++ struct tslib_module_info *m; ++ ++ m = malloc(sizeof(struct tslib_module_info)); ++ if (m == NULL) ++ return NULL; ++ ++ m->ops = &mk712_ops; ++ return m; ++} +--- /dev/null ++++ tslib/plugins/arctic2-raw.c +@@ -0,0 +1,61 @@ ++#include <stdlib.h> ++#include <stdio.h> ++#include <unistd.h> ++ ++#include "config.h" ++#include "tslib-private.h" ++ ++struct arctic2_ts_event { /* Used in the IBM Arctic II */ ++ signed short pressure; ++ signed int x; ++ signed int y; ++ int millisecs; ++ int flags; ++}; ++ ++static int arctic2_read(struct tslib_module_info *inf, struct ts_sample *samp, int nr) ++{ ++ struct tsdev *ts = inf->dev; ++ struct arctic2_ts_event *arctic2_evt; ++ int ret; ++ int total = 0; ++ arctic2_evt = alloca(sizeof(*arctic2_evt) * nr); ++ ret = read(ts->fd, arctic2_evt, sizeof(*arctic2_evt) * nr); ++ if(ret > 0) { ++ int nr = ret / sizeof(*arctic2_evt); ++ while(ret >= sizeof(*arctic2_evt)) { ++ samp->x = (short)arctic2_evt->x; ++ samp->y = (short)arctic2_evt->y; ++ samp->pressure = arctic2_evt->pressure; ++#ifdef DEBUG ++ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); ++#endif /*DEBUG*/ ++ gettimeofday(&samp->tv,NULL); ++ samp++; ++ arctic2_evt++; ++ ret -= sizeof(*arctic2_evt); ++ } ++ } else { ++ return -1; ++ } ++ ++ ret = nr; ++ return ret; ++} ++ ++static const struct tslib_ops arctic2_ops = ++{ ++ read: arctic2_read, ++}; ++ ++struct tslib_module_info *mod_init(struct tsdev *dev, const char *params) ++{ ++ struct tslib_module_info *m; ++ ++ m = malloc(sizeof(struct tslib_module_info)); ++ if (m == NULL) ++ return NULL; ++ ++ m->ops = &arctic2_ops; ++ return m; ++} +--- tslib/README~raw-hwread ++++ tslib/README +@@ -40,8 +40,6 @@ + Environment Variables + ===================== + +-TSLIB_TSEVENTTYPE Event type for non input api raw reads. +- Default: UCB1x00 + TSLIB_TSDEVICE TS device file name. + Default (non inputapi): /dev/touchscreen/ucb1x00 + Default (inputapi): /dev/input/event0 +--- /dev/null ++++ tslib/plugins/ucb1x00-raw.c +@@ -0,0 +1,62 @@ ++#include <stdlib.h> ++#include <stdio.h> ++#include <unistd.h> ++ ++#include "config.h" ++#include "tslib-private.h" ++ ++struct ucb1x00_ts_event { /* Used in UCB1x00 style touchscreens */ ++ unsigned short pressure; ++ unsigned short x; ++ unsigned short y; ++ unsigned short pad; ++ struct timeval stamp; ++}; ++ ++static int ucb1x00_read(struct tslib_module_info *inf, struct ts_sample *samp, int nr) ++{ ++ struct tsdev *ts = inf->dev; ++ struct ucb1x00_ts_event *ucb1x00_evt; ++ int ret; ++ int total = 0; ++ ucb1x00_evt = alloca(sizeof(*ucb1x00_evt) * nr); ++ ret = read(ts->fd, ucb1x00_evt, sizeof(*ucb1x00_evt) * nr); ++ if(ret > 0) { ++ int nr = ret / sizeof(*ucb1x00_evt); ++ while(ret >= sizeof(*ucb1x00_evt)) { ++ samp->x = ucb1x00_evt->x; ++ samp->y = ucb1x00_evt->y; ++ samp->pressure = ucb1x00_evt->pressure; ++#ifdef DEBUG ++ fprintf(stderr,"RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure); ++#endif /*DEBUG*/ ++ samp->tv.tv_usec = ucb1x00_evt->stamp.tv_usec; ++ samp->tv.tv_sec = ucb1x00_evt->stamp.tv_sec; ++ samp++; ++ ucb1x00_evt++; ++ ret -= sizeof(*ucb1x00_evt); ++ } ++ } else { ++ return -1; ++ } ++ ++ ret = nr; ++ return ret; ++} ++ ++static const struct tslib_ops ucb1x00_ops = ++{ ++ read: ucb1x00_read, ++}; ++ ++struct tslib_module_info *mod_init(struct tsdev *dev, const char *params) ++{ ++ struct tslib_module_info *m; ++ ++ m = malloc(sizeof(struct tslib_module_info)); ++ if (m == NULL) ++ return NULL; ++ ++ m->ops = &ucb1x00_ops; ++ return m; ++} diff --git a/tslib/tslib/shepherd/tslib.sh b/tslib/tslib/shepherd/tslib.sh index e69de29bb2..417ccd06ba 100644 --- a/tslib/tslib/shepherd/tslib.sh +++ b/tslib/tslib/shepherd/tslib.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TSLIB_TSDEVICE=/dev/ts +TSLIB_TSEVENTTYPE=CORGI + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/tosa/tslib.sh b/tslib/tslib/tosa/tslib.sh index e69de29bb2..417ccd06ba 100644 --- a/tslib/tslib/tosa/tslib.sh +++ b/tslib/tslib/tosa/tslib.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TSLIB_TSDEVICE=/dev/ts +TSLIB_TSEVENTTYPE=CORGI + +export TSLIB_TSDEVICE TSLIB_TSEVENTTYPE diff --git a/tslib/tslib/ts_calibrate.patch b/tslib/tslib/ts_calibrate.patch index e69de29bb2..c5f8264b9e 100644 --- a/tslib/tslib/ts_calibrate.patch +++ b/tslib/tslib/ts_calibrate.patch @@ -0,0 +1,23 @@ +--- libts-0.0/tests/ts_calibrate.c.orig 2003-03-12 16:23:56.000000000 +0000 ++++ libts-0.0/tests/ts_calibrate.c 2003-03-12 16:24:12.000000000 +0000 +@@ -231,11 +231,6 @@ + close_framebuffer(); + exit(1); + } +- close_framebuffer(); +- if (open_framebuffer()) { +- close_framebuffer(); +- exit(1); +- } + + setcolors(0x48ff48,0x880000); + +@@ -245,7 +240,7 @@ + printf("xres = %d, yres = %d\n",xres,yres); + + // Read a touchscreen event to clear the buffer +- //getxy(ts, 0, 0); ++ getxy(ts, 0, 0); + + // Now paint a crosshair on the upper left and start taking calibration + // data |