Re: Touchpad problems with 2.6.11-rc2

From: Pete Zaitcev
Date: Wed Feb 02 2005 - 02:43:56 EST


On 30 Jan 2005 12:10:34 +0100, Peter Osterlund <petero2@xxxxxxxxx> wrote:

> > - Slow motion of finger produces no motion, then a jump. So, it's very hard to
> > target smaller UI elements and some web links.
>
> I see this too when I don't use the X touchpad driver. With the X
> driver there is no problem. I think the problem is that mousedev.c in
> the kernel has to use integer arithmetic, so probably small movements
> are rounded off to 0. I'll try to come up with a fix for this.

Thanks for the hint. I tried various schemes and mathematical transformations
and found one which gives unquestionably the best result, with smoothest, most
precise and comfortable pointer movement:

--- linux-2.6.11-rc2/drivers/input/mousedev.c 2005-01-22 14:54:14.000000000 -0800
+++ linux-2.6.11-rc2-lem/drivers/input/mousedev.c 2005-02-01 23:20:19.000000000 -0800
@@ -122,19 +122,19 @@ static void mousedev_touchpad_event(stru
if (mousedev->touch) {
switch (code) {
case ABS_X:
- size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
- if (size == 0) size = xres;
fx(0) = value;
if (mousedev->pkt_count >= 2)
- mousedev->packet.dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) * xres / (size * 2);
+ mousedev->packet.dx = (value - fx(2)) / 2;
+ else if (mousedev->pkt_count == 1)
+ mousedev->packet.dx = value - fx(1);
break;

case ABS_Y:
- size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y];
- if (size == 0) size = yres;
fy(0) = value;
if (mousedev->pkt_count >= 2)
- mousedev->packet.dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) * yres / (size * 2);
+ mousedev->packet.dy = (fy(2) - value) / 2;
+ else if (mousedev->pkt_count == 1)
+ mousedev->packet.dy = fy(1) - value;
break;
}
}

I'm not kidding. Someone obviously outsmarted himself when programming this.

-- Pete
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/