linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger
@ 2016-03-30  2:02 DusonLin
  2016-03-30  2:31 ` 'Dmitry Torokhov'
  0 siblings, 1 reply; 5+ messages in thread
From: DusonLin @ 2016-03-30  2:02 UTC (permalink / raw)
  To: 'Dmitry Torokhov', Linux-kernel, linux-input
  Cc: 'Charles Mooney', 'jeff', 'Phoenix'

Only ABS_DISTANCE is not enough for upper OS  to distiguish hover event
be triggered from object form faraway to and close touchpad surface or from
object prepare to leave the touchpad surface. We add BNT_TOOL_FINGER to help
it.

                 Object_at_faraway   object_at_hover_area  object_touch_touchpad
      BTN_TOUCH         0                      0                    1
BTN_TOOL_FINGER         0                      1                    1
   ABS_DISTANCE         0                      1                    0

Signed-off by: Duson Lin <dusonlin@emc.com.tw>
---
drivers/input/mouse/elan_i2c_core.c |   14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 2f58985..9392a8c 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -4,7 +4,7 @@
  * Copyright (c) 2013 ELAN Microelectronics Corp.
  *
  * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
- * Version: 1.6.0
+ * Version: 1.6.1
  *
  * Based on cyapa driver:
  * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -845,23 +845,27 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
{
      struct input_dev *input = data->input;
      u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET];
-       int i;
+      int i, valid_count = 0;
      u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
      u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
      bool contact_valid, hover_event;

-       hover_event = hover_info & 0x40;
+      hover_event = (hover_info & 0x40);
      for (i = 0; i < ETP_MAX_FINGERS; i++) {
              contact_valid = tp_info & (1U << (3 + i));
              elan_report_contact(data, i, contact_valid, finger_data);

-               if (contact_valid)
+              if (contact_valid) {
                      finger_data += ETP_FINGER_DATA_LEN;
+                      valid_count++;
+              }
      }

       input_report_key(input, BTN_LEFT, tp_info & 0x01);
+      input_report_key(input, BTN_TOOL_FINGER,
+                      ((hover_event != 0) | (valid_count > 0)));
      input_report_abs(input, ABS_DISTANCE, hover_event != 0);
-       input_mt_report_pointer_emulation(input, true);
+      input_mt_report_pointer_emulation(input, false);
      input_sync(input);
}

-- 
1.7.9.5

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

* Re: [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger
  2016-03-30  2:02 [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger DusonLin
@ 2016-03-30  2:31 ` 'Dmitry Torokhov'
  2016-03-30  9:49   ` DusonLin
  0 siblings, 1 reply; 5+ messages in thread
From: 'Dmitry Torokhov' @ 2016-03-30  2:31 UTC (permalink / raw)
  To: DusonLin
  Cc: Linux-kernel, linux-input, 'Charles Mooney',
	'jeff', 'Phoenix'

Hi Duson,

On Wed, Mar 30, 2016 at 10:02:02AM +0800, DusonLin wrote:
> Only ABS_DISTANCE is not enough for upper OS  to distiguish hover event
> be triggered from object form faraway to and close touchpad surface or from
> object prepare to leave the touchpad surface. We add BNT_TOOL_FINGER to help
> it.
> 
>                  Object_at_faraway   object_at_hover_area  object_touch_touchpad
>       BTN_TOUCH         0                      0                    1
> BTN_TOOL_FINGER         0                      1                    1
>    ABS_DISTANCE         0                      1                    0
> 
> Signed-off by: Duson Lin <dusonlin@emc.com.tw>
> ---
> drivers/input/mouse/elan_i2c_core.c |   14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index 2f58985..9392a8c 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -4,7 +4,7 @@
>   * Copyright (c) 2013 ELAN Microelectronics Corp.
>   *
>   * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
> - * Version: 1.6.0
> + * Version: 1.6.1
>   *
>   * Based on cyapa driver:
>   * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> @@ -845,23 +845,27 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
> {
>       struct input_dev *input = data->input;
>       u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET];
> -       int i;
> +      int i, valid_count = 0;

This appears all whitespace-damaged.

>       u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
>       u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
>       bool contact_valid, hover_event;
> 
> -       hover_event = hover_info & 0x40;
> +      hover_event = (hover_info & 0x40);

We do not need parentheses here.

>       for (i = 0; i < ETP_MAX_FINGERS; i++) {
>               contact_valid = tp_info & (1U << (3 + i));
>               elan_report_contact(data, i, contact_valid, finger_data);
> 
> -               if (contact_valid)
> +              if (contact_valid) {
>                       finger_data += ETP_FINGER_DATA_LEN;
> +                      valid_count++;
> +              }
>       }
> 
>        input_report_key(input, BTN_LEFT, tp_info & 0x01);
> +      input_report_key(input, BTN_TOOL_FINGER,
> +                      ((hover_event != 0) | (valid_count > 0)));

You do not want to use "bitwise or" here.

>       input_report_abs(input, ABS_DISTANCE, hover_event != 0);
> -       input_mt_report_pointer_emulation(input, true);
> +      input_mt_report_pointer_emulation(input, false);

I wonder if we should teach input_mt_report_pointer_emulation() to
handle hover properly.

Thanks.

-- 
Dmitry

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

* RE: [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger
  2016-03-30  2:31 ` 'Dmitry Torokhov'
