From patchwork Wed Nov 14 15:59:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 1742231 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 B87D73FE20 for ; Wed, 14 Nov 2012 16:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423105Ab2KNQBF (ORCPT ); Wed, 14 Nov 2012 11:01:05 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:38389 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422999Ab2KNP75 (ORCPT ); Wed, 14 Nov 2012 10:59:57 -0500 Received: by mail-wg0-f44.google.com with SMTP id dr13so307340wgb.1 for ; Wed, 14 Nov 2012 07:59:56 -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=LRrvcB9U2asBg/8yLMZE/R+BUd13HMZto+twDoeF8u0=; b=K8GXMsdzjR9NPe46LHRoJj/1ipVABZ+MEQ47nEtsLUcwZH5Cm70ZFeFnnzmDc3+Eb6 Pkoqu2iwJwr6TkFkkdZKXDAaZxOsn2zHgpjKCf/655evi3zYDiz925x/d+oOKiSZ1tX1 0HAE1tnzrEyrMF0PDrC94zdxhJPR5FHHXHe4tt9XldU23qcABUAG6sYAhh317CcZZYu3 H+18EImJWnwQu0uMt8ASSdMZnXqFzdPil5MUYfVJUmV09FCyT90sEMcMoZPTkV6fv17L 8zh6SvMUSn3yz5xVn2QugwLaU6DV3h86RFcnyqHxuWIXFnlw/5+40+6YAggDLLbirSHb Zd+A== Received: by 10.180.79.37 with SMTP id g5mr26727332wix.7.1352908796752; Wed, 14 Nov 2012 07:59:56 -0800 (PST) Received: from localhost.localdomain.com (lan31-8-82-247-176-67.fbx.proxad.net. [82.247.176.67]) by mx.google.com with ESMTPS id r10sm3050116wiz.0.2012.11.14.07.59.55 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Nov 2012 07:59:56 -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 v4 11/14] HID: hid-multitouch: add MT_QUIRK_IGNORE_DUPLICATES Date: Wed, 14 Nov 2012 16:59:23 +0100 Message-Id: <1352908766-4492-12-git-send-email-benjamin.tissoires@gmail.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1352908766-4492-1-git-send-email-benjamin.tissoires@gmail.com> References: <1352908766-4492-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 This quirk allows a device to reuse a contact id when sending garbage inactive contacts at the end of a report. Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-multitouch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 2352770..c5b81a7 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -52,6 +52,7 @@ MODULE_LICENSE("GPL"); #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6) #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8) #define MT_QUIRK_NO_AREA (1 << 9) +#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10) struct mt_slot { __s32 x, y, cx, cy, p, w, h; @@ -506,10 +507,18 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input) if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { int slotnum = mt_compute_slot(td, input); struct mt_slot *s = &td->curdata; + struct input_mt *mt = input->mt; if (slotnum < 0 || slotnum >= td->maxcontacts) return; + if ((td->mtclass.quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) { + struct input_mt_slot *slot = &mt->slots[slotnum]; + if (input_mt_is_active(slot) && + input_mt_is_used(mt, slot)) + return; + } + input_mt_slot(input, slotnum); input_mt_report_slot_state(input, MT_TOOL_FINGER, s->touch_state);