summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches-2.6.24/1287-soft_tap.patch.patch
blob: c73dd5e8d9cfa4eb716d362ca8716901bffa6c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From eff39cde0d3cdd2afd5e1b4be5a8eb6cf195543e Mon Sep 17 00:00:00 2001
From: Dima Kogan <dkogan@cds.caltech.edu>
Date: Thu, 11 Sep 2008 20:38:55 +0800
Subject: [PATCH] soft_tap.patch

Hi all.

I'm seeing a behavior in my freerunner where light taps on the
touchscreen are not registered as clicks by the kernel even though the
base hardware does report clicking events. I'm seeing the kernel
generate extra "unclick" events in these cases. It looks like in the
driver, an unclick event is processed before the click event, thus
suppressing the click from ever being generated. I'm attaching a patch
that addresses this. I'm now able to type much faster on the matchbox
keyboard, even when using my fingertips instead of fingernails.

Dima

Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu>
---
 drivers/input/touchscreen/s3c2410_ts.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 9fb95c1..fc1c500 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -118,6 +118,7 @@ struct s3c2410ts {
 	struct s3c2410ts_sample raw_running_avg;
 	int reject_threshold_vs_avg;
 	int flag_previous_exceeded_threshold;
+	int flag_first_touch_sent;
 };
 
 static struct s3c2410ts ts;
@@ -130,6 +131,7 @@ static void clear_raw_fifo(void)
 	ts.raw_running_avg.x = 0;
 	ts.raw_running_avg.y = 0;
 	ts.flag_previous_exceeded_threshold = 0;
+	ts.flag_first_touch_sent = 0;
 }
 
 
@@ -153,6 +155,19 @@ static void touch_timer_fire(unsigned long data)
 	updown = (!(data0 & S3C2410_ADCDAT0_UPDOWN)) &&
 					    (!(data1 & S3C2410_ADCDAT0_UPDOWN));
 
+	// if we need to send an untouch event, but we haven't yet sent the
+	// touch event (this happens if the touchscreen was tapped lightly),
+	// send the touch event first
+	if (!updown && !ts.flag_first_touch_sent && ts.count != 0) {
+		input_report_abs(ts.dev, ABS_X, ts.xp >> ts.shift);
+		input_report_abs(ts.dev, ABS_Y, ts.yp >> ts.shift);
+
+		input_report_key(ts.dev, BTN_TOUCH, 1);
+		input_report_abs(ts.dev, ABS_PRESSURE, 1);
+		input_sync(ts.dev);
+		ts.flag_first_touch_sent = 1;
+	}
+
 	if (updown) {
 		if (ts.count != 0) {
 			ts.xp >>= ts.shift;
@@ -174,6 +189,7 @@ static void touch_timer_fire(unsigned long data)
 			input_report_key(ts.dev, BTN_TOUCH, 1);
 			input_report_abs(ts.dev, ABS_PRESSURE, 1);
 			input_sync(ts.dev);
+			ts.flag_first_touch_sent = 1;
 		}
 
 		ts.xp = 0;
@@ -190,6 +206,7 @@ static void touch_timer_fire(unsigned long data)
 		input_report_key(ts.dev, BTN_TOUCH, 0);
 		input_report_abs(ts.dev, ABS_PRESSURE, 0);
 		input_sync(ts.dev);
+		ts.flag_first_touch_sent = 0;
 
 		writel(WAIT4INT(0), base_addr+S3C2410_ADCTSC);
 	}
-- 
1.5.6.5