From: Michael Poole Date: Mon, 5 Jul 2010 14:50:09 +0000 (-0400) Subject: HID: magicmouse: Correct parsing of large X and Y motions. X-Git-Tag: v2.6.36-rc1~567^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d876c05fa6cf82f0274f27276d981ed325697a5;p=platform%2Fkernel%2Flinux-3.10.git HID: magicmouse: Correct parsing of large X and Y motions. 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 Acked-by: Chase Douglas Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index ee78787..319b0e5 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -285,8 +285,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