From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Andrew Morton <akpm@osdl.org>, GCS <gcs@lsc.hu>
Cc: linux-kernel@vger.kernel.org, Peter Osterlund <petero2@telia.com>
Subject: Re: 2.6.0-mm1 - Patch 1/2 - mousedev-remove-jitter
Date: Thu, 25 Dec 2003 04:13:30 -0500 [thread overview]
Message-ID: <200312250413.32822.dtor_core@ameritech.net> (raw)
In-Reply-To: <200312250411.55881.dtor_core@ameritech.net>
===================================================================
ChangeSet@1.1522, 2003-12-23 02:24:12-05:00, dtor_core@ameritech.net
Input: when calculating deltas for touchpads that generate
absolute events use average over the last 3 packets
to remove jitter
mouse/synaptics.c | 11 ++++---
mousedev.c | 84 +++++++++++++++++++++++++++++++-----------------------
2 files changed, 56 insertions(+), 39 deletions(-)
===================================================================
diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
--- a/drivers/input/mouse/synaptics.c Thu Dec 25 03:58:14 2003
+++ b/drivers/input/mouse/synaptics.c Thu Dec 25 03:58:14 2003
@@ -553,15 +553,18 @@
finger_width = 0;
}
- /* Post events */
+ /* Post events
+ * BTN_TOUCH has to be first as mousedev relies on it when doing
+ * absolute -> relative conversion
+ */
+ if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
+ if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);
+
if (hw.z > 0) {
input_report_abs(dev, ABS_X, hw.x);
input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
}
input_report_abs(dev, ABS_PRESSURE, hw.z);
-
- if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
- if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);
input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c Thu Dec 25 03:58:14 2003
+++ b/drivers/input/mousedev.c Thu Dec 25 03:58:14 2003
@@ -53,12 +53,14 @@
struct fasync_struct *fasync;
struct mousedev *mousedev;
struct list_head node;
- int dx, dy, dz, oldx, oldy;
- signed char ps2[6];
+ int dx, dy, dz;
+ int old_x[4], old_y[4];
unsigned long buttons;
+ signed char ps2[6];
unsigned char ready, buffer, bufsiz;
unsigned char mode, imexseq, impsseq;
- int finger;
+ unsigned int pkt_count;
+ unsigned char touch;
};
#define MOUSEDEV_SEQ_LEN 6
@@ -74,49 +76,49 @@
static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X;
static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y;
+#define fx(i) (list->old_x[(list->pkt_count - (i)) & 03])
+#define fy(i) (list->old_y[(list->pkt_count - (i)) & 03])
+
static void mousedev_abs_event(struct input_handle *handle, struct mousedev_list *list, unsigned int code, int value)
{
int size;
+ int touchpad;
/* Ignore joysticks */
if (test_bit(BTN_TRIGGER, handle->dev->keybit))
return;
- /* Handle touchpad data */
- if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
+ touchpad = test_bit(BTN_TOOL_FINGER, handle->dev->keybit);
- if (list->finger && list->finger < 3)
- list->finger++;
-
- switch (code) {
- case ABS_X:
- if (list->finger == 3)
- list->dx += (value - list->oldx) / 8;
- list->oldx = value;
- return;
- case ABS_Y:
- if (list->finger == 3)
- list->dy -= (value - list->oldy) / 8;
- list->oldy = value;
- return;
- }
- return;
- }
-
- /* Handle tablet data */
switch (code) {
case ABS_X:
- size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
- if (size == 0) size = xres;
- list->dx += (value * xres - list->oldx) / size;
- list->oldx += list->dx * size;
- return;
+ if (touchpad) {
+ if (list->touch) {
+ fx(0) = value;
+ if (list->pkt_count >= 2)
+ list->dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8;
+ }
+ } else {
+ size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
+ if (size == 0) size = xres;
+ list->dx += (value * xres - list->old_x[0]) / size;
+ list->old_x[0] += list->dx * size;
+ }
+ break;
case ABS_Y:
- size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
- if (size == 0) size = yres;
- list->dy -= (value * yres - list->oldy) / size;
- list->oldy -= list->dy * size;
- return;
+ if (touchpad) {
+ if (list->touch) {
+ fy(0) = value;
+ if (list->pkt_count >= 2)
+ list->dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8;
+ }
+ } else {
+ size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
+ if (size == 0) size = yres;
+ list->dy -= (value * yres - list->old_y[0]) / size;
+ list->old_y[0] -= list->dy * size;
+ }
+ break;
}
}
@@ -149,7 +151,9 @@
switch (code) {
case BTN_TOUCH: /* Handle touchpad data */
if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
- list->finger = value;
+ list->touch = value;
+ if (!list->touch)
+ list->pkt_count = 0;
return;
}
case BTN_0:
@@ -178,6 +182,16 @@
case EV_SYN:
switch (code) {
case SYN_REPORT:
+ if (list->touch) {
+ list->pkt_count++;
+ /* Input system eats duplicate events,
+ * but we need all of them to do correct
+ * averaging so apply present one forward
+ */
+ fx(0) = fx(1);
+ fy(0) = fy(1);
+ }
+
list->ready = 1;
kill_fasync(&list->fasync, SIGIO, POLL_IN);
wake = 1;
next prev parent reply other threads:[~2003-12-25 9:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-24 9:59 2.6.0-mm1 GCS
2003-12-24 11:32 ` 2.6.0-mm1 Andrew Morton
2003-12-24 11:53 ` 2.6.0-mm1 GCS
2003-12-24 12:23 ` 2.6.0-mm1 GCS
2003-12-24 15:17 ` 2.6.0-mm1 Dmitry Torokhov
2003-12-24 19:12 ` 2.6.0-mm1 GCS
2003-12-24 12:47 ` 2.6.0-mm1 Thomas Molina
2003-12-25 9:11 ` 2.6.0-mm1 Dmitry Torokhov
2003-12-25 9:13 ` Dmitry Torokhov [this message]
2003-12-25 9:14 ` 2.6.0-mm1 - Patch 2/2 - mousedev-dont-stop Dmitry Torokhov
2003-12-27 11:38 ` Synaptics problems in -mm1 Tomas Szepe
2003-12-27 12:24 ` GCS
2003-12-27 13:22 ` Tomas Szepe
2003-12-27 17:28 ` Dmitry Torokhov
2003-12-27 18:11 ` Tomas Szepe
2003-12-27 18:23 ` Dmitry Torokhov
2003-12-27 18:37 ` Tomas Szepe
2003-12-27 18:45 ` Dmitry Torokhov
2003-12-27 19:01 ` Tomas Szepe
2003-12-27 21:00 ` Dmitry Torokhov
2003-12-28 0:00 ` Andrew Morton
2003-12-28 0:45 ` Dmitry Torokhov
2003-12-28 1:21 ` Tomas Szepe
2003-12-27 17:56 ` Marcos D. Marado Torres
2003-12-27 20:59 ` Dmitry Torokhov
2003-12-25 18:22 ` 2.6.0-mm1 GCS
2003-12-24 14:38 ` 2.6.0-mm1 GCS
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=200312250413.32822.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=akpm@osdl.org \
--cc=gcs@lsc.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=petero2@telia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.