All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hid-magicmouse: Correct parsing of large X and Y motions.
@ 2010-07-05 14:50 Michael Poole
  2010-07-05 16:28 ` Chase Douglas
  2010-07-05 19:54 ` Ping Cheng
  0 siblings, 2 replies; 14+ messages in thread
From: Michael Poole @ 2010-07-05 14:50 UTC (permalink / raw)
  To: Jiri Kosina, Chase Douglas; +Cc: linux-input

The X and Y values have two more significant bits in the same byte
that contains click status.  Include these in the reported value.
Thanks to Iain Hibbert of NetBSD for pointing this out.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
---
 drivers/hid/hid-magicmouse.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 0b89c1c..7cdda23 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -267,8 +267,8 @@ static int magicmouse_raw_event(struct hid_device *hdev,
 		 * to have the current touch information before
 		 * generating a click event.
 		 */
-		x = (signed char)data[1];
-		y = (signed char)data[2];
+		x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22;
+		y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22;
 		clicks = data[3];
 		break;
 	case 0x20: /* Theoretically battery status (0-100), but I have
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-07-11 21:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-05 14:50 [PATCH] hid-magicmouse: Correct parsing of large X and Y motions Michael Poole
2010-07-05 16:28 ` Chase Douglas
2010-07-11 21:07   ` Jiri Kosina
2010-07-05 19:54 ` Ping Cheng
2010-07-05 20:02   ` Chase Douglas
2010-07-05 20:33     ` Michael Poole
2010-07-05 20:51       ` Chase Douglas
2010-07-05 22:08         ` Michael Poole
2010-07-05 22:25           ` Chase Douglas
2010-07-06 11:23           ` ext-phil.2.carmody
2010-07-06 11:38             ` Datta, Shubhrajyoti
2010-07-06 11:55             ` Michael Poole
2010-07-06 13:05               ` ext-phil.2.carmody
2010-07-05 22:51   ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.