[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200703252319.39676.dtor@insightbb.com>
Date: Sun, 25 Mar 2007 23:19:38 -0400
From: Dmitry Torokhov <dtor@...ightbb.com>
To: Pete Zaitcev <zaitcev@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-input@...ey.karlin.mff.cuni.cz
Subject: Re: Fix sudden warps in mousedev
On Sunday 25 March 2007 14:19, Pete Zaitcev wrote:
> On Sun, 25 Mar 2007 01:34:02 -0400, Dmitry Torokhov <dtor@...ightbb.com> wrote:
>
> > > + * Without this, a touchpad may report an unchanged position,
> > > + * then a sync. The input_event() eats the position report, but
> > > + * lets the sync through. We increment pkt_count and leave
> > > + * a stale position in the ring. If a future reference to fx(2)
> > > + * hits the stale position, a large dx is reported, and the
> > > + * pointer warps across the screen.
> > > + */
> > > + dev = mousedev->handle.dev;
> > > + fx(0) = dev->abs[ABS_X];
> > > + fy(0) = dev->abs[ABS_Y];
> >
> > I do not like input hanlders poking into input devices... Can't we just
> > reset pkt_count at the beginning of the touch to get rid of stale data?
>
> The pkt_count is zero at the moment of assignment above.
Riiight... Of course you are right...
I tried to reproduce warping on console but could not for some reason. Could you
please try the patch below and tell me if it fixes the problem for you?
--
Dmitry
Signed-off-by: Dmitry Torokhov <dtor@...l.ru>
---
drivers/input/mousedev.c | 51 +++++++++++++++++++++++------------------------
1 files changed, 26 insertions(+), 25 deletions(-)
Index: work/drivers/input/mousedev.c
===================================================================
--- work.orig/drivers/input/mousedev.c
+++ work/drivers/input/mousedev.c
@@ -124,32 +124,33 @@ static void mousedev_touchpad_event(stru
int size, tmp;
enum { FRACTION_DENOM = 128 };
- if (mousedev->touch) {
- size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
- if (size == 0)
- size = 256 * 2;
-
- switch (code) {
- case ABS_X:
- fx(0) = value;
- if (mousedev->pkt_count >= 2) {
- tmp = ((value - fx(2)) * (256 * FRACTION_DENOM)) / size;
- tmp += mousedev->frac_dx;
- mousedev->packet.dx = tmp / FRACTION_DENOM;
- mousedev->frac_dx = tmp - mousedev->packet.dx * FRACTION_DENOM;
- }
- break;
+ switch (code) {
+ case ABS_X:
+ fx(0) = value;
+ if (mousedev->touch && mousedev->pkt_count >= 2) {
+ size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
+ if (size == 0)
+ size = 256 * 2;
+ tmp = ((value - fx(2)) * (256 * FRACTION_DENOM)) / size;
+ tmp += mousedev->frac_dx;
+ mousedev->packet.dx = tmp / FRACTION_DENOM;
+ mousedev->frac_dx = tmp - mousedev->packet.dx * FRACTION_DENOM;
+ }
+ break;
- case ABS_Y:
- fy(0) = value;
- if (mousedev->pkt_count >= 2) {
- tmp = -((value - fy(2)) * (256 * FRACTION_DENOM)) / size;
- tmp += mousedev->frac_dy;
- mousedev->packet.dy = tmp / FRACTION_DENOM;
- mousedev->frac_dy = tmp - mousedev->packet.dy * FRACTION_DENOM;
- }
- break;
- }
+ case ABS_Y:
+ fy(0) = value;
+ if (mousedev->touch && mousedev->pkt_count >= 2) {
+ /* use X size to keep the same scale */
+ size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
+ if (size == 0)
+ size = 256 * 2;
+ tmp = -((value - fy(2)) * (256 * FRACTION_DENOM)) / size;
+ tmp += mousedev->frac_dy;
+ mousedev->packet.dy = tmp / FRACTION_DENOM;
+ mousedev->frac_dy = tmp - mousedev->packet.dy * FRACTION_DENOM;
+ }
+ break;
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists