public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: vojtech@suse.cz, linux-kernel@vger.kernel.org, <dtor_core@ameritech.net>
Subject: Re: Touchpad problems with 2.6.11-rc2
Date: 02 Feb 2005 21:57:39 +0100	[thread overview]
Message-ID: <m3lla64r3w.fsf@telia.com> (raw)
In-Reply-To: <20050201234148.4d5eac55@localhost.localdomain>

Pete Zaitcev <zaitcev@redhat.com> writes:

> On 30 Jan 2005 12:10:34 +0100, Peter Osterlund <petero2@telia.com> 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:

Please try this patch instead. It works well with my alps touchpad. (I
don't have a synaptics touchpad.) It does the following:

* Compensates for the lack of floating point arithmetic by keeping
  track of remainders from the integer divisions.
* Removes the xres/yres scaling so that you get the same speed in the
  X and Y directions even if your screen is not square.
* Sets scale factors so that the speed for synaptics and alps should
  be equal to each other and equal to the synaptics speed from 2.6.10.

Signed-off-by: Peter Osterlund <petero2@telia.com>
---

 linux-petero/drivers/input/mousedev.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff -puN drivers/input/mousedev.c~mousedev-roundoff drivers/input/mousedev.c
--- linux/drivers/input/mousedev.c~mousedev-roundoff	2005-02-02 20:54:23.000000000 +0100
+++ linux-petero/drivers/input/mousedev.c	2005-02-02 21:42:39.000000000 +0100
@@ -71,6 +71,7 @@ struct mousedev {
 	struct mousedev_hw_data packet;
 	unsigned int pkt_count;
 	int old_x[4], old_y[4];
+	int frac_dx, frac_dy;
 	unsigned long touch;
 };
 
@@ -117,24 +118,31 @@ static struct mousedev mousedev_mix;
 
 static void mousedev_touchpad_event(struct input_dev *dev, struct mousedev *mousedev, unsigned int code, int value)
 {
-	int size;
+	int size, tmp;
+#define FRACTION_DENOM 100
 
 	if (mousedev->touch) {
+		size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
+		if (size == 0) size = xres;
 		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);
+				if (mousedev->pkt_count >= 2) {
+					tmp = ((fx(0) - fx(2)) * (250 * 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:
-				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);
+				if (mousedev->pkt_count >= 2) {
+					tmp = -((fy(0) - fy(2)) * (250 * FRACTION_DENOM)) / size;
+					tmp += mousedev->frac_dy;
+					mousedev->packet.dy = tmp / FRACTION_DENOM;
+					mousedev->frac_dy = tmp - mousedev->packet.dy * FRACTION_DENOM;
+				}
 				break;
 		}
 	}
_

-- 
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340

  parent reply	other threads:[~2005-02-02 21:01 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-24  3:01 Touchpad problems with 2.6.11-rc2 Pete Zaitcev
2005-01-30 11:10 ` Peter Osterlund
2005-01-31 23:15   ` Pete Zaitcev
2005-02-01  3:40     ` Dmitry Torokhov
2005-02-01  5:06       ` Pete Zaitcev
2005-02-01  5:14         ` Dmitry Torokhov
2005-02-03 11:18           ` Giuseppe Bilotta
2005-02-02  7:41   ` Pete Zaitcev
2005-02-02 10:20     ` Vojtech Pavlik
2005-02-02 15:51       ` Dmitry Torokhov
2005-02-02 15:57         ` Vojtech Pavlik
2005-02-02 16:56       ` Pete Zaitcev
2005-02-02 17:07         ` Vojtech Pavlik
2005-02-02 17:58           ` Pete Zaitcev
2005-02-02 19:11             ` Vojtech Pavlik
2005-02-02 19:39               ` Pete Zaitcev
2005-02-02 19:55                 ` Vojtech Pavlik
2005-02-02 19:39             ` Dmitry Torokhov
2005-02-03  8:30             ` Alexandre Oliva
2005-02-03  8:49               ` Vojtech Pavlik
2005-02-03 15:17                 ` Alexandre Oliva
2005-02-03 15:28                   ` Dmitry Torokhov
2005-02-03 15:45                     ` Vojtech Pavlik
2005-02-02 20:57     ` Peter Osterlund [this message]
2005-02-02 21:17       ` Dmitry Torokhov
2005-02-02 21:47         ` Peter Osterlund
2005-02-02 22:06           ` Dmitry Torokhov
2005-02-02 22:27             ` Peter Osterlund
2005-02-03  7:16               ` Dmitry Torokhov
2005-02-02 21:37       ` David Ford
2005-02-02 22:11       ` Pete Zaitcev
2005-02-02 22:58         ` Peter Osterlund
2005-02-03  6:46           ` Vojtech Pavlik
2005-02-03 21:54             ` Peter Osterlund
2005-02-04  6:17               ` Vojtech Pavlik
2005-02-04  6:40                 ` Peter Osterlund
2005-02-04  6:53                   ` Vojtech Pavlik
2005-02-04  7:33                     ` Peter Osterlund
2005-02-04 13:25                   ` Vojtech Pavlik
2005-02-04 13:23               ` Vojtech Pavlik
2005-02-03  6:59           ` Pete Zaitcev
  -- strict thread matches above, loose matches on Subject: below --
2005-01-25 19:55 David Brownell
2005-01-25 21:30 ` Dmitry Torokhov
2005-01-30 11:20   ` Peter Osterlund
2005-01-30 20:59     ` David Brownell
2005-01-31 21:46   ` Pete Zaitcev
2005-01-31 22:00     ` Dmitry Torokhov
2005-02-08 10:55 Stephane Raimbault
2005-02-08 17:05 ` Peter Osterlund
2005-02-09  8:47   ` Stephane Raimbault
2005-02-09 18:09     ` Peter Osterlund
2005-02-10  8:32       ` Stephane Raimbault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3lla64r3w.fsf@telia.com \
    --to=petero2@telia.com \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    --cc=zaitcev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox