Folks,
Below are patches to the kernel source code and the xorg-x11-server and
xorg-x11-drv-evdev packages which restore function to the ALPS Pen
Tablet (dlo#5268), which fix the twin clicks bug that plagued previous
approaches (dlo#6079), and which cause X to configure the Pen Tablet in
absolute mode (mapped to the entire screen, dlo#1002) while leaving
Glide Sensor in relative mode (discussion at dlo#4260).
Blake Michael
From 827d3ab4637a72b9cb0eede4d071234df20cc24c Mon Sep 17 00:00:00 2001
From: Blake Setlow [EMAIL PROTECTED]
Date: Sun, 23 Mar 2008 21:32:07 -0400
Subject: [PATCH] OLPC: psmouse: Make the OLPC/ALPS Pen Tablet and Glide Sensor
play together.
The Pen Tablet has been disabled for some time [1] because enabling it caused
a twin clicks bug [2]. One minimal way to fix the first bug while avoiding
the second is to enable the Pen Tablet and its buttons while turning off some
of the buttons on the Glide Sensor. We do this and we attempt to explain why
each bit in the PT and GS device structs is set or unset.
This patch was coauthored by Blake Setlow and Michael Stone.
[1]: http://dev.laptop.org/ticket/5628
[2]: http://dev.laptop.org/ticket/6079
Signed-off-by: Michael Stone [EMAIL PROTECTED]
---
drivers/input/mouse/olpc.c | 54 +++
1 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/drivers/input/mouse/olpc.c b/drivers/input/mouse/olpc.c
index 9479658..80604bb 100644
--- a/drivers/input/mouse/olpc.c
+++ b/drivers/input/mouse/olpc.c
@@ -3,6 +3,7 @@
*
* Copyright (c) 2006 One Laptop Per Child, inc.
* Authors Zephaniah E. Hull and Andres Salomon [EMAIL PROTECTED]
+ * Authors Blake Setlow [EMAIL PROTECTED]
*
* This driver is partly based on the ALPS driver, which is:
*
@@ -487,21 +488,30 @@ int olpc_init(struct psmouse *psmouse)
goto init_fail;
}
- /*
-* Unset some of the default bits for things we don't have.
-*/
+ /* Mode: our Pen Tablet (PT) should be used in its absolute mode */
dev-evbit[LONG(EV_REL)] = ~BIT(EV_REL);
- dev-relbit[LONG(REL_X)] = ~(BIT(REL_X) | BIT(REL_Y));
- dev-keybit[LONG(BTN_MIDDLE)] = ~BIT(BTN_MIDDLE);
-
+ dev-evbit[LONG(EV_ABS)] |= BIT(EV_ABS);
dev-evbit[LONG(EV_KEY)] |= BIT(EV_KEY);
+
+ /* Axes: give us absolute and not relative data. */
+ dev-relbit[LONG(REL_X)] = ~BIT(REL_X);
+ dev-relbit[LONG(REL_Y)] = ~BIT(REL_Y);
+ dev-absbit[LONG(ABS_X)] |= BIT(ABS_X);
+ dev-absbit[LONG(ABS_Y)] |= BIT(ABS_Y);
+ dev-absbit[LONG(ABS_PRESSURE)] |= BIT(ABS_PRESSURE);
+
+ /* Buttons: without BTN_TOUCH but with BTN_TOOL_PEN, evtest reports
+* nothing! */
dev-keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
dev-keybit[LONG(BTN_TOOL_PEN)] |= BIT(BTN_TOOL_PEN);
- dev-keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT);
+ dev-keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT);
+ dev-keybit[LONG(BTN_RIGHT)] |= BIT(BTN_RIGHT);
+ dev-keybit[LONG(BTN_MIDDLE)] = ~BIT(BTN_MIDDLE);
- dev-evbit[LONG(EV_ABS)] |= BIT(EV_ABS);
- input_set_abs_params(dev, ABS_X, 2, 1000, 0, 0);
- input_set_abs_params(dev, ABS_Y, 0, 717, 0, 0);
+ /* Finally, some magic range numbers governing device output ranges. */
+ input_set_abs_params(dev, ABS_X, 2, 998, 0, 0);
+ input_set_abs_params(dev, ABS_Y, 2, 238, 0, 0);
+ input_set_abs_params(dev, ABS_PRESSURE, 0, 63, 0, 0);
snprintf(priv-phys, sizeof(priv-phys),
%s/input1, psmouse-ps2dev.serio-phys);
@@ -512,17 +522,31 @@ int olpc_init(struct psmouse *psmouse)
dev2-id.product = PSMOUSE_OLPC;
dev2-id.version = 0x;
+ /* Mode: we want to use the Glide Sensor (GS) in its relative mode, but
+* for some reason, it needs to be in absolute mode (with relative
+* axes) in order for HAL, evdev, and X to be happy. */
+ dev2-evbit[LONG(EV_REL)] = ~BIT(EV_REL);
+ dev2-evbit[LONG(EV_ABS)] |= BIT(EV_ABS);
dev2-evbit[LONG(EV_KEY)] |= BIT(EV_KEY);
+
+ /* Axes: we want relative data for the GS. */
+ dev2-relbit[LONG(REL_X)] |= BIT(REL_X);
+ dev2-relbit[LONG(REL_Y)] |= BIT(REL_Y);
+ dev2-absbit[LONG(ABS_X)] = ~BIT(ABS_X);
+ dev2-absbit[LONG(ABS_Y)] = ~BIT(ABS_Y);
+ dev2-absbit[LONG(ABS_PRESSURE)] = ~BIT(ABS_PRESSURE);
+
+ /* Buttons: We disable some of the GlideSensor buttons to avoid
+* receiving twinned clicks. See http://dev.laptop.org/ticket/6745. */
dev2-keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
dev2-keybit[LONG(BTN_TOOL_FINGER)] |= BIT(BTN_TOOL_FINGER);
- dev2-keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT);
+ dev2-keybit[LONG(BTN_LEFT)] = ~BIT(BTN_LEFT);
+ dev2-keybit[LONG(BTN_RIGHT)] = ~BIT(BTN_RIGHT);
+ dev2-keybit[LONG(BTN_MIDDLE)] = ~BIT(BTN_MIDDLE);
- /* bernie: argh -- needed for hal to see it as a mouse */
-