From patchwork Tue Aug 23 08:53:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 1087752 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 p7N8r9PE026512 for ; Tue, 23 Aug 2011 08:53:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754290Ab1HWIxJ (ORCPT ); Tue, 23 Aug 2011 04:53:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53561 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752768Ab1HWIxI (ORCPT ); Tue, 23 Aug 2011 04:53:08 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 3F8088B013; Tue, 23 Aug 2011 10:53:07 +0200 (CEST) Date: Tue, 23 Aug 2011 10:53:06 +0200 (CEST) From: Jiri Kosina To: Jaikumar Ganesh Cc: Chase Douglas , linux-input@vger.kernel.org Subject: Re: [PATCH] HID: magicmouse: ignore 'ivalid report id' while switching modes In-Reply-To: Message-ID: References: <1313611182-19924-1-git-send-email-jaikumarg@android.com> <4E4D3CFC.7000700@canonical.com> <4E4D426F.607@canonical.com> <4E4D68B0.8000703@canonical.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 23 Aug 2011 08:53:10 +0000 (UTC) On Thu, 18 Aug 2011, Jaikumar Ganesh wrote: > I also tracked down two Apple magic trackpads - both with the same > Bluetooth version. > One which needs this patch (as it returns an invalid report id) and > the other which doesn't need this patch. > Both use the same device id. Gotta love hardware vendors indeed. So how about the patch below? From: Jiri Kosina Subject: [PATCH] HID: magicmouse: ignore 'ivalid report id' while switching modes, v2 This is basically a more generic respin of 23746a6 ("HID: magicmouse: ignore 'ivalid report id' while switching modes") which got reverted later by c3a492. It turns out that on some configurations, this is actually still the case and we are not able to detect in runtime. The device reponds with 'invalid report id' when feature report switching it into multitouch mode is sent to it. This has been silently ignored before 0825411ade ("HID: bt: Wait for ACK on Sent Reports"), but since this commit, it propagates -EIO from the _raw callback . So let the driver ignore -EIO as response to 0xd7,0x01 report, as that's how the device reacts in normal mode. Sad, but following reality. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=35022 Reported-by: Chase Douglas Reported-by: Jaikumar Ganesh Tested-by: Chase Douglas Signed-off-by: Jiri Kosina --- 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 b5bdab3..f0fbd7b 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -537,9 +537,17 @@ static int magicmouse_probe(struct hid_device *hdev, } report->size = 6; + /* + * Some devices repond 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 && ret != sizeof(feature)) { hid_err(hdev, "unable to request touch data (%d)\n", ret); goto err_stop_hw; }