@ 2016-03-30  9:49   ` DusonLin
  2016-03-31 18:17     ` 'Dmitry Torokhov'
  0 siblings, 1 reply; 5+ messages in thread
From: DusonLin @ 2016-03-30  9:49 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: Linux-kernel, linux-input, 'Charles Mooney',
	'jeff', 'Phoenix'

Hello Dmitry,

Please check my response below, thanks.


-----Original Message-----
From: 'Dmitry Torokhov' [mailto:dmitry.torokhov@gmail.com] 
Sent: Wednesday, March 30, 2016 10:31 AM
To: DusonLin
Cc: Linux-kernel@vger.kernel.org; linux-input@vger.kernel.org; 'Charles Mooney'; 'jeff'; 'Phoenix'
Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger

Hi Duson,

On Wed, Mar 30, 2016 at 10:02:02AM +0800, DusonLin wrote:
> Only ABS_DISTANCE is not enough for upper OS  to distiguish hover 
> event be triggered from object form faraway to and close touchpad 
> surface or from object prepare to leave the touchpad surface. We add 
> BNT_TOOL_FINGER to help it.
> 
>                  Object_at_faraway   object_at_hover_area  object_touch_touchpad
>       BTN_TOUCH         0                      0                    1
> BTN_TOOL_FINGER         0                      1                    1
>    ABS_DISTANCE         0                      1                    0
> 
> Signed-off by: Duson Lin <dusonlin@emc.com.tw>
> ---
> drivers/input/mouse/elan_i2c_core.c |   14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/mouse/elan_i2c_core.c 
> b/drivers/input/mouse/elan_i2c_core.c
> index 2f58985..9392a8c 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -4,7 +4,7 @@
>   * Copyright (c) 2013 ELAN Microelectronics Corp.
>   *
>   * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
> - * Version: 1.6.0
> + * Version: 1.6.1
>   *
>   * Based on cyapa driver:
>   * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> @@ -845,23 +845,27 @@ static void elan_report_absolute(struct 
> elan_tp_data *data, u8 *packet) {
>       struct input_dev *input = data->input;
>       u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET];
> -       int i;
> +      int i, valid_count = 0;

This appears all whitespace-damaged.
[duson] will do.

>       u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
>       u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
>       bool contact_valid, hover_event;
> 
> -       hover_event = hover_info & 0x40;
> +      hover_event = (hover_info & 0x40);

We do not need parentheses here.
[duson] will do.

