From patchwork Fri Oct 26 08:44:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 1650301 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 47B3040135 for ; Fri, 26 Oct 2012 08:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757468Ab2JZIpA (ORCPT ); Fri, 26 Oct 2012 04:45:00 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:35014 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757415Ab2JZIor (ORCPT ); Fri, 26 Oct 2012 04:44:47 -0400 Received: by mail-wi0-f172.google.com with SMTP id hq12so225486wib.1 for ; Fri, 26 Oct 2012 01:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=UALpBBR+dtTEk+BTSMPSXZyxc8XmT+m2Ci4BmhxTmhg=; b=ZzgTJzU2kOjw30znr08VPnXO5jVyXp7M88IgNry+QwlHDA5TzVbs+Sk9thcaxsjLxr fP4/B22fGFIc7QkH6gWLOnaU73TGIXkl8XS29uggShIoW0A20dZX7ZAI84dNBi4ZPn6y tsxg5yoxGtSXuVCB9eD3HCpw8foYDtdkEAW4hWavf9G28fL2TCLXvW1jOoHozpbj7YRT PH06w9VYP11BOZdLVKrWFalTAWkFzsl692RQWH7XqvlaG60U5vj0hFu410t3Rg1ek5VK F1DcdYueF4AfmOeqnLfVLfILn7zn/W4sggHW4A4zffh8BG8cXiVuQhaY59AaueD5JhDT VXhA== Received: by 10.216.141.38 with SMTP id f38mr13689642wej.196.1351241086505; Fri, 26 Oct 2012 01:44:46 -0700 (PDT) Received: from miniplouf.lan (lan31-8-82-247-176-67.fbx.proxad.net. [82.247.176.67]) by mx.google.com with ESMTPS id dq6sm14151586wib.5.2012.10.26.01.44.45 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Oct 2012 01:44:46 -0700 (PDT) From: Benjamin Tissoires To: "benjamin.tissoires" , Dmitry Torokhov , Henrik Rydberg , Jiri Kosina , Stephane Chatty , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 08/11] HID: hid-multitouch: fix Win 8 protocol Date: Fri, 26 Oct 2012 10:44:24 +0200 Message-Id: <1351241067-9521-9-git-send-email-benjamin.tissoires@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1351241067-9521-1-git-send-email-benjamin.tissoires@gmail.com> References: <1351241067-9521-1-git-send-email-benjamin.tissoires@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Win 8 specification is much more precise than the Win 7 one. Moreover devices that need to take certification must be submitted to Microsoft. The result is a better protocol support and we can rely on that to skip all the messy tests we used to do. The protocol specify the fact that each valid touch must be reported within a frame, and that the release touch coordinate must be the same than the last known touch. So we can use the always_valid quirk and dismiss reports when we touch coordiante do not follow this rule. Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-multitouch.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 43bd8e8..bd23f19 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -510,6 +510,18 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input) int slotnum = mt_compute_slot(td, input); struct mt_slot *s = &td->curdata; + if (td->mtclass.quirks & MT_QUIRK_WIN_8_CERTIFIED && + !s->touch_state) { + struct input_mt_slot *slot = &input->mt->slots[slotnum]; + int prv_x = input_mt_get_value(slot, ABS_MT_POSITION_X); + int prv_y = input_mt_get_value(slot, ABS_MT_POSITION_Y); + /* valid releases occurs when the last x and y positions + * are the same as the last known touch. */ + if (!input_mt_is_active(slot) || + prv_x != s->x || prv_y != s->y) + return; + } + if (slotnum < 0 || slotnum >= td->maxcontacts) return; @@ -681,8 +693,8 @@ static void mt_post_parse_default_settings(struct mt_device *td) { __s32 quirks = td->mtclass.quirks; - /* unknown serial device needs special quirks */ - if (td->touches_by_report == 1) { + /* unknown serial devices or win8 ones need special quirks */ + if (td->touches_by_report == 1 || quirks & MT_QUIRK_WIN_8_CERTIFIED) { quirks |= MT_QUIRK_ALWAYS_VALID; quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP; quirks &= ~MT_QUIRK_VALID_IS_INRANGE;