summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-05-09 17:46:02 +0000
committerMike Frysinger <vapier@gentoo.org>2009-05-09 17:46:02 +0000
commitd081f7093c0673a13f014854c002548fd408b085 (patch)
tree528a6538a38993507ba4bad9faf6bd002cc64f36 /src/patchsets/tslib
parentCorrect link to bugtraq as noted by pacmac on IRC. (diff)
downloadgentoo-d081f7093c0673a13f014854c002548fd408b085.tar.gz
gentoo-d081f7093c0673a13f014854c002548fd408b085.tar.bz2
gentoo-d081f7093c0673a13f014854c002548fd408b085.zip
move tslib patch tarball to cvs
Diffstat (limited to 'src/patchsets/tslib')
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-UnknownEventType0.patch13
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-absbit.patch11
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-correct-libversion.patch28
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-devfs.patch18
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-event1.patch80
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-finddev-inputattach.patch718
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-bzero.patch11
-rw-r--r--src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-return-on-error-from-check-df.patch11
-rw-r--r--src/patchsets/tslib/1.0/10_all_tslib-1.0-open-mode.patch16
-rw-r--r--src/patchsets/tslib/1.0/15_all_tslib-1.0-configure-linear-h2200.patch13
-rw-r--r--src/patchsets/tslib/1.0/README.history11
-rw-r--r--src/patchsets/tslib/make-tarball.sh35
12 files changed, 965 insertions, 0 deletions
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-UnknownEventType0.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-UnknownEventType0.patch
new file mode 100644
index 0000000000..f2b4db1b6d
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-UnknownEventType0.patch
@@ -0,0 +1,13 @@
+# Patch taken from Tuxxx
+--- plugins/input-raw.c 2006-08-24 23:02:54.000000000 +0200
++++ plugins/input-raw.c.new 2008-09-12 18:43:07.000000000 +0200
+@@ -62,8 +62,7 @@
+ return -1;
+ }
+
+- if (bit & (1 << EV_SYN))
+- i->using_syn = 1;
++ i->using_syn = 1;
+
+ return 0;
+ }
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-absbit.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-absbit.patch
new file mode 100644
index 0000000000..11e758d1de
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-absbit.patch
@@ -0,0 +1,11 @@
+--- a/plugins/input-raw.c 2008-02-28 14:25:33.000000000 -0500
++++ b/plugins/input-raw.c 2008-02-28 14:27:25.000000000 -0500
+@@ -49,7 +49,7 @@ static int check_fd(struct tslib_input *
+ struct tsdev *ts = i->module.dev;
+ int version;
+ u_int32_t bit;
+- u_int64_t absbit;
++ u_int32_t absbit;
+
+ if (! ((ioctl(ts->fd, EVIOCGVERSION, &version) >= 0) &&
+ (version == EV_VERSION) &&
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-correct-libversion.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-correct-libversion.patch
new file mode 100644
index 0000000000..09adb2863c
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-correct-libversion.patch
@@ -0,0 +1,28 @@
+--- configure.ac 2008-11-09 21:10:40.000000000 +0100
++++ configure.ac.new 2008-11-09 21:12:18.000000000 +0100
+@@ -2,7 +2,7 @@
+ # Process this file with autoconf to produce a configure script.
+
+ AC_PREREQ(2.57)
+-AC_INIT(tslib, 0.0.2, kergoth@handhelds.org)
++AC_INIT(tslib, 1.0, kergoth@handhelds.org)
+ # AC_CONFIG_AUX_DIR(config)
+ AM_INIT_AUTOMAKE(dist-bzip2)
+ AC_CONFIG_SRCDIR([src/ts_close.c])
+@@ -43,7 +43,6 @@
+
+ # Checks for library functions.
+ AC_PROG_GCC_TRADITIONAL
+-AC_FUNC_MALLOC
+ AC_FUNC_MMAP
+ AC_FUNC_SELECT_ARGTYPES
+ AC_TYPE_SIGNAL
+@@ -193,7 +192,7 @@
+ AC_SUBST(TS_CONF)
+
+ # Library versioning
+-LT_RELEASE=0.0
++LT_RELEASE=1.0
+ LT_CURRENT=1
+ LT_REVISION=1
+ LT_AGE=1
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-devfs.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-devfs.patch
new file mode 100644
index 0000000000..d7ef0a9589
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-devfs.patch
@@ -0,0 +1,18 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- tslib/tests/fbutils.c~devfs.patch
++++ tslib/tests/fbutils.c
+@@ -44,8 +44,8 @@
+ static unsigned colormap [256];
+ int xres, yres;
+
+-static char *defaultfbdevice = "/dev/fb0";
+-static char *defaultconsoledevice = "/dev/tty";
++static char *defaultfbdevice = "/dev/fb/0";
++static char *defaultconsoledevice = "/dev/vc/";
+ static char *fbdevice = NULL;
+ static char *consoledevice = NULL;
+
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-event1.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-event1.patch
new file mode 100644
index 0000000000..88cc3f3a2a
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-event1.patch
@@ -0,0 +1,80 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- tslib/tests/ts_calibrate.c~event1
++++ tslib/tests/ts_calibrate.c
+@@ -179,11 +179,7 @@
+ if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
+ ts = ts_open(tsdevice,0);
+ } else {
+-#ifdef USE_INPUT_API
+- ts = ts_open("/dev/input/event0", 0);
+-#else
+- ts = ts_open("/dev/touchscreen/ucb1x00", 0);
+-#endif /* USE_INPUT_API */
++ ts = ts_open("/dev/input/event1", 0);
+ }
+
+ if (!ts) {
+--- tslib/tests/ts_print.c~event1
++++ tslib/tests/ts_print.c
+@@ -28,11 +28,7 @@
+ if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
+ ts = ts_open(tsdevice,0);
+ } else {
+-#ifdef USE_INPUT_API
+- ts = ts_open("/dev/input/event0", 0);
+-#else
+- ts = ts_open("/dev/touchscreen/ucb1x00", 0);
+-#endif /* USE_INPUT_API */
++ ts = ts_open("/dev/input/event1", 0);
+ }
+
+ if (!ts) {
+--- tslib/tests/ts_test.c~event1
++++ tslib/tests/ts_test.c
+@@ -120,11 +120,7 @@
+ signal(SIGTERM, sig);
+
+ if ((tsdevice = getenv("TSLIB_TSDEVICE")) == NULL) {
+-#ifdef USE_INPUT_API
+- tsdevice = strdup ("/dev/input/event0");
+-#else
+- tsdevice = strdup ("/dev/touchscreen/ucb1x00");
+-#endif /* USE_INPUT_API */
++ tsdevice = strdup ("/dev/input/event1");
+ }
+
+ ts = ts_open (tsdevice, 0);
+--- tslib/tests/ts_print_raw.c~event1
++++ tslib/tests/ts_print_raw.c
+@@ -28,11 +28,7 @@
+ if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
+ ts = ts_open(tsdevice,0);
+ } else {
+-#ifdef USE_INPUT_API
+- ts = ts_open("/dev/input/event0", 0);
+-#else
+- ts = ts_open("/dev/touchscreen/ucb1x00", 0);
+-#endif /* USE_INPUT_API */
++ ts = ts_open("/dev/input/event1", 0);
+ }
+
+ if (!ts) {
+--- tslib/tests/ts_harvest.c~event1
++++ tslib/tests/ts_harvest.c
+@@ -75,11 +75,7 @@
+ signal(SIGTERM, sig);
+
+ if ((tsdevice = getenv("TSLIB_TSDEVICE")) == NULL) {
+-#ifdef USE_INPUT_API
+- tsdevice = strdup ("/dev/input/event0");
+-#else
+- tsdevice = strdup ("/dev/touchscreen/ucb1x00");
+-#endif /* USE_INPUT_API */
++ tsdevice = strdup ("/dev/input/event1");
+ }
+
+ ts = ts_open (tsdevice, 0);
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-finddev-inputattach.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-finddev-inputattach.patch
new file mode 100644
index 0000000000..2d6338166f
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-finddev-inputattach.patch
@@ -0,0 +1,718 @@
+diff -Naur tslib-org/tests/Makefile.am tslib-1.0/tests/Makefile.am
+--- tslib-org/tests/Makefile.am 2006-08-25 00:02:55.000000000 +0300
++++ tslib-1.0/tests/Makefile.am 2007-05-07 17:39:54.000000000 +0300
+@@ -12,7 +12,7 @@
+ AM_CFLAGS = $(DEBUGFLAGS)
+ INCLUDES = -I$(top_srcdir)/src
+
+-bin_PROGRAMS = ts_test ts_calibrate ts_print ts_print_raw ts_harvest
++bin_PROGRAMS = ts_test ts_calibrate ts_print ts_print_raw ts_harvest ts_finddev inputattach
+
+ ts_test_SOURCES = ts_test.c fbutils.c fbutils.h font_8x8.c font_8x16.c font.h
+ ts_test_LDADD = $(top_builddir)/src/libts.la
+@@ -27,4 +27,10 @@
+ ts_calibrate_LDADD = $(top_builddir)/src/libts.la
+
+ ts_harvest_SOURCES = ts_harvest.c fbutils.c fbutils.h testutils.c testutils.h font_8x8.c font_8x16.c font.h
+-ts_harvest_LDADD = $(top_builddir)/src/libts.la
++ts_harvest_LDADD = $(top_builddir)/src/libts.la
++
++ts_finddev_SOURCES = ts_finddev.c
++ts_finddev_LDADD = $(top_builddir)/src/libts.la
++
++inputattach_SOURCES = inputattach.c
++inputattach_LDADD =
+diff -Naur tslib-org/tests/inputattach.c tslib-1.0/tests/inputattach.c
+--- tslib-org/tests/inputattach.c 1970-01-01 02:00:00.000000000 +0200
++++ tslib-1.0/tests/inputattach.c 2007-05-07 17:36:37.000000000 +0300
+@@ -0,0 +1,611 @@
++/*
++ * $Id: 00_all_tslib-1.0-finddev-inputattach.patch,v 1.1 2009/05/09 17:46:02 vapier Exp $
++ *
++ * Copyright (c) 1999-2000 Vojtech Pavlik
++ *
++ * Sponsored by SuSE
++ *
++ * Twiddler support Copyright (c) 2001 Arndt Schoenewald
++ * Sponsored by Quelltext AG (http://www.quelltext-ag.de), Dortmund, Germany
++ */
++
++/*
++ * Input line discipline attach program
++ */
++
++/*
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ *
++ * Should you need to contact me, the author, you can do so either by
++ * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
++ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
++ */
++
++/* softa note:
++cvs version is here:
++http://cvs.sourceforge.net/viewcvs.py/ *checkout* /linuxconsole/ruby/utils/inputattach.c
++*/
++
++#include <linux/serio.h>
++
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/ioctl.h>
++#include <sys/time.h>
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <termios.h>
++#include <string.h>
++#include <assert.h>
++#include <ctype.h>
++
++// softa patch!
++/*
++ * Serio types
++ */
++#ifndef SERIO_UNKNOWN
++ #define SERIO_UNKNOWN 0x00
++#endif
++#ifndef SERIO_MSC
++ #define SERIO_MSC 0x01
++#endif
++#ifndef SERIO_SUN
++ #define SERIO_SUN 0x02
++#endif
++#ifndef SERIO_MS
++ #define SERIO_MS 0x03
++#endif
++#ifndef SERIO_MP
++ #define SERIO_MP 0x04
++#endif
++#ifndef SERIO_MZ
++ #define SERIO_MZ 0x05
++#endif
++#ifndef SERIO_MZP
++ #define SERIO_MZP 0x06
++#endif
++#ifndef SERIO_MZPP
++ #define SERIO_MZPP 0x07
++#endif
++#ifndef SERIO_VSXXXAA
++ #define SERIO_VSXXXAA 0x08
++#endif
++#ifndef SERIO_SUNKBD
++ #define SERIO_SUNKBD 0x10
++#endif SERIO_SUNKBD
++#ifndef SERIO_WARRIOR
++ #define SERIO_WARRIOR 0x18
++#endif
++#ifndef SERIO_WARRIOR
++ #define SERIO_SPACEORB 0x19
++#endif
++#ifndef SERIO_MAGELLAN
++ #define SERIO_MAGELLAN 0x1a
++#endif
++#ifndef SERIO_SPACEBALL
++ #define SERIO_SPACEBALL 0x1b
++#endif
++#ifndef SERIO_GUNZE
++ #define SERIO_GUNZE 0x1c
++#endif
++#ifndef SERIO_IFORCE
++ #define SERIO_IFORCE 0x1d
++#endif
++#ifndef SERIO_STINGER
++ #define SERIO_STINGER 0x1e
++#endif
++#ifndef SERIO_NEWTON
++ #define SERIO_NEWTON 0x1f
++#endif
++#ifndef SERIO_STOWAWAY
++ #define SERIO_STOWAWAY 0x20
++#endif
++#ifndef SERIO_H3600
++ #define SERIO_H3600 0x21
++#endif
++#ifndef SERIO_PS2SER
++ #define SERIO_PS2SER 0x22
++#endif
++#ifndef SERIO_TWIDKBD
++ #define SERIO_TWIDKBD 0x23
++#endif
++#ifndef SERIO_TWIDJOY
++ #define SERIO_TWIDJOY 0x24
++#endif
++#ifndef SERIO_HIL
++ #define SERIO_HIL 0x25
++#endif
++#ifndef SERIO_SNES232
++ #define SERIO_SNES232 0x26
++#endif
++#ifndef SERIO_SEMTECH
++ #define SERIO_SEMTECH 0x27
++#endif
++#ifndef SERIO_LKKBD
++ #define SERIO_LKKBD 0x28
++#endif
++#ifndef SERIO_ELO
++ #define SERIO_ELO 0x29
++#endif
++#ifndef SERIO_MICROTOUCH
++ #define SERIO_MICROTOUCH 0x30
++#endif
++#ifndef SERIO_PENMOUNT
++ #define SERIO_PENMOUNT 0x31
++#endif
++#ifndef SERIO_TOUCHRIGHT
++ #define SERIO_TOUCHRIGHT 0x32
++#endif
++#ifndef SERIO_TOUCHWIN
++ #define SERIO_TOUCHWIN 0x33
++#endif
++// end softa patch!
++
++int readchar(int fd, unsigned char *c, int timeout)
++{
++ struct timeval tv;
++ fd_set set;
++
++ tv.tv_sec = 0;
++ tv.tv_usec = timeout * 1000;
++
++ FD_ZERO(&set);
++ FD_SET(fd, &set);
++
++ if (!select(fd+1, &set, NULL, NULL, &tv)) return -1;
++ if (read(fd, c, 1) != 1) return -1;
++
++ return 0;
++}
++
++
++
++void setline(int fd, int flags, int speed)
++{
++ struct termios t;
++
++ tcgetattr(fd, &t);
++
++ t.c_cflag = flags | CREAD | HUPCL | CLOCAL;
++ t.c_iflag = IGNBRK | IGNPAR;
++ t.c_oflag = 0;
++ t.c_lflag = 0;
++ t.c_cc[VMIN ] = 1;
++ t.c_cc[VTIME] = 0;
++
++ cfsetispeed(&t, speed);
++ cfsetospeed(&t, speed);
++
++ tcsetattr(fd, TCSANOW, &t);
++}
++
++int logitech_command(int fd, char *c)
++{
++ int i;
++ unsigned char d;
++ for (i = 0; c[i]; i++) {
++ write(fd, c + i, 1);
++ if (readchar(fd, &d, 1000))
++ return -1;
++ if (c[i] != d)
++ return -1;
++ }
++ return 0;
++}
++
++int magellan_init(int fd, long *id, long *extra)
++{
++ write(fd, "m3\rpBB\rz\r", 9);
++ return 0;
++}
++
++int warrior_init(int fd, long *id, long *extra)
++{
++ if (logitech_command(fd, "*S")) return -1;
++ setline(fd, CS8, B4800);
++ return 0;
++}
++
++int spaceball_waitchar(int fd, unsigned char c, unsigned char *d, int timeout)
++{
++ unsigned char b = 0;
++
++ while (!readchar(fd, &b, timeout)) {
++ if (b == 0x0a) continue;
++ *d++ = b;
++ if (b == c) break;
++ }
++
++ *d = 0;
++
++ return -(b != c);
++}
++
++int spaceball_waitcmd(int fd, char c, char *d)
++{
++ int i;
++
++ for (i = 0; i < 8; i++) {
++ if (spaceball_waitchar(fd, 0x0d, d, 1000))
++ return -1;
++ if (d[0] == c)
++ return 0;
++ }
++
++ return -1;
++}
++
++int spaceball_cmd(int fd, char *c, char *d)
++{
++ int i;
++
++ for (i = 0; c[i]; i++)
++ write(fd, c + i, 1);
++ write(fd, "\r", 1);
++
++ i = spaceball_waitcmd(fd, toupper(c[0]), d);
++
++ return i;
++}
++
++#define SPACEBALL_1003 1
++#define SPACEBALL_2003B 3
++#define SPACEBALL_2003C 4
++#define SPACEBALL_3003C 7
++#define SPACEBALL_4000FLX 8
++#define SPACEBALL_4000FLX_L 9
++
++int spaceball_init(int fd, long *id, long *extra)
++{
++ char r[64];
++
++ if (spaceball_waitchar(fd, 0x11, r, 4000) ||
++ spaceball_waitchar(fd, 0x0d, r, 1000))
++ return -1;
++
++ if (spaceball_waitcmd(fd, '@', r))
++ return -1;
++
++ if (strncmp("@1 Spaceball alive", r, 18))
++ return -1;
++
++ if (spaceball_waitcmd(fd, '@', r))
++ return -1;
++
++ if (spaceball_cmd(fd, "hm", r))
++ return -1;
++
++ if (!strncmp("Hm2003B", r, 7))
++ *id = SPACEBALL_2003B;
++ if (!strncmp("Hm2003C", r, 7))
++ *id = SPACEBALL_2003C;
++ if (!strncmp("Hm3003C", r, 7))
++ *id = SPACEBALL_3003C;
++
++ if (!strncmp("HvFirmware", r, 10)) {
++
++ if (spaceball_cmd(fd, "\"", r))
++ return -1;
++
++ if (strncmp("\"1 Spaceball 4000 FLX", r, 21))
++ return -1;
++
++ if (spaceball_waitcmd(fd, '"', r))
++ return -1;
++
++ if (strstr(r, " L "))
++ *id = SPACEBALL_4000FLX_L;
++ else
++ *id = SPACEBALL_4000FLX;
++
++ if (spaceball_waitcmd(fd, '"', r))
++ return -1;
++
++ if (spaceball_cmd(fd, "YS", r))
++ return -1;
++
++ if (spaceball_cmd(fd, "M", r))
++ return -1;
++
++ return 0;
++ }
++
++ if (spaceball_cmd(fd, "P@A@A", r) ||
++ spaceball_cmd(fd, "FT@", r) ||
++ spaceball_cmd(fd, "MSS", r))
++ return -1;
++
++ return 0;
++}
++
++int stinger_init(int fd, long *id, long *extra)
++{
++ int i;
++ unsigned char c;
++ unsigned char *response = "\r\n0600520058C272";
++
++ if (write(fd, " E5E5", 5) != 5) /* Enable command */
++ return -1;
++
++ for (i = 0; i < 16; i++) /* Check for Stinger */
++ if (readchar(fd, &c, 200) || (c != response[i]))
++ return -1;
++
++ return 0;
++}
++
++int mzp_init(int fd, long *id, long *extra)
++{
++ if (logitech_command(fd, "*X*q")) return -1;
++ setline(fd, CS8, B9600);
++ return 0;
++}
++
++int newton_init(int fd, long *id, long *extra)
++{
++ int i;
++ unsigned char c;
++ unsigned char response[35] =
++ { 0x16, 0x10, 0x02, 0x64, 0x5f, 0x69, 0x64, 0x00,
++ 0x00, 0x00, 0x0c, 0x6b, 0x79, 0x62, 0x64, 0x61,
++ 0x70, 0x70, 0x6c, 0x00, 0x00, 0x00, 0x01, 0x6e,
++ 0x6f, 0x66, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x10,
++ 0x03, 0xdd, 0xe7 };
++
++ for (i = 0; i < 35; i++)
++ if (readchar(fd, &c, 400) || (c != response[i]))
++ return -1;
++
++ return 0;
++}
++
++int twiddler_init(int fd, long *id, long *extra)
++{
++ unsigned char c[10];
++ int count, line;
++
++ /* Turn DTR off, otherwise the Twiddler won't send any data. */
++ if (ioctl(fd, TIOCMGET, &line)) return -1;
++ line &= ~TIOCM_DTR;
++ if (ioctl(fd, TIOCMSET, &line)) return -1;
++
++ /* Check whether the device on the serial line is the Twiddler.
++ *
++ * The Twiddler sends data packets of 5 bytes which have the following
++ * properties: the MSB is 0 on the first and 1 on all other bytes, and
++ * the high order nibble of the last byte is always 0x8.
++ *
++ * We read and check two of those 5 byte packets to be sure that we
++ * are indeed talking to a Twiddler. */
++
++ /* Read at most 5 bytes until we find one with the MSB set to 0 */
++ for (count = 0; count < 5; count++) {
++ if (readchar(fd, c+0, 500)) return -1;
++ if ((c[0] & 0x80) == 0) break;
++ }
++
++ if (count == 5) {
++ /* Could not find header byte in data stream */
++ return -1;
++ }
++
++ /* Read remaining 4 bytes plus the full next data packet */
++ for (count = 1; count < 10; count++) {
++ if (readchar(fd, c+count, 500)) return -1;
++ }
++
++ /* Check whether the bytes of both data packets obey the rules */
++ for (count = 1; count < 10; count++) {
++ if ((count % 5 == 0 && (c[count] & 0x80) != 0)
++ || (count % 5 == 4 && (c[count] & 0xF0) != 0x80)
++ || (count % 5 != 0 && (c[count] & 0x80) != 0x80)) {
++ /* Invalid byte in data packet */
++ return -1;
++ }
++ }
++
++ return 0;
++}
++
++int penmount_init(int fd, long *id, long *extra)
++{
++ unsigned char init_cmd[5] = { 0xF2, 0x00, 0x00, 0x00, 0x00 };
++ unsigned char start_cmd[5] = { 0xF1, 0x00, 0x00, 0x00, 0x00 };
++ unsigned char c[10];
++ int count;
++
++ /* try to initialize device */
++ if (write( fd, init_cmd, 5 ) != 5)
++ return -1;
++
++ /* read the responce */
++ for (count = 0; count < 5; count ++) {
++ if (readchar(fd, c+0, 500)) return -1;
++ if (c[0] == 0xf2) break;
++ }
++
++ if (readchar(fd, c+1, 500)) return -1;
++ if (c[1] != 0xd9) return -1;
++
++ if (readchar(fd, c+2, 500)) return -1;
++ if (c[2] != 0x0a) return -1;
++
++ /* the device is present! start it! */
++ if (write( fd, start_cmd, 5 ) != 5)
++ return -1;
++
++ return 0;
++}
++
++int dump_init(int fd, long *id, long *extra)
++{
++ unsigned char c, o = 0;
++
++ c = 0x80;
++
++ if (write(fd, &c, 1) != 1) /* Enable command */
++ return -1;
++
++ while (1)
++ if (!readchar(fd, &c, 1)) {
++ printf("%02x (%c) ", c, ((c > 32) && (c < 127)) ? c : 'x');
++ o = 1;
++ } else {
++ if (o) {
++ printf("\n");
++ o = 0;
++ }
++ }
++}
++
++struct input_types {
++ char name[16];
++ char name2[16];
++ int speed;
++ int flags;
++ unsigned long type;
++ unsigned long id;
++ unsigned long extra;
++ int flush;
++ int (*init)(int fd, long *id, long *extra);
++};
++
++struct input_types input_types[] = {
++
++{ "--sunkbd", "-skb", B1200, CS8, SERIO_SUNKBD, 0, 0, 1, NULL },
++{ "--lkkbd", "-lk", B4800, CS8|CSTOPB, SERIO_LKKBD, 0, 0, 1, NULL },
++{ "--vsxxx-aa", "-vs", B4800, CS8|CSTOPB|PARENB|PARODD,SERIO_VSXXXAA, 0, 0, 1, NULL },
++{ "--spaceorb", "-orb", B9600, CS8, SERIO_SPACEORB, 0, 0, 1, NULL },
++{ "--spaceball", "-sbl", B9600, CS8, SERIO_SPACEBALL,0, 0, 0, spaceball_init },
++{ "--magellan", "-mag", B9600, CS8 | CSTOPB | CRTSCTS, SERIO_MAGELLAN, 0, 0, 1, magellan_init },
++{ "--warrior", "-war", B1200, CS7 | CSTOPB, SERIO_WARRIOR, 0, 0, 1, warrior_init },
++{ "--stinger", "-sting", B1200, CS8, SERIO_STINGER, 0, 0, 1, stinger_init },
++{ "--mousesystems", "-msc", B1200, CS8, SERIO_MSC, 0, 0x01, 1, NULL },
++{ "--sunmouse", "-sun", B1200, CS8, SERIO_SUN, 0, 0x01, 1, NULL },
++{ "--microsoft", "-bare", B1200, CS7, SERIO_MS, 0, 0, 1, NULL },
++{ "--mshack", "-ms", B1200, CS7, SERIO_MS, 0, 0x01, 1, NULL },
++{ "--mouseman", "-mman", B1200, CS7, SERIO_MP, 0, 0x01, 1, NULL },
++{ "--intellimouse", "-ms3", B1200, CS7, SERIO_MZ, 0, 0x11, 1, NULL },
++{ "--mmwheel", "-mmw", B1200, CS7 | CSTOPB, SERIO_MZP, 0, 0x13, 1, mzp_init },
++{ "--iforce", "-ifor", B38400, CS8, SERIO_IFORCE, 0, 0, 0, NULL },
++{ "--newtonkbd", "-newt", B9600, CS8, SERIO_NEWTON, 0, 0, 0, newton_init },
++{ "--h3600ts", "-ipaq", B115200, CS8, SERIO_H3600, 0, 0, 0, NULL },
++{ "--stowawaykbd", "-ipaqkbd", B115200, CS8, SERIO_STOWAWAY, 0, 0, 0, NULL },
++{ "--ps2serkbd", "-ps2ser", B1200, CS8, SERIO_PS2SER, 0, 0, 1, NULL },
++{ "--twiddler", "-twid", B2400, CS8, SERIO_TWIDKBD, 0, 0, 0, twiddler_init },
++{ "--twiddler-joy", "-twidjoy", B2400, CS8, SERIO_TWIDJOY, 0, 0, 0, twiddler_init },
++{ "--elotouch", "-elo", B9600, CS8 | CRTSCTS, SERIO_ELO, 0, 0, 0, NULL },
++{ "--elo4002", "-elo6b", B9600, CS8 | CRTSCTS, SERIO_ELO, 1, 0, 0, NULL },
++{ "--elo271-140", "-elo4b", B9600, CS8 | CRTSCTS, SERIO_ELO, 2, 0, 0, NULL },
++{ "--elo261-280", "-elo3b", B9600, CS8 | CRTSCTS, SERIO_ELO, 3, 0, 0, NULL },
++{ "--dump", "-dump", B2400, CS8, 0, 0, 0, 0, dump_init },
++{ "--dmc9000", "-dmc", B19200, CS8, SERIO_PENMOUNT, 0, 0, 0, penmount_init },
++{ "", "", 0, 0 }
++
++};
++
++int main(int argc, char **argv)
++{
++ unsigned long devt;
++ int ldisc;
++ int type;
++ long id, extra;
++ int fd;
++ char c;
++
++ if (argc < 2 || argc > 3 || !strcmp("--help", argv[1])) {
++ puts("");
++ puts("Usage: inputttach <mode> <device>");
++ puts("");
++ puts("Modes:");
++ puts(" --sunkbd -skb Sun Type 4 and Type 5 keyboards");
++ puts(" --lkkbd -lk DEC LK201 / LK401 keyboards");
++ puts(" --vsxxx-aa -vs DEC VSXXX-AA / VSXXX-GA mouse and VSXXX-AB tablet");
++ puts(" --spaceorb -orb SpaceOrb 360 / SpaceBall Avenger");
++ puts(" --spaceball -sbl SpaceBall 2003 / 3003 / 4000 FLX");
++ puts(" --magellan -mag Magellan / SpaceMouse");
++ puts(" --warrior -war WingMan Warrior");
++ puts(" --stinger -stng Gravis Stinger");
++ puts(" --mousesystems -msc 3-button Mouse Systems mice");
++ puts(" --sunmouse -sun 3-button Sun mice");
++ puts(" --microsoft -bare 2-button Microsoft mice");
++ puts(" --mshack -ms 3-button mice in Microsoft mode");
++ puts(" --mouseman -mman 3-button Logitech and Genius mice");
++ puts(" --intellimouse -ms3 Microsoft IntelliMouse");
++ puts(" --mmwheel -mmw Logitech mice with 4-5 buttons or wheel");
++ puts(" --iforce -ifor I-Force joysticks and wheels");
++ puts(" --h3600ts -ipaq Ipaq h3600 touchscreen");
++ puts(" --stowawaykbd -ipaqkbd Stowaway keyboard");
++ puts(" --ps2serkbd -ps2ser PS/2 via serial keyboard");
++ puts(" --twiddler -twid Handykey Twiddler chording keyboard");
++ puts(" --twiddler-joy -twidjoy Handykey Twiddler used as a joystick");
++ puts(" --dmc9000 -dmc DMC9000/Penpount touchscreen");
++ puts("");
++ return 1;
++ }
++
++ for (type = 0; input_types[type].speed; type++) {
++ if (!strncasecmp(argv[1], input_types[type].name, 16) ||
++ !strncasecmp(argv[1], input_types[type].name2, 16))
++ break;
++ }
++
++ if (!input_types[type].speed) {
++ fprintf(stderr, "inputattach: invalid mode\n");
++ return 1;
++ }
++
++ if ((fd = open(argv[2], O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) {
++ perror("inputattach");
++ return 1;
++ }
++
++ setline(fd, input_types[type].flags, input_types[type].speed);
++
++ if (input_types[type].flush)
++ while (!readchar(fd, &c, 100));
++
++ id = input_types[type].id;
++ extra = input_types[type].extra;
++
++ if (input_types[type].init && input_types[type].init(fd, &id, &extra)) {
++ fprintf(stderr, "inputattach: device initialization failed\n");
++ return 1;
++ }
++
++ ldisc = N_MOUSE;
++ if(ioctl(fd, TIOCSETD, &ldisc)) {
++ fprintf(stderr, "inputattach: can't set line discipline\n");
++ return 1;
++ }
++
++ devt = input_types[type].type | (id << 8) | (extra << 16);
++
++ if(ioctl(fd, SPIOCSTYPE, &devt)) {
++ fprintf(stderr, "inputattach: can't set device type\n");
++ return 1;
++ }
++
++ read(fd, NULL, 0);
++
++ ldisc = 0;
++ ioctl(fd, TIOCSETD, &ldisc);
++ close(fd);
++
++ return 0;
++}
+diff -Naur tslib-org/tests/ts_finddev.c tslib-1.0/tests/ts_finddev.c
+--- tslib-org/tests/ts_finddev.c 1970-01-01 02:00:00.000000000 +0200
++++ tslib-1.0/tests/ts_finddev.c 2007-05-07 17:36:37.000000000 +0300
+@@ -0,0 +1,75 @@
++/*
++ * tslib/src/ts_print.c
++ *
++ * Derived from tslib/src/ts_test.c by Douglas Lowder
++ * Just prints touchscreen events -- does not paint them on framebuffer
++ *
++ * This file is placed under the GPL. Please see the file
++ * COPYING for more details.
++ *
++ * Basic test program for touchscreen library.
++ */
++#include <stdio.h>
++#include <stdlib.h>
++#include <signal.h>
++#include <sys/fcntl.h>
++#include <sys/ioctl.h>
++#include <sys/mman.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <unistd.h>
++
++#include "tslib.h"
++
++void usage( int argc, char** argv ) {
++ printf( "Usage: %s device_name wait_for_sec\n", argv[0] );
++ printf( "\tdevice_name - tdevice to probe, example /dev/input/event0\n" );
++ printf( "\twait_for_sec - wait seconds for touch event, if 0 - dont wait!\n" );
++ printf( "\tReturn codes:\n" );
++ printf( "\t 0 - timeout expired without receiving event.\n" );
++ printf( "\t But this maybe is TouchScreen.\n" );
++ printf( "\t -1 - this is NOT TouchScreen device!\n" );
++ printf( "\t 1 - this is TouchScreen for shure!\n" );
++ exit(-1);
++}
++
++void alarm_handler( int sig ) {
++ // time is expired!
++ exit(0);
++}
++
++int main( int argc, char** argv )
++{
++ struct tsdev *ts;
++ struct ts_sample samp;
++ char *tsdevice=NULL;
++ int waitsec;
++ int ret;
++
++ if (argc != 3)
++ usage( argc, argv );
++
++ tsdevice = argv[1];
++ waitsec = atoi( argv[2] );
++ if (waitsec < 0)
++ usage( argc, argv );
++
++ ts = ts_open( tsdevice, 0 );
++ if (!ts)
++ return -1;
++ if (ts_config(ts))
++ return -1;
++
++ if (!waitsec) {
++ return 0;
++ }
++
++ printf( "Probe device %s, Please Touch Screen Anywhere in %i seconds! ... \n", tsdevice, waitsec );
++ signal( SIGALRM, alarm_handler );
++ alarm( waitsec );
++ ret = ts_read_raw(ts, &samp, 1 );
++ if (ret)
++ return 1;
++
++ return -1;
++}
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-bzero.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-bzero.patch
new file mode 100644
index 0000000000..3e3ef3e1d2
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-bzero.patch
@@ -0,0 +1,11 @@
+--- a/src/ts_parse_vars.c 2006-08-24 17:02:55.000000000 -0400
++++ b/src/ts_parse_vars.c 2008-03-12 13:57:01.000000000 -0400
+@@ -33,7 +33,7 @@ int tslib_parse_vars(struct tslib_module
+ return 0;
+
+ //s = alloca(strlen(str));
+- bzero(s_holder,1024);
++ memset(s_holder, 0, 1024);
+ strncpy(s_holder,str,strlen(str));
+ s = s_holder;
+ while ((p = strsep(&s, " \t")) != NULL && ret == 0) {
diff --git a/src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-return-on-error-from-check-df.patch b/src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-return-on-error-from-check-df.patch
new file mode 100644
index 0000000000..7945c1bd9d
--- /dev/null
+++ b/src/patchsets/tslib/1.0/00_all_tslib-1.0-remove-return-on-error-from-check-df.patch
@@ -0,0 +1,11 @@
+--- a/plugins/input-raw.c 2008-01-25 14:02:23.000000000 +0100
++++ b/plugins/input-raw.new.c 2008-01-25 14:02:50.000000000 +0100
+@@ -58,8 +58,6 @@ static int check_fd(struct tslib_input *
+ (ioctl(ts->fd, EVIOCGBIT(EV_ABS, sizeof(absbit) * 8), &absbit) >= 0) &&
+ (absbit & (1 << ABS_X)) &&
+ (absbit & (1 << ABS_Y)) && (absbit & (1 << ABS_PRESSURE)))) {
+- fprintf(stderr, "selected device is not a touchscreen I understand\n");
+- return -1;
+ }
+
+ if (bit & (1 << EV_SYN))
diff --git a/src/patchsets/tslib/1.0/10_all_tslib-1.0-open-mode.patch b/src/patchsets/tslib/1.0/10_all_tslib-1.0-open-mode.patch
new file mode 100644
index 0000000000..277da17158
--- /dev/null
+++ b/src/patchsets/tslib/1.0/10_all_tslib-1.0-open-mode.patch
@@ -0,0 +1,16 @@
+http://bugs.gentoo.org/268531
+
+--- tests/ts_calibrate.c
++++ tests/ts_calibrate.c
+@@ -220,9 +220,9 @@ int main()
+ for (i = 0; i < 7; i++) printf("%d ", cal.a [i]);
+ printf("\n");
+ if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
+- cal_fd = open (calfile, O_CREAT | O_RDWR);
++ cal_fd = open (calfile, O_CREAT | O_RDWR, 0644);
+ } else {
+- cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);
++ cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0644);
+ }
+ sprintf (cal_buffer,"%d %d %d %d %d %d %d",
+ cal.a[1], cal.a[2], cal.a[0],
diff --git a/src/patchsets/tslib/1.0/15_all_tslib-1.0-configure-linear-h2200.patch b/src/patchsets/tslib/1.0/15_all_tslib-1.0-configure-linear-h2200.patch
new file mode 100644
index 0000000000..76b15fc71f
--- /dev/null
+++ b/src/patchsets/tslib/1.0/15_all_tslib-1.0-configure-linear-h2200.patch
@@ -0,0 +1,13 @@
+http://bugs.gentoo.org/264869
+
+--- configure.ac
++++ configure.ac
+@@ -70,7 +70,7 @@
+ AM_CONDITIONAL(ENABLE_DEJITTER_MODULE, test "$dejitter_module" = "yes")
+
+ AC_MSG_CHECKING([whether linear-h2200 module is requested])
+-AC_ARG_ENABLE(dejitter,
++AC_ARG_ENABLE(linear-h2200,
+ AS_HELP_STRING([--enable-linear-h2200],
+ [Enable building of linearizing filter for iPAQ h2200 (default=yes)]),
+ [h2200_linear_module=$enableval],
diff --git a/src/patchsets/tslib/1.0/README.history b/src/patchsets/tslib/1.0/README.history
new file mode 100644
index 0000000000..1df851b951
--- /dev/null
+++ b/src/patchsets/tslib/1.0/README.history
@@ -0,0 +1,11 @@
+3 09.05.2009
+ + 00_all_tslib-1.0-absbit.patch
+ + 00_all_tslib-1.0-correct-libversion.patch
+ + 00_all_tslib-1.0-devfs.patch
+ + 00_all_tslib-1.0-event1.patch
+ + 00_all_tslib-1.0-finddev-inputattach.patch
+ + 00_all_tslib-1.0-remove-bzero.patch
+ + 00_all_tslib-1.0-remove-return-on-error-from-check-df.patch
+ + 00_all_tslib-1.0-UnknownEventType0.patch
+ + 10_all_tslib-1.0-open-mode.patch
+ + 15_all_tslib-1.0-configure-linear-h2200.patch
diff --git a/src/patchsets/tslib/make-tarball.sh b/src/patchsets/tslib/make-tarball.sh
new file mode 100644
index 0000000000..6209b4f92f
--- /dev/null
+++ b/src/patchsets/tslib/make-tarball.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+usage()
+{
+ echo "Usage: $0 <package version>"
+ exit 1
+}
+
+[[ $# -ne 1 ]] && usage
+
+PN=${PWD##*/}
+PV=$1
+P="${PN}-${PV}"
+pver=
+
+if [[ ! -d ./${PV} ]] ; then
+ echo "Error: ${PV} is not a valid version"
+ exit 1
+fi
+
+if [[ -z ${pver} ]] ; then
+ pver=$(awk '{print $1; exit}' ./${PV}/README.history)
+ [[ -z ${pver} ]] && usage
+fi
+
+rm -rf tmp
+rm -f ${P}-*.tar.bz2
+
+mkdir -p tmp/patch
+cp -r ../README* ${PV}/*.patch ${PV}/README.history tmp/patch/ || exit 1
+
+tar jcf ${P}-patches-${pver}.tar.bz2 -C tmp patch || exit 1
+rm -r tmp
+
+du -b ${P}-*.tar.*