linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/9] input: mousedev: distinguish a moving finger from a tapping finger
@ 2009-05-12 20:43 akpm
  2009-05-14  3:22 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2009-05-12 20:43 UTC (permalink / raw)
  To: dtor; +Cc: linux-input, akpm, rydberg

From: Henrik Rydberg <rydberg@euromail.se>

The tap functionality of mousedev does not distinguish between a tap
(on/off localized in time and space) and a quick move (on/off localized in
time only).  This patch improves the tap detection by testing also for
space locality.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/input/mousedev.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff -puN drivers/input/mousedev.c~input-mousedev-distinguish-a-moving-finger-from-a-tapping-finger drivers/input/mousedev.c
--- a/drivers/input/mousedev.c~input-mousedev-distinguish-a-moving-finger-from-a-tapping-finger
+++ a/drivers/input/mousedev.c
@@ -49,6 +49,10 @@ static unsigned tap_time = 200;
 module_param(tap_time, uint, 0644);
 MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)");
 
+static unsigned tap_move = 20;
+module_param(tap_move, uint, 0644);
+MODULE_PARM_DESC(tap_move, "Tap distance for touchpads in absolute mode (res)");
+
 struct mousedev_hw_data {
 	int dx, dy, dz;
 	int x, y;
@@ -75,6 +79,7 @@ struct mousedev {
 	int old_x[4], old_y[4];
 	int frac_dx, frac_dy;
 	unsigned long touch;
+	int touch_dx, touch_dy;
 };
 
 enum mousedev_emul {
@@ -142,6 +147,7 @@ static void mousedev_touchpad_event(stru
 			tmp = ((value - fx(2)) * 256 * FRACTION_DENOM) / size;
 			tmp += mousedev->frac_dx;
 			mousedev->packet.dx = tmp / FRACTION_DENOM;
+			mousedev->touch_dx += mousedev->packet.dx;
 			mousedev->frac_dx =
 				tmp - mousedev->packet.dx * FRACTION_DENOM;
 		}
@@ -157,6 +163,7 @@ static void mousedev_touchpad_event(stru
 			tmp = -((value - fy(2)) * 256 * FRACTION_DENOM) / size;
 			tmp += mousedev->frac_dy;
 			mousedev->packet.dy = tmp / FRACTION_DENOM;
+			mousedev->touch_dy += mousedev->packet.dy;
 			mousedev->frac_dy = tmp -
 				mousedev->packet.dy * FRACTION_DENOM;
 		}
@@ -319,6 +326,8 @@ static void mousedev_touchpad_touch(stru
 {
 	if (!value) {
 		if (mousedev->touch &&
+		    abs(mousedev->touch_dx) < tap_move &&
+		    abs(mousedev->touch_dy) < tap_move &&
 		    time_before(jiffies,
 				mousedev->touch + msecs_to_jiffies(tap_time))) {
 			/*
@@ -335,6 +344,7 @@ static void mousedev_touchpad_touch(stru
 			clear_bit(0, &mousedev_mix->packet.buttons);
 		}
 		mousedev->touch = mousedev->pkt_count = 0;
+		mousedev->touch_dx = mousedev->touch_dy = 0;
 		mousedev->frac_dx = 0;
 		mousedev->frac_dy = 0;
 
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 1/9] input: mousedev: distinguish a moving finger from a tapping finger
  2009-05-12 20:43 [patch 1/9] input: mousedev: distinguish a moving finger from a tapping finger akpm
@ 2009-05-14  3:22 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2009-05-14  3:22 UTC (permalink / raw)
  To: akpm; +Cc: linux-input, rydberg

Hi Andrew,

On Tue, May 12, 2009 at 01:43:04PM -0700, akpm@linux-foundation.org wrote:
> From: Henrik Rydberg <rydberg@euromail.se>
> 
> The tap functionality of mousedev does not distinguish between a tap
> (on/off localized in time and space) and a quick move (on/off localized in
> time only).  This patch improves the tap detection by testing also for
> space locality.
> 

I will not be applying this patch. Mousedev is legacy interface and we
should not be extending it; synaptics X driver does properly handle
advanced touchpad and is included in every [major] distribution.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-14  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-12 20:43 [patch 1/9] input: mousedev: distinguish a moving finger from a tapping finger akpm
2009-05-14  3:22 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).