Thread (11 messages) 11 messages, 3 authors, 2010-10-18

[PATCH 3/3] Input: touchscreen: ad7877 filter events where pressure is beyond the maximum

From: <michael.hennerich@analog.com>
Date: 2010-10-15 10:47:34
Subsystem: ad7877 touchscreen driver, input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Michael Hennerich, Dmitry Torokhov, Linus Torvalds

From: Michael Hennerich <michael.hennerich@analog.com>

Suppress events where pressure > pressure_max.
These events come typically along with inaccurate X and Y samples.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
 drivers/input/touchscreen/ad7877.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 96c0a0d..e6917db 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -360,6 +360,13 @@ static int ad7877_rx(struct ad7877 *ts)
 		Rt /= z1;
 		Rt = (Rt + 2047) >> 12;
 
+		/*
+		 * Sample found inconsistent, pressure is beyond
+		 * the maximum. Don't report it to user space.
+		 */
+	 	if (Rt > ts->pressure_max)
+	 		return -EINVAL;
+
 		if (!timer_pending(&ts->timer))
 			input_report_key(input_dev, BTN_TOUCH, 1);
 
-- 
1.6.0.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help