From patchwork Sun Sep 5 15:16:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Poole X-Patchwork-Id: 156691 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o85FGloF016256 for ; Sun, 5 Sep 2010 15:16:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751966Ab0IEPQr (ORCPT ); Sun, 5 Sep 2010 11:16:47 -0400 Received: from na3sys009aog109.obsmtp.com ([74.125.149.201]:43271 "HELO na3sys009aog109.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752430Ab0IEPQq (ORCPT ); Sun, 5 Sep 2010 11:16:46 -0400 Received: from source ([209.85.216.48]) by na3sys009aob109.postini.com ([74.125.148.12]) with SMTP ID DSNKTIO0XTJRqsYBe7h+qGyPA1xsWELD+dJK@postini.com; Sun, 05 Sep 2010 08:16:46 PDT Received: by qwk3 with SMTP id 3so3353071qwk.7 for ; Sun, 05 Sep 2010 08:16:45 -0700 (PDT) Received: by 10.224.11.129 with SMTP id t1mr751785qat.263.1283699804915; Sun, 05 Sep 2010 08:16:44 -0700 (PDT) Received: from [172.16.1.1] (pool-74-96-175-150.washdc.fios.verizon.net [74.96.175.150]) by mx.google.com with ESMTPS id t24sm4520669qcs.11.2010.09.05.08.16.43 (version=SSLv3 cipher=RC4-MD5); Sun, 05 Sep 2010 08:16:43 -0700 (PDT) Subject: [RFC PATCH] hid-magicmouse: Map inputs rather than munging input devices From: Michael Poole To: Jiri Slaby Cc: Chase Douglas , Jiri Kosina , Henrik Rydberg , Tejun Heo , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <4C80DB38.9040101@gmail.com> References: <1283306184-28833-1-git-send-email-chase.douglas@canonical.com> <1283306184-28833-2-git-send-email-chase.douglas@canonical.com> <4C7E94F6.9050806@gmail.com> <4C7F6E26.2030301@gmail.com> <4C80DB38.9040101@gmail.com> Date: Sun, 05 Sep 2010 11:16:41 -0400 Message-ID: <1283699801.26830.4.camel@graviton> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 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 (demeter1.kernel.org [140.211.167.41]); Sun, 05 Sep 2010 15:16:48 +0000 (UTC) diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 8791a08..3778f9b 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -278,14 +278,12 @@ static int magicmouse_raw_event(struct hid_device *hdev, struct input_dev *input = msc->input; int x = 0, y = 0, ii, clicks = 0, npoints; + /* Slightly paranoid, but "input" only gets set when our + * input_mapping sees the right field. */ + if (!input) + return 0; + switch (data[0]) { - case 0x10: - if (size != 6) - return 0; - x = (__s16)(data[2] | data[3] << 8); - y = (__s16)(data[4] | data[5] << 8); - clicks = data[1]; - break; case TRACKPAD_REPORT_ID: /* Expect four bytes of prefix, and N*9 bytes of touch data. */