From patchwork Fri May 8 21:25:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 6367751 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D3FD2BEEE1 for ; Fri, 8 May 2015 21:26:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CE2920272 for ; Fri, 8 May 2015 21:26:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2215F2026F for ; Fri, 8 May 2015 21:26:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752809AbbEHV0F (ORCPT ); Fri, 8 May 2015 17:26:05 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:34418 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752391AbbEHV0E (ORCPT ); Fri, 8 May 2015 17:26:04 -0400 Received: by pacyx8 with SMTP id yx8so59518693pac.1 for ; Fri, 08 May 2015 14:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nZ8Hh+22Gb3P7KZXBU4ag5JfL9U6ybwz9jbEhQ2poI8=; b=y15a255dxvOcgypjeEM6DTApqqfezWLFODcz6Y5854k9bZIf1/X6S8v+A1lHtNGHiT CMCkyCZTaBM/QuIBxtRPOZ3FIvC2YXAyRj+ets3P9TryUmpS7nvt6tOulClnAZz91LO9 z1UCvC0TsNvvNXX8mjfqFzIXOAw2qrwik5KYdtuMWF6vYk7kjOkSZLppJ3QFF+nOFc1i tk3ZtHqE3tb0ILfmt7A+dvE96ds//+8bOyIwNCt+xrtdPEbItGdZ1kH2RB6LnZHqHACl L0cDcGM1a36wSfgd1PW5Z4Frv8+hiRUdaAkO0VA3U1NhNrISCHZV9x60MzUTDf/lBh+7 u+8A== X-Received: by 10.68.69.6 with SMTP id a6mr1642544pbu.49.1431120364151; Fri, 08 May 2015 14:26:04 -0700 (PDT) Received: from wacom-arch2.localdomain ([67.51.163.2]) by mx.google.com with ESMTPSA id fe3sm6079487pbd.76.2015.05.08.14.26.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 May 2015 14:26:02 -0700 (PDT) From: Jason Gerecke To: Jiri Kosina , Benjamin Tissoires , jono , Ping Cheng Cc: linux-input@vger.kernel.org, Jason Gerecke , Jason Gerecke Subject: [PATCH 2/2] HID: wacom: Handle failing HID_DG_CONTACTMAX requests Date: Fri, 8 May 2015 14:25:02 -0700 Message-Id: <1431120302-13691-2-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1431120302-13691-1-git-send-email-killertofu@gmail.com> References: <1431120302-13691-1-git-send-email-killertofu@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hardware may not respond to a request for the HID_DG_CONTACTMAX feature and we should be tolerant of such a failure. This is especially true when using hid-replay where the hardware doesn't exist, but also for devices attached to a flaky bus. This patch increases the number of allowable retries to match other calls to 'wacom_get_report' and also provides a fallback which forces 'touch_max = 16' (enough for any Wacom device seen so far). Signed-off-by: Jason Gerecke --- drivers/hid/wacom_sys.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 3cd74d9..c9a7e30 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -125,9 +125,17 @@ static void wacom_feature_mapping(struct hid_device *hdev, break; data[0] = field->report->id; ret = wacom_get_report(hdev, HID_FEATURE_REPORT, - data, 2, 0); - if (ret == 2) + data, 2, WAC_CMD_RETRIES); + if (ret == 2) { features->touch_max = data[1]; + } + else { + features->touch_max = 16; + dev_warn(&hdev->dev, "wacom_feature_mapping: " + "could not get HID_DG_CONTACTMAX, " + "defaulting to %d\n", + features->touch_max); + } kfree(data); } break;