From patchwork Wed Oct 7 23:54:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 7347751 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1BF339F302 for ; Wed, 7 Oct 2015 23:54:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45AD520610 for ; Wed, 7 Oct 2015 23:54:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 511C82060E for ; Wed, 7 Oct 2015 23:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753639AbbJGXyz (ORCPT ); Wed, 7 Oct 2015 19:54:55 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:34928 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753627AbbJGXyz (ORCPT ); Wed, 7 Oct 2015 19:54:55 -0400 Received: by pacfv12 with SMTP id fv12so35934096pac.2 for ; Wed, 07 Oct 2015 16:54:54 -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=3T2wnotDVo6qQsn+hgrbN45HYxzZMyFoLfL9K34gXMY=; b=u4a0oiFqybX/zECT+iK4QCw6K3U6ama0heXJk8De4FoD75SL5DSWeVAigkvIx+3p3C 0desZM2yhszK9yn0BoGEzfOkZE+L/u1zSYUiVzr/stjP0rme+kA1BeVZ0umq8hn8SZmE QV4qIWQizBrFZvjMEtLZ2nxOGNxhmnmZpzN84MtClk7Suw3lTSFJ2Ux5E2adKv7dpE0x Mbrp6cygbEAxRWn3X+VGmI3JJVFCoI/OshwWYGZQ23HB1dz5RE8qcCIVnXbeBk4QCbGm yDhfRfsTgt4rDMJolV9/9XTh7h08hmva6X2We1SvudjeyqMOX0hc+JMB3kNYUWoL/ZJ1 LXow== X-Received: by 10.68.93.133 with SMTP id cu5mr4276527pbb.71.1444262094868; Wed, 07 Oct 2015 16:54:54 -0700 (PDT) Received: from wacom-arch2.corp.onewacom.com ([67.51.163.2]) by smtp.gmail.com with ESMTPSA id u3sm41586904pbs.33.2015.10.07.16.54.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Oct 2015 16:54:54 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org Cc: Jiri Kosina , Benjamin Tissoires , Ping Cheng , Aaron Skomra , expiredpopsicle@gmail.com, Jason Gerecke , Jason Gerecke Subject: [PATCH 2/2] HID: wacom: Expect 'touch_max' touches if HID_DG_CONTACTCOUNT not present Date: Wed, 7 Oct 2015 16:54:22 -0700 Message-Id: <1444262062-19247-2-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1444262062-19247-1-git-send-email-killertofu@gmail.com> References: <1444262062-19247-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 When introduced in commit 1b5d514, the check 'if (hid_data->cc_index >= 0)' in 'wacom_wac_finger_pre_report' was intended to switch where the driver got the expected number of contacts from: HID_DG_CONTACTCOUNT if the usage was present, or 'touch_max' otherwise. Unfortunately, an oversight worthy of a brown paper bag (specifically, that 'cc_index' could never be negative) meant that the latter 'else' clause would never be entered. The patch prior to this one introduced a way for 'cc_index' to be negative, but only if HID_DG_CONTACTCOUNT is present in some report _other_ than the one being processed. To ensure the 'else' clause is also entered for devices which don't have HID_DG_CONTACTCOUNT on _any_ report, we add the additional constraint that 'cc_report' be non-zero (which is true only if the usage is present in some report). Signed-off-by: Jason Gerecke --- Jiri, Could you please queue this patch and the prior for 4.3? They fix issues with the implementation of my "Ignore contacts in excess of declared contact count" patch which was pulled in as part of the 4.3 merge window. Thanks :) drivers/hid/wacom_wac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 4140b1d..46bd02b 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1740,8 +1740,8 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, } } } - - if (hid_data->cc_index >= 0) { + if (hid_data->cc_report != 0 && + hid_data->cc_index >= 0) { struct hid_field *field = report->field[hid_data->cc_index]; int value = field->value[hid_data->cc_value_index]; if (value)