From patchwork Fri Oct 26 08:44:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 1650351 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5AC9FDF2F6 for ; Fri, 26 Oct 2012 08:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757414Ab2JZIoz (ORCPT ); Fri, 26 Oct 2012 04:44:55 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:58210 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757407Ab2JZIom (ORCPT ); Fri, 26 Oct 2012 04:44:42 -0400 Received: by mail-we0-f174.google.com with SMTP id t9so1288402wey.19 for ; Fri, 26 Oct 2012 01:44:41 -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=EyKAeLojEmsIuRJejHnoQcyFZ+oecYqTZi1VH/i6iWo=; b=LWwrMMwW/6TwRdohOQvb6APEsv8Bhzwo1i2xfL/VYfeiMpTPVXZvxk79i2KOoFm4O2 zOCeQO9/+XsEGekmu2zUUoTgARhhiUc/+B+G+b6Sgdv8O8fAEBc71ItG64jRxY4ZN+H3 4I7zOW6AcicE09rrdPv7LQ6L4sPVodP89KLqt8IzaKePVKKabEXJVoTJlN6eX6Keswi0 8847S4i+j0XmIx+DcIILj/tM/qoBckWzXQD4futJZ8/7CDur8cD1Yuv3qg3dTASi81RI yCZdsfdQtfAh2mj65yvfcile9zthlvocXkjJrggnC8TQiVBMtr5BCTPrvX5I/eZAJvoe e4TQ== Received: by 10.216.204.138 with SMTP id h10mr13322726weo.168.1351241081247; Fri, 26 Oct 2012 01:44:41 -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.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Oct 2012 01:44:40 -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 04/11] HID: hid-multitouch: support arrays for the split of the touches in a report Date: Fri, 26 Oct 2012 10:44:20 +0200 Message-Id: <1351241067-9521-5-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 Win8 certification introduced the ability to transmit two X and two Y per touch. The specification precises that it must be in an array, with a report count == 2. This test guarantees that we split the touches on the last element in this array. Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-multitouch.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 725d155..95562d8 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -577,12 +577,16 @@ static int mt_event(struct hid_device *hid, struct hid_field *field, return 0; } - if (usage->hid == td->last_slot_field) - mt_complete_slot(td, field->hidinput->input); - - if (field->index == td->last_field_index - && td->num_received >= td->num_expected) - mt_sync_frame(td, field->hidinput->input); + if (usage_index + 1 == field->report_count) { + /* we only take into account the last report + * of a field if report_count > 1 */ + if (usage->hid == td->last_slot_field) + mt_complete_slot(td, field->hidinput->input); + + if (field->index == td->last_field_index + && td->num_received >= td->num_expected) + mt_sync_frame(td, field->hidinput->input); + } }