From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755397AbcETAvn (ORCPT ); Thu, 19 May 2016 20:51:43 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34533 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753929AbcETAvl (ORCPT ); Thu, 19 May 2016 20:51:41 -0400 Date: Thu, 19 May 2016 17:51:37 -0700 From: "'Dmitry Torokhov'" To: =?utf-8?B?5buW5bSH5qau?= Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, zac.hsieh@emc.com.tw, =?utf-8?B?J+m7g+S4lum1rCDntpPnkIYn?= , "'Charles Mooney'" , "'Agnes Cheng'" , "'jeff'" Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger Message-ID: <20160520005137.GA39923@dtor-ws> References: <006901d1acea$8207d090$861771b0$@emc.com.tw> <00be01d1af65$ec37c290$c4a747b0$@emc.com.tw> <20160516175342.GD12752@dtor-ws> <00c901d1b047$4a2d3ba0$de87b2e0$@emc.com.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <00c901d1b047$4a2d3ba0$de87b2e0$@emc.com.tw> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 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); -- Dmitry