From patchwork Wed Aug 17 19:59:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaikumar Ganesh X-Patchwork-Id: 1074942 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7HK0mm2026332 for ; Wed, 17 Aug 2011 20:01:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753808Ab1HQUAr (ORCPT ); Wed, 17 Aug 2011 16:00:47 -0400 Received: from smtp-out.google.com ([216.239.44.51]:16990 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753300Ab1HQUAr (ORCPT ); Wed, 17 Aug 2011 16:00:47 -0400 Received: from hpaq7.eem.corp.google.com (hpaq7.eem.corp.google.com [172.25.149.7]) by smtp-out.google.com with ESMTP id p7HJxwLo031477; Wed, 17 Aug 2011 12:59:58 -0700 Received: from jganesh.mtv.corp.google.com (jganesh.mtv.corp.google.com [172.18.103.9]) by hpaq7.eem.corp.google.com with ESMTP id p7HJxuBS003178; Wed, 17 Aug 2011 12:59:57 -0700 Received: by jganesh.mtv.corp.google.com (Postfix, from userid 25109) id E5BEF1A11F1; Wed, 17 Aug 2011 12:59:55 -0700 (PDT) From: Jaikumar Ganesh To: linux-input@vger.kernel.org Cc: Jiri Kosina , Jaikumar Ganesh Subject: [PATCH] HID: magicmouse: ignore 'ivalid report id' while switching modes Date: Wed, 17 Aug 2011 12:59:42 -0700 Message-Id: <1313611182-19924-1-git-send-email-jaikumarg@android.com> X-Mailer: git-send-email 1.7.3.1 X-System-Of-Record: true 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.6 (demeter1.kernel.org [140.211.167.41]); Wed, 17 Aug 2011 20:01:19 +0000 (UTC) From: Jiri Kosina 23746a introduced this commit but was reverted in c3a492. The trackpad uses report Ids which are not present in the report descriptor. These reports ids are not documented anywhere. There are devices in the market (Apple magic tracpkad, BT version 2.0 is one such device) with the same device id, which fail when we use 0xd7 as the report id. So we need the EIO change of 23746a as a failsafe to work with these devices. Original Author: Jiri Kosina Signed-off-by: Jaikumar Ganesh --- drivers/hid/hid-magicmouse.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 0ec91c1..a5eda4c 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -501,9 +501,17 @@ static int magicmouse_probe(struct hid_device *hdev, } report->size = 6; + /* + * The device reponds with 'invalid report id' when feature + * report switching it into multitouch mode is sent to it. + * + * This results in -EIO from the _raw low-level transport callback, + * but there seems to be no other way of switching the mode. + * Thus the super-ugly hacky success check below. + */ ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), HID_FEATURE_REPORT); - if (ret != sizeof(feature)) { + if (ret != -EIO) { hid_err(hdev, "unable to request touch data (%d)\n", ret); goto err_stop_hw; }