diff mbox

[1/1] Input: elantech: Correct the sign of the x/y movement for trackpoint

Message ID 1409081423-2259-1-git-send-email-ulrik.debie-os@e2big.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ulrik De Bie Aug. 26, 2014, 7:30 p.m. UTC
Hi Dmitry,

Thank you for your feedback !

The x/y movement calculation was wrong, probably caused by my wrong documentation at the beginning of the elantech_report_trackpoint function.
When applying this patch to your patch, it works.

Thanks !
--
Ulrik

Input: elantech: Correct the sign of the x/y movement for trackpoint

From: Ulrik De Bie <ulrik.debie-os@e2big.org>

The sign bit in the documentation of the trackpoint x/y movement is corrected.
The sign bit in the calculation of the x/y movement for trackpoint is corrected.

Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org>
---
 drivers/input/mouse/elantech.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Dmitry Torokhov Aug. 26, 2014, 10:45 p.m. UTC | #1
Hi Ulrik,

On Tue, Aug 26, 2014 at 09:30:23PM +0200, Ulrik De Bie wrote:
> Hi Dmitry,
> 
> Thank you for your feedback !
> 
> The x/y movement calculation was wrong, probably caused by my wrong
> documentation at the beginning of the elantech_report_trackpoint
> function.  When applying this patch to your patch, it works.

Thank you for testing and providing both the original patch and the
fixup. I folded everything together and applied, I'll try to get it in
3.17.

Thanks!
diff mbox

Patch

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b4d645a..63533e5 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -408,10 +408,10 @@  static void elantech_report_trackpoint(struct psmouse *psmouse,
 				       int packet_type)
 {
 	/*
-	 * byte 0:  0   0 ~sx ~sy   0   M   R   L
-	 * byte 1: sx   0   0   0   0   0   0   0
-	 * byte 2: sy   0   0   0   0   0   0   0
-	 * byte 3:  0   0  sy  sx   0   1   1   0
+	 * byte 0:  0   0  sx  sy   0   M   R   L
+	 * byte 1:~sx   0   0   0   0   0   0   0
+	 * byte 2:~sy   0   0   0   0   0   0   0
+	 * byte 3:  0   0 ~sy ~sx   0   1   1   0
 	 * byte 4: x7  x6  x5  x4  x3  x2  x1  x0
 	 * byte 5: y7  y6  y5  y4  y3  y2  y1  y0
 	 *
@@ -443,8 +443,8 @@  static void elantech_report_trackpoint(struct psmouse *psmouse,
 	case 0x16008020U:
 	case 0x26800010U:
 	case 0x36808000U:
-		x = packet[4] - (int)(packet[1] << 1);
-		y = (int)(packet[2] << 1) - packet[5];
+		x = packet[4] - (int)((packet[1]^0x80) << 1);
+		y = (int)((packet[2]^0x80) << 1) - packet[5];
 
 		input_report_key(tp_dev, BTN_LEFT, packet[0] & 0x01);
 		input_report_key(tp_dev, BTN_RIGHT, packet[0] & 0x02);