From patchwork Wed Jan 28 17:42:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 5729671 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 86FCD9F1AF for ; Wed, 28 Jan 2015 20:30:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E2752021B for ; Wed, 28 Jan 2015 20:30:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9239D20221 for ; Wed, 28 Jan 2015 20:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933315AbbA1UaE (ORCPT ); Wed, 28 Jan 2015 15:30:04 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:61043 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933300AbbA1UaA (ORCPT ); Wed, 28 Jan 2015 15:30:00 -0500 Received: by mail-pa0-f50.google.com with SMTP id rd3so29320811pab.9 for ; Wed, 28 Jan 2015 12:30:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=y3SWuRkg72LDfF4rY8gsspwK2R2ai9vDc94/Wu9W6a0=; b=irNOztCMOo7ZohkJ+vV63phMjMd6hsTZ/CmWDxDr9Gw8xndT0Wynf9kfzLVOxIPRtC WVPxVv/K/V//68o/OhEc2MG66pR0QTdGOtlLYVP6Cy1xhzmOGJbCdTRkvOYOd6Cp1e33 4NP4JXeoXpCiEjsvdrY/jm69/HHVIhhfneQRB/ZK9OjZz8OKDkI/uxuBOY6ViZgZWoGQ sXHLZfsP/yo+vaj7TZCXi2tsaGDitmIVhRnSwUqaPRfTNhSgG7qCEHJ41xmfbA2iq8a9 x249RNrTiKJs16dY/HoVH7I1CRSOvN3NtlAbnUbvBIjxSgrLtBA7e8ZnWVoSpcZBbH6s Lh+Q== X-Received: by 10.68.203.35 with SMTP id kn3mr7898427pbc.78.1422467006915; Wed, 28 Jan 2015 09:43:26 -0800 (PST) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id w1sm5370468pdb.7.2015.01.28.09.43.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jan 2015 09:43:25 -0800 (PST) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, Ping Cheng Subject: [PATCH 1/3] Make sure touch arbitration is applied consistently across devices Date: Wed, 28 Jan 2015 09:42:59 -0800 Message-Id: <1422466979-17405-1-git-send-email-pingc@wacom.com> X-Mailer: git-send-email 1.9.1 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 stylus_in_proximity is used to make sure no touch event is sent while pen is in proximity. touch_down is used to make sure a touch up event is sent when pen comes into proximity while touch is down. Two touch routines didn't store touch_down. One touch routine forgot to check stylus_in_proximity before sending touch events. This patch fixes those issues. Signed-off-by: Ping Cheng --- v2: added commit comments as reqested by Jiri. No code update. --- drivers/hid/wacom_wac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index f886149..6d490f6 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1042,7 +1042,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom) for (i = 0; i < contacts_to_send; i++) { int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1; - bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity; + bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity; int slot = input_mt_get_slot_by_key(input, data[offset + 1]); if (slot < 0) @@ -1072,6 +1072,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom) if (wacom->num_contacts_left <= 0) wacom->num_contacts_left = 0; + wacom->shared->touch_down = (wacom->num_contacts_left > 0); return 1; } @@ -1100,7 +1101,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom) for (i = 0; i < contacts_to_send; i++) { int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3; - bool touch = data[offset] & 0x1; + bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity; int id = get_unaligned_le16(&data[offset + 1]); int slot = input_mt_get_slot_by_key(input, id); @@ -1122,6 +1123,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom) if (wacom->num_contacts_left < 0) wacom->num_contacts_left = 0; + wacom->shared->touch_down = (wacom->num_contacts_left > 0); return 1; }