All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Emit BTN_TOO_FINGER in function input_mt_report_pointer_emulation if touchpad meets hover condition
@ 2016-05-25 11:44 廖崇榮
  2016-05-26  0:13 ` 'Dmitry Torokhov'
  0 siblings, 1 reply; 2+ messages in thread
From: 廖崇榮 @ 2016-05-25 11:44 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: linux-input, linux-kernel, zac.hsieh,
	'黃世鵬 經理',
	'Charles Mooney', 'Agnes Cheng', 'jeff'

[-- Attachment #1: Type: text/plain, Size: 1966 bytes --]

Hi Dmitry,

Update /input/mouse/input-mt.c
Emit BTN_TOO_FINGER in input_mt_report_pointer_emulation if touchpad meets hover condition.

Thanks & BR	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:

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

[-- Attachment #2: 0001-Input-drivers-input-input-mt.c.patch --]
[-- Type: application/octet-stream, Size: 1282 bytes --]

>From 6097f617de49db3592322da66253a1b88090d157 Mon Sep 17 00:00:00 2001
From: KT Liao <kt.liao@emc.com.tw>
Date: Wed, 25 May 2016 15:52:09 +0800
Subject: [PATCH] Input: drivers/input/input-mt.c Emit BTN_TOO_FINGER in
 function input_mt_report_pointer_emulation if touchpad meets hover condition
 Signed-off-by: KT Liao <kt.liao@emc.com.tw>

---
 drivers/input/input-mt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index 54fce56..486b1ca 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -218,8 +218,17 @@ 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)
-		input_mt_report_finger_count(dev, 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) {
+			input_report_key(dev, BTN_TOOL_FINGER, input_abs_get_val(dev, ABS_DISTANCE));
+			count = 1;
+		}
+ 		input_mt_report_finger_count(dev, count);
+	}
 
 	if (oldest) {
 		int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Emit BTN_TOO_FINGER in function input_mt_report_pointer_emulation if touchpad meets hover condition
  2016-05-25 11:44 [PATCH] Emit BTN_TOO_FINGER in function input_mt_report_pointer_emulation if touchpad meets hover condition 廖崇榮
@ 2016-05-26  0:13 ` 'Dmitry Torokhov'
  0 siblings, 0 replies; 2+ messages in thread
From: 'Dmitry Torokhov' @ 2016-05-26  0:13 UTC (permalink / raw)
  To: 廖崇榮
  Cc: linux-input, linux-kernel, zac.hsieh,
	'黃世鵬 經理',
	'Charles Mooney', 'Agnes Cheng', 'jeff'

Hi KT,

On Wed, May 25, 2016 at 07:44:57PM +0800, 廖崇榮 wrote:
> Hi Dmitry,
> 
> Update /input/mouse/input-mt.c
> Emit BTN_TOO_FINGER in input_mt_report_pointer_emulation if touchpad meets hover condition.

Please do not top-post and also do not send patches as attachments,
they should be sent inline. Please take a look at "git send-email"
command.

Thanks.

> 
> Thanks & BR	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:
> 
> 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



-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-26  0:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25 11:44 [PATCH] Emit BTN_TOO_FINGER in function input_mt_report_pointer_emulation if touchpad meets hover condition 廖崇榮
2016-05-26  0:13 ` 'Dmitry Torokhov'

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.