From patchwork Wed Nov 7 16:37:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 1711561 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 0871F3FC8F for ; Wed, 7 Nov 2012 16:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753802Ab2KGQiL (ORCPT ); Wed, 7 Nov 2012 11:38:11 -0500 Received: from mail-ea0-f174.google.com ([209.85.215.174]:56660 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753696Ab2KGQiI (ORCPT ); Wed, 7 Nov 2012 11:38:08 -0500 Received: by mail-ea0-f174.google.com with SMTP id c13so686587eaa.19 for ; Wed, 07 Nov 2012 08:38:07 -0800 (PST) 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=F+m6ykUyC6shEiNQGRSkqA2q+s7JJAJW2UQJKqz41JI=; b=KeUExq6Udimq8fVh8P9H4KXfeYKeaw/AQmq1AUe6fN7k8vc86o68GhyZSInc1TQqqU /BI4gNqtY+LROMxetmLKyBQUNS1IMAajufR/WZ29HsdZwiilSF4Zzc1ZFJkT8qlqDsNf 0nEG7TBuD4U80llvHvXNWKnQXti+ScTMnpI9CW+dDGvceodnChP1335gmx6DPPDKDzgF nntHSG7xE9UylXH3hA4awLAT3DjtJsEdiagQEchNsBIUQrb8x6rBkMkZQvYW6wxsw/fh 5jEkkUH/FADxPnsEyZpagPx/0WLcl2bnhuoq6xgAHjeyRC5zw3MZyc6umKXadFrrUNM5 yhmA== Received: by 10.14.1.69 with SMTP id 45mr17344681eec.23.1352306287771; Wed, 07 Nov 2012 08:38:07 -0800 (PST) Received: from miniplouf.banquise.com (lan31-8-82-247-176-67.fbx.proxad.net. [82.247.176.67]) by mx.google.com with ESMTPS id a44sm64766844eeo.7.2012.11.07.08.38.06 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 07 Nov 2012 08:38:07 -0800 (PST) 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 v3 10/13] HID: hid-multitouch: fix Win 8 protocol Date: Wed, 7 Nov 2012 17:37:33 +0100 Message-Id: <1352306256-12180-11-git-send-email-benjamin.tissoires@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1352306256-12180-1-git-send-email-benjamin.tissoires@gmail.com> References: <1352306256-12180-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 until it is released. So we can use the always_valid quirk and dismiss reports when we see duplicates contact ID. We recognize Win8 certified devices from their vendor feature 0xff0000c5 where Microsoft put a signed blob in the report to check if the device passed the certification. Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-multitouch.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 351c814..b393c6c 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -53,6 +53,7 @@ MODULE_LICENSE("GPL"); #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8) #define MT_QUIRK_NO_AREA (1 << 9) #define MT_QUIRK_IGNORE_DUPLICATES (1 << 10) +#define MT_QUIRK_WIN_8_CERTIFIED (1 << 11) struct mt_slot { __s32 x, y, cx, cy, p, w, h; @@ -293,6 +294,10 @@ static void mt_feature_mapping(struct hid_device *hdev, td->maxcontacts = td->mtclass.maxcontacts; break; + case 0xff0000c5: + if (field->report_count == 256 && field->report_size == 8) + td->mtclass.quirks |= MT_QUIRK_WIN_8_CERTIFIED; + break; } } @@ -679,14 +684,17 @@ 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; quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE; } + if (quirks & MT_QUIRK_WIN_8_CERTIFIED) + quirks |= MT_QUIRK_IGNORE_DUPLICATES; + td->mtclass.quirks = quirks; }