From patchwork Fri May 20 00:51:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9128503 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 554BD6048B for ; Fri, 20 May 2016 00:51:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48435200E7 for ; Fri, 20 May 2016 00:51:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C3CE209D7; Fri, 20 May 2016 00:51:44 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 E0764200E7 for ; Fri, 20 May 2016 00:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754063AbcETAvm (ORCPT ); Thu, 19 May 2016 20:51:42 -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 Received: by mail-pf0-f194.google.com with SMTP id 145so9650777pfz.1; Thu, 19 May 2016 17:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=PXcJdQrY8KJ3mLEVvAlpu1dPN835Y+0Azz1n10XmDSM=; b=sAL+m/Z7fDPJZQfVQmsyz8iQoP/phPqnB/afzIj+hd4vXWeqNqthRbF7JYKdYCY4+1 IVcoU7DWvkO5oS8f2e/o9ZJKv1t1CJq8TT1k6UEF7sDgskJbcVULudSDfrG7l+KVWSE/ 6bDyHqwIlDcg8JslotIJaLUxOkI9Eu6BF+2z/xyOsOoA4xwTFHsb6Y5slH6rb1iT185l Y6QjqsOv8e6cIEOayZuegft6AUZ++aXhCrH9Ed0jbHCaJ80QGv/cxoYEMFgUsh8UnIvU O/AvFdAWD7pMv8df3PyCJEb2DYguf5T4wn4i+gq4TnoyquvP4QiT7DMULvpbVwQrJwIw tOYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=PXcJdQrY8KJ3mLEVvAlpu1dPN835Y+0Azz1n10XmDSM=; b=QaBDlwkUnKXcp6Kyx+RNdT/9k8b9K2aIpZVMiX7ZlqUY6n4u0rZqKb3D8pP2y2ng1V TtUENd1C/J7BHiiniGkNqnHwy0t0cLXLN9YU3Q/LIREp/imxHkm0m0l3XUiATOuIfhm5 8jMWoi/dhP1nKiDOO719T5z+Evk71Y1SBAnfdGifUO+02WmStN9rfxeudFLGfN6WGxdS xP0ix6tw11MfoBiv8kAVAGgi2PCDVFS9+XH2+Q9OOhKmPe+03Z/8SrbPupu4+2CJ/JWS oYdO2KyDHfSHHW7NDFk9AeS78cRYp/btdc9vKX6ztNPsMvfZWliuuotYDQ2Yk45+V5YF bKnA== X-Gm-Message-State: AOPr4FVnUhLoEaLnPdTzyvHHMRgjEBTNnpxsQXdu+8M6YKPhcLehOdfPDtETojuW8WkxAA== X-Received: by 10.98.80.196 with SMTP id g65mr384946pfj.91.1463705500613; Thu, 19 May 2016 17:51:40 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1311:e9af:790f:9020:5990]) by smtp.gmail.com with ESMTPSA id t14sm22513555pfj.12.2016.05.19.17.51.39 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 19 May 2016 17:51:39 -0700 (PDT) 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-Disposition: inline In-Reply-To: <00c901d1b047$4a2d3ba0$de87b2e0$@emc.com.tw> User-Agent: Mutt/1.5.21 (2010-09-15) 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 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);