Bug#511987: xserver-xorg-input-evtouch: patch to support LEO 8800
Package: xserver-xorg-input-evtouch
Version: 0.8.7-3
Severity: normal
Tags: patch
The patch below allows evtouch to work with the LEO 8800 touch screen
controller.
Quortech's open source packages are available at:
ftp://ftp.quortech.com/eclipse/deb-packages
xf86-input-evtouch_0.8.7-3quortech3.dsc includes this patch.
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.22-14-generic
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
*** quortech-absolute-code.patch
# Description: This patch adapts evtouch to certain touch screen
# controllers (such as LEO 8800) that give their absolute position
# with the high bit set in the code.
#
# Changes
# o EVTouchProcessAbs() : Simplified and reworked to handle normal
# and codes with high bit set.
#
# Feel free to send comments, critics, suggestions to wuth@acm.org To
# apply simply change into the toplevel directory of the source to be
# modified and enter: patch -p1 < <PATH_TO_PATCH>
#
# All patches are available under the GNU GPL, I hope they might be
# useful for you (-:
# - Brett Wuth
#
Index: xf86-input-evtouch-0.8.7/evtouch.c
===================================================================
--- xf86-input-evtouch-0.8.7.orig/evtouch.c 2009-01-15 14:14:33.000000000 -0700
+++ xf86-input-evtouch-0.8.7/evtouch.c 2009-01-15 14:14:36.000000000 -0700
@@ -342,46 +342,61 @@
}
}
+
void EVTouchProcessAbs(EVTouchPrivatePtr priv)
{
- struct input_event *ev; /* packet being/just read */
-
- ev = &priv->ev;
+ struct input_event *ev; /* packet being/just read */
- if ( (ev->code == ABS_X) || (ev->code == ABS_Z) ) {
- dbg_loc( &ev->value, NULL, NULL, NULL );
+ ev = &priv->ev;
- if ((priv->cur_x - ev->value < priv->move_limit)
- && (priv->cur_x - ev->value > -priv->move_limit))
- return;
- priv->cur_x = ev->value;
-// libtouchSetXPos(priv->libtouch, priv->cur_x);
+ switch (ev->code) {
+ /* At least one touch screen controller (LEO 8800) produces
+ * messages with bit 1 of the code turned on. So instead of ABS
+ * we get ABS_X|0x2 and instead of ABS_Y we get ABS_Y|0x2. These
+ * are normally the codes for ABS_Z and ABS_RX respectively. Not
+ * sure whether this is A/ a bug in the controller, B/ a bug in
+ * the kernel driver, or C/ a change in the definition of the code
+ * value. We check for either value.
+ */
+ case ABS_X:
+ case ABS_X|0x2:
+ dbg_loc( &ev->value, NULL, NULL, NULL );
+
+ if ((priv->cur_x - ev->value < priv->move_limit)
+ && (priv->cur_x - ev->value > -priv->move_limit))
+ return;
+ priv->cur_x = ev->value;
+ //libtouchSetXPos(priv->libtouch, priv->cur_x);
+ break;
+
+ case ABS_Y:
+ case ABS_Y|0x2:
+ dbg_loc( NULL, &ev->value, NULL, NULL );
+
+ if ((priv->cur_y - ev->value < priv->move_limit)
+ && (priv->cur_y - ev->value > -priv->move_limit))
+ return;
+ priv->cur_y = ev->value;
+ // libtouchSetYPos(priv->libtouch, priv->cur_y);
+ break;
+
+ case ABS_WHEEL:
+ {
+ LocalDevicePtr local = priv->local;
+ if (ev->value > 0) {
+ for (; ev->value > 0; ev->value--) {
+ PostButtonEvent (local, 4,1,priv->cur_x,priv->cur_y);
+ PostButtonEvent (local, 4,0,priv->cur_x,priv->cur_y);
}
-
- if ( (ev->code == ABS_Y) || (ev->code == ABS_RX) ) {
- dbg_loc( NULL, &ev->value, NULL, NULL );
-
- if ((priv->cur_y - ev->value < priv->move_limit)
- && (priv->cur_y - ev->value > -priv->move_limit))
- return;
- priv->cur_y = ev->value;
-// libtouchSetYPos(priv->libtouch, priv->cur_y);
- }
-
- if (ev->code == ABS_WHEEL) {
- LocalDevicePtr local = priv->local;
- if (ev->value > 0) {
- for (; ev->value > 0; ev->value--) {
- PostButtonEvent (local, 4,1,priv->cur_x,priv->cur_y);
- PostButtonEvent (local, 4,0,priv->cur_x,priv->cur_y);
- }
- } else if (ev->value < 0) {
- for (ev->value = -ev->value; ev->value > 0; ev->value--) {
- PostButtonEvent (local, 5,1,priv->cur_x,priv->cur_y);
- PostButtonEvent (local, 5,0,priv->cur_x,priv->cur_y);
- }
- }
+ } else if (ev->value < 0) {
+ for (ev->value = -ev->value; ev->value > 0; ev->value--) {
+ PostButtonEvent (local, 5,1,priv->cur_x,priv->cur_y);
+ PostButtonEvent (local, 5,0,priv->cur_x,priv->cur_y);
}
+ }
+ }
+ break;
+ }
}
Reply to: