From patchwork Fri Apr 9 21:58:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafi Rubin X-Patchwork-Id: 91806 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o39LxGaF031284 for ; Fri, 9 Apr 2010 21:59:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754871Ab0DIV7V (ORCPT ); Fri, 9 Apr 2010 17:59:21 -0400 Received: from LION.SEAS.upenn.edu ([158.130.12.194]:36571 "EHLO lion.seas.upenn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122Ab0DIV7U (ORCPT ); Fri, 9 Apr 2010 17:59:20 -0400 Received: from localhost.localdomain (pool-173-59-64-206.phlapa.east.verizon.net [173.59.64.206]) (authenticated bits=0) by lion.seas.upenn.edu (8.13.6/8.13.6) with ESMTP id o39Lwubj011881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 9 Apr 2010 17:59:09 -0400 From: Rafi Rubin To: linux-input@vger.kernel.org, jkosina@suse.cz Cc: micki@n-trig.com, dmitry.torokhov@gmail.com, chatty@enac.fr, Rafi Rubin Subject: [PATCH 2/2] Use TIPSWITCH for TOUCH Date: Fri, 9 Apr 2010 17:58:26 -0400 Message-Id: <1270850306-4949-2-git-send-email-rafi@seas.upenn.edu> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1270850306-4949-1-git-send-email-rafi@seas.upenn.edu> References: <1270850306-4949-1-git-send-email-rafi@seas.upenn.edu> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 09 Apr 2010 21:59:21 +0000 (UTC) diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 58ba0d3..8a145e9 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c @@ -31,10 +31,12 @@ struct ntrig_data { /* Incoming raw values for a single contact */ __u16 x, y, w, h; __u16 id; - __u8 confidence; + + bool tipswitch; + bool confidence; + bool first_contact_touch; bool reading_mt; - __u8 first_contact_confidence; __u8 mt_footer[4]; __u8 mt_foot_count; @@ -141,9 +143,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, case 0xff000001: /* Tag indicating the start of a multitouch group */ nd->reading_mt = 1; - nd->first_contact_confidence = 0; + nd->first_contact_touch = 0; break; case HID_DG_TIPSWITCH: + nd->tipswitch = value; /* Prevent emission of touch until validated */ return 1; case HID_DG_CONFIDENCE: @@ -171,10 +174,15 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, * to emit a normal (X, Y) position */ if (!nd->reading_mt) { - input_report_key(input, BTN_TOOL_DOUBLETAP, - (nd->confidence != 0)); + /* + * TIPSWITCH indicates the presence of a + * finger. DOUBLETAP is emitted are both + * emitted to support legacy drivers. + */ input_report_key(input, BTN_TOUCH, - (nd->confidence != 0)); + nd->tipswitch); + input_report_key(input, BTN_TOOL_DOUBLETAP, + nd->tipswitch); input_event(input, EV_ABS, ABS_X, nd->x); input_event(input, EV_ABS, ABS_Y, nd->y); } @@ -213,7 +221,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, /* emit a normal (X, Y) for the first point only */ if (nd->id == 0) { - nd->first_contact_confidence = nd->confidence; + nd->first_contact_touch = nd->confidence && + nd->tipswitch; input_event(input, EV_ABS, ABS_X, nd->x); input_event(input, EV_ABS, ABS_Y, nd->y); } @@ -243,7 +252,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, nd->reading_mt = 0; - if (nd->first_contact_confidence) { + if (nd->first_contact_touch) { switch (value) { case 0: /* for single touch devices */ case 1: