浏览代码

Input: appletouch - fix idle reset logic

Idle count should only be incremented when touchpad button
is not pressed, otherwise reset may happen at a wrong time
and touchpad will never report button release event.

Signed-off-by: Thomas Rohwer <trohwer@tng.de>
Acked-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Thomas Rohwer 17 年之前
父节点
当前提交
cb56073767
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      drivers/input/mouse/appletouch.c

+ 4 - 2
drivers/input/mouse/appletouch.c

@@ -328,6 +328,7 @@ static void atp_complete(struct urb* urb)
 {
 {
 	int x, y, x_z, y_z, x_f, y_f;
 	int x, y, x_z, y_z, x_f, y_f;
 	int retval, i, j;
 	int retval, i, j;
+	int key;
 	struct atp *dev = urb->context;
 	struct atp *dev = urb->context;
 
 
 	switch (urb->status) {
 	switch (urb->status) {
@@ -468,6 +469,7 @@ static void atp_complete(struct urb* urb)
 			      ATP_XFACT, &x_z, &x_f);
 			      ATP_XFACT, &x_z, &x_f);
 	y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS,
 	y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS,
 			      ATP_YFACT, &y_z, &y_f);
 			      ATP_YFACT, &y_z, &y_f);
+	key = dev->data[dev->datalen - 1] & 1;
 
 
 	if (x && y) {
 	if (x && y) {
 		if (dev->x_old != -1) {
 		if (dev->x_old != -1) {
@@ -505,7 +507,7 @@ static void atp_complete(struct urb* urb)
 		   the first touch unless reinitialised. Do so if it's been
 		   the first touch unless reinitialised. Do so if it's been
 		   idle for a while in order to avoid waking the kernel up
 		   idle for a while in order to avoid waking the kernel up
 		   several hundred times a second */
 		   several hundred times a second */
-		if (atp_is_geyser_3(dev)) {
+		if (!key && atp_is_geyser_3(dev)) {
 			dev->idlecount++;
 			dev->idlecount++;
 			if (dev->idlecount == 10) {
 			if (dev->idlecount == 10) {
 				dev->valid = 0;
 				dev->valid = 0;
@@ -514,7 +516,7 @@ static void atp_complete(struct urb* urb)
 		}
 		}
 	}
 	}
 
 
-	input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen - 1] & 1);
+	input_report_key(dev->input, BTN_LEFT, key);
 	input_sync(dev->input);
 	input_sync(dev->input);
 
 
 exit:
 exit: