From patchwork Mon May 23 14:28:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5buW5bSH5qau?= X-Patchwork-Id: 9131923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A120B60761 for ; Mon, 23 May 2016 14:29:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 974CF28237 for ; Mon, 23 May 2016 14:29:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B7532823D; Mon, 23 May 2016 14:29:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E19D28237 for ; Mon, 23 May 2016 14:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755288AbcEWO3G (ORCPT ); Mon, 23 May 2016 10:29:06 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:10548 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754203AbcEWO3F convert rfc822-to-8bit (ORCPT ); Mon, 23 May 2016 10:29:05 -0400 Received: from unknown (HELO elanic) ([192.168.10.6]) by emcscan.emc.com.tw with ESMTP; 23 May 2016 22:29:00 +0800 Received: from elanic (elanic.emc.com.tw [127.0.0.1]) by elanic (Postfix) with ESMTP id EAE2D3CAA70; Mon, 23 May 2016 22:23:19 +0800 (CST) Received: from nb92073 (unknown [192.168.33.46]) by elanic (Postfix) with ESMTP id B77E73C99FC; Mon, 23 May 2016 22:23:19 +0800 (CST) From: =?UTF-8?B?5buW5bSH5qau?= To: "'Dmitry Torokhov'" Cc: , , , =?UTF-8?B?J+m7g+S4lum1rCDntpPnkIYn?= , "'Charles Mooney'" , "'Agnes Cheng'" , "'jeff'" References: <006901d1acea$8207d090$861771b0$@emc.com.tw> <00be01d1af65$ec37c290$c4a747b0$@emc.com.tw> <20160516175342.GD12752@dtor-ws> <00c901d1b047$4a2d3ba0$de87b2e0$@emc.com.tw> <20160520005137.GA39923@dtor-ws> In-Reply-To: <20160520005137.GA39923@dtor-ws> Subject: RE: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger Date: Mon, 23 May 2016 22:28:59 +0800 Message-ID: <000001d1b4ff$71ee0720$55ca1560$@emc.com.tw> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJlpFtre/R/19XiZrouR3fFhL59vQGLjSU7Aq0kxD4B4uxK+ADXZoWBAi5+Cn2eVaftMA== Content-Language: zh-tw Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Dmitry, Thanks for your confirmation. I think the best and simplest way is to add below code to emit BTN_TOOL_FINGER if hover condition meets. input_report_key(dev, BTN_TOOL_FINGER, input_mt_get_value(dev, ABS_DISTANCE)); Is it ok for you? if (use_count) { if (count == 0 && !test_bit(ABS_MT_DISTANCE, dev->absbit) && test_bit(ABS_DISTANCE, dev->absbit) && input_abs_get_val(dev, ABS_DISTANCE) != 0) { /* Emit BTN_TOOL_FINGER*/ input_report_key(dev, BTN_TOOL_FINGER, input_mt_get_value(dev, ABS_DISTANCE)); count = 1; } B.R KT -----Original Message----- From: 'Dmitry Torokhov' [mailto:dmitry.torokhov@gmail.com] Sent: Friday, May 20, 2016 8:52 AM To: 廖崇榮 Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; zac.hsieh@emc.com.tw; '黃世鵬 經理'; 'Charles Mooney'; 'Agnes Cheng'; 'jeff' Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger On Tue, May 17, 2016 at 10:20:40PM +0800, 廖崇榮 wrote: > Hi Dmitry, > > I want to confirm my thought for your idea to avoid misunderstanding. > I think you want to encapsulate " BTN_TOOL_FINGER" in the [input_mt_report_pointer_emulation] if hover happen. > Vendor driver only report "ABS_DISTANCE" and let [input_mt_report_pointer_emulation] emit BTN_TOOL_FINGER report without change function parameter. > > Please let me know if my misunderstand about your idea. Yes, that is correct. Something like this: --- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index 54fce56..a1bbec9 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -218,8 +218,23 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) } input_event(dev, EV_KEY, BTN_TOUCH, count > 0); - if (use_count) + + if (use_count) { + if (count == 0 && + !test_bit(ABS_MT_DISTANCE, dev->absbit) && + test_bit(ABS_DISTANCE, dev->absbit) && + input_abs_get_val(dev, ABS_DISTANCE) != 0) { + /* + * Force reporting BTN_TOOL_FINGER for devices that + * only report general hover (and not per-contact + * distance) when contact is in proximity but not + * on the surface. + */ + count = 1; + } + input_mt_report_finger_count(dev, count); + } if (oldest) { int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);