From 940bf2a972a93c009b8ab18c92c472abe6f9f57c Mon Sep 17 00:00:00 2001
From: Bernardo Innocenti <bernie@codewiz.org>
Date: Thu, 20 Dec 2007 17:51:59 +0100
Subject: [PATCH] Fix cursor occasionally jumping to the bottom right corner of the screen (OLPC#2804)
Organization: One Laptop Per Child

---
 drivers/input/mouse/olpc.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/olpc.c b/drivers/input/mouse/olpc.c
index 6bace2f..9479658 100644
--- a/drivers/input/mouse/olpc.c
+++ b/drivers/input/mouse/olpc.c
@@ -148,8 +148,17 @@ static void olpc_process_packet_gspt(struct psmouse *psmouse)
 		input_report_abs(dev, ABS_X, x);
 		input_report_abs(dev, ABS_Y, y);
 	} else if (psmouse->packet[0] == OLPC_PKT_GS && gs_down) {
-		input_report_abs(dev2, ABS_X, x);
-		input_report_abs(dev2, ABS_Y, y);
+		/*
+		 * The GS sometimes switches into a broken mode where it reports
+		 * two consecutive finger up events, with coordinates set to 0,0.
+		 * This creates a large delta and makes the cursor jump to the
+		 * bottom-right corner.
+		 * The simplest workaround is refusing to report movement to (0,0).
+		 */
+		if (x != 0 || y != 0) {
+			input_report_abs(dev2, ABS_X, x);
+			input_report_abs(dev2, ABS_Y, y);
+		}
 	}
 
 	input_sync(dev);
-- 
1.5.3.3

