Commit 7d876c05 authored by Michael Poole's avatar Michael Poole Committed by Jiri Kosina

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: default avatarMichael Poole <mdpoole@troilus.org>
Acked-by: default avatarChase Douglas <chase.douglas@canonical.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent e3612e86
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment