From patchwork Wed Mar 30 02:02:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Duson Lin X-Patchwork-Id: 8692481 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 942AC9F3D1 for ; Wed, 30 Mar 2016 02:02:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3D2920155 for ; Wed, 30 Mar 2016 02:02:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1BDC420148 for ; Wed, 30 Mar 2016 02:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754420AbcC3CCN (ORCPT ); Tue, 29 Mar 2016 22:02:13 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:28372 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753483AbcC3CCM convert rfc822-to-8bit (ORCPT ); Tue, 29 Mar 2016 22:02:12 -0400 Received: from unknown (HELO emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 30 Mar 2016 10:02:08 +0800 Received: from NB92067 ([192.168.33.28]) by emc.com.tw (8.13.7+Sun/8.13.7) with ESMTP id u2U227mN010197; Wed, 30 Mar 2016 10:02:07 +0800 (CST) From: "DusonLin" To: "'Dmitry Torokhov'" , , Cc: "'Charles Mooney'" , "'jeff'" , "'Phoenix'" Subject: [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger Date: Wed, 30 Mar 2016 10:02:02 +0800 Message-ID: <002801d18a28$2a12dfe0$7e389fa0$@emc.com.tw> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AdGKKBxbngPq2i72RImXX3LieXIHGQ== Content-Language: zh-tw Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Only ABS_DISTANCE is not enough for upper OS to distiguish hover event be triggered from object form faraway to and close touchpad surface or from object prepare to leave the touchpad surface. We add BNT_TOOL_FINGER to help it. Object_at_faraway object_at_hover_area object_touch_touchpad BTN_TOUCH 0 0 1 BTN_TOOL_FINGER 0 1 1 ABS_DISTANCE 0 1 0 Signed-off by: Duson Lin --- drivers/input/mouse/elan_i2c_core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 2f58985..9392a8c 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -4,7 +4,7 @@ * Copyright (c) 2013 ELAN Microelectronics Corp. * * Author: ??? (Duson Lin) - * Version: 1.6.0 + * Version: 1.6.1 * * Based on cyapa driver: * copyright (c) 2011-2012 Cypress Semiconductor, Inc. @@ -845,23 +845,27 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet) { struct input_dev *input = data->input; u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET]; - int i; + int i, valid_count = 0; u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET]; u8 hover_info = packet[ETP_HOVER_INFO_OFFSET]; bool contact_valid, hover_event; - hover_event = hover_info & 0x40; + hover_event = (hover_info & 0x40); for (i = 0; i < ETP_MAX_FINGERS; i++) { contact_valid = tp_info & (1U << (3 + i)); elan_report_contact(data, i, contact_valid, finger_data); - if (contact_valid) + if (contact_valid) { finger_data += ETP_FINGER_DATA_LEN; + valid_count++; + } } input_report_key(input, BTN_LEFT, tp_info & 0x01); + input_report_key(input, BTN_TOOL_FINGER, + ((hover_event != 0) | (valid_count > 0))); input_report_abs(input, ABS_DISTANCE, hover_event != 0); - input_mt_report_pointer_emulation(input, true); + input_mt_report_pointer_emulation(input, false); input_sync(input); }