diff options
author | Michael Poole <mdpoole@troilus.org> | 2010-07-05 10:50:09 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-07-11 17:06:14 -0400 |
commit | 7d876c05fa6cf82f0274f27276d981ed325697a5 (patch) | |
tree | 3470e4084de463e962ccd2d7b39fb41a850508bb /drivers/hid | |
parent | e3612e8669b8c15278058f8dd52e3dc6e7d26710 (diff) |
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 <mdpoole@troilus.org>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | 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 ee7878785955..319b0e57ee41 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, | |||
285 | * to have the current touch information before | 285 | * to have the current touch information before |
286 | * generating a click event. | 286 | * generating a click event. |
287 | */ | 287 | */ |
288 | x = (signed char)data[1]; | 288 | x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22; |
289 | y = (signed char)data[2]; | 289 | y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22; |
290 | clicks = data[3]; | 290 | clicks = data[3]; |
291 | break; | 291 | break; |
292 | case 0x20: /* Theoretically battery status (0-100), but I have | 292 | case 0x20: /* Theoretically battery status (0-100), but I have |