From patchwork Tue Mar 30 19:40:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 49030 X-Patchwork-Delegate: apw@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id E6216B7CF9 for ; Wed, 31 Mar 2010 06:40:57 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NwhIx-00041p-SQ; Tue, 30 Mar 2010 20:40:52 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NwhIc-0003cO-AY for kernel-team@lists.ubuntu.com; Tue, 30 Mar 2010 20:40:30 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NwhIc-0007ga-8q for ; Tue, 30 Mar 2010 20:40:30 +0100 Received: from 79-66-242-230.dynamic.dsl.as9105.com ([79.66.242.230] helo=localhost.localdomain) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NwhIc-0006bz-2m for kernel-team@lists.ubuntu.com; Tue, 30 Mar 2010 20:40:30 +0100 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 12/16] HID: n-trig: remove unnecessary tool switching Date: Tue, 30 Mar 2010 20:40:19 +0100 Message-Id: <1269978023-3602-13-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1269978023-3602-1-git-send-email-apw@canonical.com> References: <1269978023-3602-1-git-send-email-apw@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Rafi Rubin With the pen and touch split apart, we no longer need to inject additional tool switching events. Signed-off-by: Rafi Rubin Signed-off-by: Jiri Kosina (cherry picked from commit b0549cf1a35a92edf053d94066e60fb0ed02bb71) Signed-off-by: Andy Whitcroft --- drivers/hid/hid-ntrig.c | 41 +---------------------------------------- 1 files changed, 1 insertions(+), 40 deletions(-) diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 38b2364..1bda3a4 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c @@ -27,9 +27,6 @@ struct ntrig_data { __s32 x, y, id, w, h; bool reading_a_point, found_contact_id; - bool pen_active; - bool finger_active; - bool inverted; }; /* @@ -47,7 +44,6 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, return 0; switch (usage->hid & HID_USAGE_PAGE) { - case HID_UP_GENDESK: switch (usage->hid) { case HID_GD_X: @@ -111,6 +107,7 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, /* No special mappings needed for the pen */ if (field->application == HID_DG_PEN) return 0; + if (usage->type == EV_KEY || usage->type == EV_REL || usage->type == EV_ABS) clear_bit(usage->code, *bit); @@ -136,18 +133,6 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, if (hid->claimed & HID_CLAIMED_INPUT) { switch (usage->hid) { - - case HID_DG_INRANGE: - if (field->application & 0x3) - nd->pen_active = (value != 0); - else - nd->finger_active = (value != 0); - return 0; - - case HID_DG_INVERT: - nd->inverted = value; - return 0; - case HID_GD_X: nd->x = value; nd->reading_a_point = 1; @@ -171,32 +156,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, * to emit a normal (X, Y) position */ if (!nd->found_contact_id) { - if (nd->pen_active && nd->finger_active) { - input_report_key(input, BTN_TOOL_DOUBLETAP, 0); - input_report_key(input, BTN_TOOL_DOUBLETAP, 1); - } - input_event(input, EV_ABS, ABS_X, nd->x); - input_event(input, EV_ABS, ABS_Y, nd->y); - } - break; - case HID_DG_TIPPRESSURE: - /* - * when in single touch mode, this is the last - * report received in a pen event. We want - * to emit a normal (X, Y) position - */ - if (! nd->found_contact_id) { - if (nd->pen_active && nd->finger_active) { - input_report_key(input, - nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN - , 0); - input_report_key(input, - nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN - , 1); - } input_event(input, EV_ABS, ABS_X, nd->x); input_event(input, EV_ABS, ABS_Y, nd->y); - input_event(input, EV_ABS, ABS_PRESSURE, value); } break; case 0xff000002: