Re: [sugar] Fixing the Pen Tablet

2008-04-07 Thread Patrick Dubroy
I've heard that the tablet is enabled is in recent joyride builds. Is
there a build that has it that would be particularly good to try out?

And how does the tablet mapping work? Does it control the core
pointer, or is it accessed as an XInput device? I'm really interested
in trying this out, as an alternative to reading directly from
/dev/input/event5, as I'm doing now.

Thanks,

Pat
--
Patrick Dubroy
http://dubroy.com/blog - on programming, usability, and design

2008/3/23 Michael Stone [EMAIL PROTECTED]:
 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

 ___
  Devel mailing list
  [EMAIL PROTECTED]
  http://lists.laptop.org/listinfo/devel


___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] Fixing the Pen Tablet

2008-03-24 Thread Bernardo Innocenti
Careful: in the evdev driver rpm, I had a kludge to force relative
mode no matter what.  It should now be taken off.

-- 
 \___/
 |___|   Bernardo Innocenti - http://www.codewiz.org/
  \___\  One Laptop Per Child - http://www.laptop.org/
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


Re: [sugar] Fixing the Pen Tablet

2008-03-24 Thread Michael Stone
Andres,

Thanks for the feedback on our patch.

 - Please don't change the magic values without giving justification.  Also,
   do it in a separate patch.

A good suggestion which I shall keep in mind in the future. If the need
arises (which depends on your current plans for the PT), then Blake or I
shall split them.

 - Why are we patching the hal code?  That seems completely unnecessary
   simply to change ABS vs REL mode.  Not to mention, we aleady have the
   desired effect with a master kernel, without needing to patch
   additional stuff.

We felt it appropriate to patch X's calculate configuration options
from HAL data routine because the X server is capable of
auto-configuring its inputs in absolute or relative mode by itself only
when the configuration code is informed of which configuration to use.
Our patch passes along the appropriate information.

(Bernie's kludge set the default choice to Relative for all devices
lacking config data. That obviously won't work for us since we want to
use the GS in relative mode and the PT in absolute mode.)

 - Why aren't people using the touchpad code in master? 

Is this a rhetorical question?

  I don't care about getting the PT working in stable; post update.1
  (whenever *that* is), the old touchpad driver is going away.

Well, obviously Blake, myself, and several other folks do care about
getting the PT working in our builds. Why are you content to leave an
iconic feature broken for over four months in our builds, particularly
if you've already written code that fixes the problem?

Michael
___
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar


[sugar] Fixing the Pen Tablet

2008-03-23 Thread Michael Stone
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 */
-