Skip to contentSkip to conversation

Emit BTN_TOO_FINGER in function input_mt_report_pointer_emulation if touchpad meets hover condition

PATCH In review 廖崇榮 2 participants 2 messages May 25, 2016 – May 26, 2016

Subsystems (3)
lore
Share & tools
lore

廖崇榮

author
#0 lore raw

PATCH 1/1 Emit BTN_TOO_FINGER in function input_mt_report_pointer_emulation if touchpad meets hover condition

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:[email protected]]
Sent: Friday, May 20, 2016 8:52 AM
To: 廖崇榮
Cc: [email protected]; [email protected]; [email protected]; '黃世鵬 經理'; 'Charles Mooney'; 'Agnes Cheng'; 'jeff'
Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger

Quoted 7 lines · 廖崇榮

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:

drivers/input/input-mt.c +16 -1
@@ -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

Quoted 1 line

From 6097f617de49db3592322da66253a1b88090d157 Mon Sep 17 00:00:00 2001

From: KT Liao <[email protected]>
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

---
 drivers/input/input-mt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/input/input-mt.c +11 -2
index 54fce56..486b1ca 100644
@@ -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);
Signature · 1 line
2.7.4
#1 lore raw

Hi KT,

Quoted 4 lines · 廖崇榮

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.

Quoted 52 lines

Thanks & BR KT

-----Original Message-----
From: 'Dmitry Torokhov' [mailto:[email protected]]
Sent: Friday, May 20, 2016 8:52 AM
To: 廖崇榮
Cc: [email protected]; [email protected]; [email protected]; '黃世鵬 經理'; 'Charles Mooney'; 'Agnes Cheng'; 'jeff'
Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger

Quoted 7 lines · 廖崇榮

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:

drivers/input/input-mt.c +16 -2
@@ -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

Signature · 1 line
Dmitry