Skip to content

Commit

Permalink
HID: magicmouse: Correct parsing of large X and Y motions.
Browse files Browse the repository at this point in the history
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>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Michael Poole authored and Jiri Kosina committed Jul 11, 2010
1 parent e3612e8 commit 7d876c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hid/hid-magicmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d876c0

Please sign in to comment.