Re: [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dmitry,

В сообщении от 19 февраля 2010 11:17:55 автор Dmitry Torokhov написал:

> I do not think this is right. Here you reset sampling data regardless
> of whether you got the right number of samples or not. You should repeat
> s3c_adc_start only if you got (1 << ts.shift) samples. But I think I see
> why touchpad may stop reporintg sometimes - if timer fires before you
> get the needed number of samples nothing will happen as timer is not
> gettign rearmed.

Problem is driver reports "stylus down" event when stylus is already up, 
anyway I agree that samples should not be discarded.

> >  	} else {
> >  	
> >  		ts.count = 0;
> 
> I also think this branch is missing ts.xp = ts.yp = 0;

Ok.

Fixed version is in attachment

Thanks for review.
From 3edbe60fdb0cd2c2d91046557fcd9ad4f8c3b69d Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@xxxxxxxxx>
Date: Fri, 19 Feb 2010 11:48:56 +0200
Subject: [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down

By default, driver reports touches when it gots (1 << ts.shift)
samples, even if stylus is up. This behavior looks wrong to me.
Patch makes driver to report touches only when stylus is down.

Signed-off-by: Vasily Khoruzhick <anarsoul@xxxxxxxxx>
---
 drivers/input/touchscreen/s3c2410_ts.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 6386b44..14afa0e 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -128,27 +128,29 @@ static void touch_timer_fire(unsigned long data)
 
 	down = get_down(data0, data1);
 
-	if (ts.count == (1 << ts.shift)) {
-		ts.xp >>= ts.shift;
-		ts.yp >>= ts.shift;
+	if (down) {
+		if (ts.count == (1 << ts.shift)) {
+			ts.xp >>= ts.shift;
+			ts.yp >>= ts.shift;
 
-		dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n",
-			__func__, ts.xp, ts.yp, ts.count);
+			dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n",
+				__func__, ts.xp, ts.yp, ts.count);
 
-		input_report_abs(ts.input, ABS_X, ts.xp);
-		input_report_abs(ts.input, ABS_Y, ts.yp);
+			input_report_abs(ts.input, ABS_X, ts.xp);
+			input_report_abs(ts.input, ABS_Y, ts.yp);
 
-		input_report_key(ts.input, BTN_TOUCH, 1);
-		input_sync(ts.input);
+			input_report_key(ts.input, BTN_TOUCH, 1);
+			input_sync(ts.input);
 
-		ts.xp = 0;
-		ts.yp = 0;
-		ts.count = 0;
-	}
+			ts.xp = 0;
+			ts.yp = 0;
+			ts.count = 0;
+		}
 
-	if (down) {
 		s3c_adc_start(ts.client, 0, 1 << ts.shift);
 	} else {
+		ts.xp = 0;
+		ts.yp = 0;
 		ts.count = 0;
 
 		input_report_key(ts.input, BTN_TOUCH, 0);
-- 
1.7.0

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux