From patchwork Mon Jul 5 14:50:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Poole X-Patchwork-Id: 110260 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o65EoERC022577 for ; Mon, 5 Jul 2010 14:51:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756396Ab0GEOuN (ORCPT ); Mon, 5 Jul 2010 10:50:13 -0400 Received: from na3sys009aog109.obsmtp.com ([74.125.149.201]:44762 "HELO na3sys009aog109.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754038Ab0GEOuN (ORCPT ); Mon, 5 Jul 2010 10:50:13 -0400 Received: from source ([209.85.160.172]) by na3sys009aob109.postini.com ([74.125.148.12]) with SMTP ID DSNKTDHxI/kxXG3hRPd6eLeK0NDd8QPdypRi@postini.com; Mon, 05 Jul 2010 07:50:12 PDT Received: by mail-gy0-f172.google.com with SMTP id 3so2567963gyh.3 for ; Mon, 05 Jul 2010 07:50:11 -0700 (PDT) Received: by 10.229.185.16 with SMTP id cm16mr1600319qcb.24.1278341411615; Mon, 05 Jul 2010 07:50:11 -0700 (PDT) Received: from graviton.troilus.org (pool-72-83-66-147.washdc.east.verizon.net [72.83.66.147]) by mx.google.com with ESMTPS id g33sm18431792qcq.28.2010.07.05.07.50.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 05 Jul 2010 07:50:10 -0700 (PDT) From: Michael Poole To: Jiri Kosina , Chase Douglas Cc: linux-input@vger.kernel.org Subject: [PATCH] hid-magicmouse: Correct parsing of large X and Y motions. Date: Mon, 05 Jul 2010 10:50:09 -0400 Message-ID: <878w5qaspq.fsf@troilus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 05 Jul 2010 14:51:48 +0000 (UTC) diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 0b89c1c..7cdda23 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -267,8 +267,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