>       for (i = 0; i < ETP_MAX_FINGERS; i++) {
>               contact_valid = tp_info & (1U << (3 + i));
>               elan_report_contact(data, i, contact_valid, 
> finger_data);
> 
> -               if (contact_valid)
> +              if (contact_valid) {
>                       finger_data += ETP_FINGER_DATA_LEN;
> +                      valid_count++;
> +              }
>       }
> 
>        input_report_key(input, BTN_LEFT, tp_info & 0x01);
> +      input_report_key(input, BTN_TOOL_FINGER,
> +                      ((hover_event != 0) | (valid_count > 0)));

You do not want to use "bitwise or" here.

>       input_report_abs(input, ABS_DISTANCE, hover_event != 0);
> -       input_mt_report_pointer_emulation(input, true);
> +      input_mt_report_pointer_emulation(input, false);

I wonder if we should teach input_mt_report_pointer_emulation() to handle hover properly.
[duson] But, it looks like the hover is not standard function and not all of touchpad support this function, 
       Even though, we still teach inpu_mt_report_pointer_emulation() to handle this function?

Thanks.

--
Dmitry

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

* Re: [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger
  2016-03-30  9:49   ` DusonLin
@ 2016-03-31 18:17     ` 'Dmitry Torokhov'
  0 siblings, 0 replies; 5+ messages in thread
From: 'Dmitry Torokhov' @ 2016-03-31 18:17 UTC (permalink / raw)
  To: DusonLin
  Cc: Linux-kernel, linux-input, 'Charles Mooney',
	'jeff', 'Phoenix'

On Wed, Mar 30, 2016 at 05:49:12PM +0800, DusonLin wrote:
> Hello Dmitry,
> 
> Please check my response below, thanks.
> 
> 
> -----Original Message-----
> From: 'Dmitry Torokhov' [mailto:dmitry.torokhov@gmail.com] 
> Sent: Wednesday, March 30, 2016 10:31 AM
> To: DusonLin
> Cc: Linux-kernel@vger.kernel.org; linux-input@vger.kernel.org; 'Charles Mooney'; 'jeff'; 'Phoenix'
> Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger
> 
> Hi Duson,
> 
> On Wed, Mar 30, 2016 at 10:02:02AM +0800, DusonLin wrote:
> > Only ABS_DISTANCE is not enough for upper OS  to distiguish hover 
> > event be triggered from object form faraway to and close touchpad 
> > surface or from object prepare to leave the touchpad surface. We add 
> > BNT_TOOL_FINGER to help it.
> > 
> >                  Object_at_faraway   object_at_hover_area  object_touch_touchpad
> >       BTN_TOUCH         0                      0                    1
> > BTN_TOOL_FINGER         0                      1                    1
> >    ABS_DISTANCE         0                      1                    0
> > 
> > Signed-off by: Duson Lin <dusonlin@emc.com.tw>
> > ---
> > drivers/input/mouse/elan_i2c_core.c |   14 +++++++++-----
> > 1 file changed, 9 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/input/mouse/elan_i2c_core.c 
> > b/drivers/input/mouse/elan_i2c_core.c
> > index 2f58985..9392a8c 100644
> > --- a/drivers/input/mouse/elan_i2c_core.c
> > +++ b/drivers/input/mouse/elan_i2c_core.c
> > @@ -4,7 +4,7 @@
> >   * Copyright (c) 2013 ELAN Microelectronics Corp.
> >   *
> >   * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
> > - * Version: 1.6.0
> > + * Version: 1.6.1
> >   *
> >   * Based on cyapa driver:
> >   * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> > @@ -845,23 +845,27 @@ static void elan_report_absolute(struct 
> > elan_tp_data *data, u8 *packet) {
> >       struct input_dev *input = data->input;
> >       u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET];
> > -       int i;
> > +      int i, valid_count = 0;
> 
> This appears all whitespace-damaged.
> [duson] will do.
> 
> >       u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
> >       u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
> >       bool contact_valid, hover_event;
> > 
> > -       hover_event = hover_info & 0x40;
> > +      hover_event = (hover_info & 0x40);
> 
> We do not need parentheses here.
> [duson] will do.
> 
> >       for (i = 0; i < ETP_MAX_FINGERS; i++) {
> >               contact_valid = tp_info & (1U << (3 + i));
> >               elan_report_contact(data, i, contact_valid, 
> > finger_data);
> > 
> > -               if (contact_valid)
> > +              if (contact_valid) {
> >                       finger_data += ETP_FINGER_DATA_LEN;
> > +                      valid_count++;
> > +              }
> >       }
> > 
> >        input_report_key(input, BTN_LEFT, tp_info & 0x01);
> > +      input_report_key(input, BTN_TOOL_FINGER,
> > +                      ((hover_event != 0) | (valid_count > 0)));
> 
> You do not want to use "bitwise or" here.
> 
> >       input_report_abs(input, ABS_DISTANCE, hover_event != 0);
> > -       input_mt_report_pointer_emulation(input, true);
> > +      input_mt_report_pointer_emulation(input, false);
> 
> I wonder if we should teach input_mt_report_pointer_emulation() to handle hover properly.
> [duson] But, it looks like the hover is not standard function and not all of touchpad support this function, 
>        Even though, we still teach inpu_mt_report_pointer_emulation() to handle this function?

Yes, something like this:

If device supports ABS_DISTANCE and does not support ABS_MT_DISTANCE and
ABS_DISTANCE != 0 is reported in current frame and there are no other
contacts then report BTN_TOOL_FINGER.

Thanks.

-- 
Dmitry

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

* [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger
@ 2016-03-23  5:43 duson
  0 siblings, 0 replies; 5+ messages in thread
From: duson @ 2016-03-23  5:43 UTC (permalink / raw)
  To: linux-input, linux-kernel, Dmitry Torokhov
  Cc: duson, Charles Mooney, 黃世鵬

Only ABS_DISTANCE is not enough for upper OS  to distiguish hover event
be triggered from object form faraway to and close touchpad surface or from
object prepare to leave the touchpad surface. We add BNT_TOOL_FINGER to help
it.

                                         Object_at_faraway   object_at_hover_area  object_touch_touchpad
             BTN_TOUCH              0                                0                                     1
BTN_TOOL_FINGER              0                               1                                      1
        ABS_DISTANCE              0                               1                                      0

Signed-off by: Duson Lin <dusonlin@emc.com.tw>
---
 drivers/input/mouse/elan_i2c_core.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 2f58985..9392a8c 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -4,7 +4,7 @@
  * Copyright (c) 2013 ELAN Microelectronics Corp.
  *
  * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw>
- * Version: 1.6.0
+ * Version: 1.6.1
  *
  * Based on cyapa driver:
  * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -845,23 +845,27 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
 {
 	struct input_dev *input = data->input;
 	u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET];
-	int i;
+	int i, valid_count = 0;
 	u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
 	u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
 	bool contact_valid, hover_event;
 
-	hover_event = hover_info & 0x40;
+	hover_event = (hover_info & 0x40);
 	for (i = 0; i < ETP_MAX_FINGERS; i++) {
 		contact_valid = tp_info & (1U << (3 + i));
 		elan_report_contact(data, i, contact_valid, finger_data);
 
-		if (contact_valid)
+		if (contact_valid) {
 			finger_data += ETP_FINGER_DATA_LEN;
+			valid_count++;
+		}
 	}
 
 	input_report_key(input, BTN_LEFT, tp_info & 0x01);
+	input_report_key(input, BTN_TOOL_FINGER,
+			((hover_event != 0) | (valid_count > 0)));
 	input_report_abs(input, ABS_DISTANCE, hover_event != 0);
-	input_mt_report_pointer_emulation(input, true);
+	input_mt_report_pointer_emulation(input, false);
 	input_sync(input);
 }
 
-- 
1.7.9.5

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

end of thread, other threads:[~2016-03-31 18:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30  2:02 [PATCH] Input: Change BTN_TOOL_FINGER falg when HOVER event trigger DusonLin
2016-03-30  2:31 ` 'Dmitry Torokhov'
2016-03-30  9:49   ` DusonLin
2016-03-31 18:17     ` 'Dmitry Torokhov'
  -- strict thread matches above, loose matches on Subject: below --
2016-03-23  5:43 duson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).