]> Git Repo - linux.git/commitdiff
HID: magicmouse: Correct parsing of large X and Y motions.
authorMichael Poole <[email protected]>
Mon, 5 Jul 2010 14:50:09 +0000 (10:50 -0400)
committerJiri Kosina <[email protected]>
Sun, 11 Jul 2010 21:06:14 +0000 (23:06 +0200)
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 <[email protected]>
Acked-by: Chase Douglas <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
drivers/hid/hid-magicmouse.c

index ee78787859555c3986ce72162027b641c1761975..319b0e57ee41f1cdbebafb833989b7a3507c7440 100644 (file)
@@ -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
This page took 0.058624 seconds and 4 git commands to generate.