linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: elan_i2c - Change the hover event from MT to ST
@ 2015-07-07  5:37 duson
  2015-07-07 18:06 ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: duson @ 2015-07-07  5:37 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input, linux-kernel

We want the hover event like BTN_LEFT, even no contract object,
it still can be reported to upper OS system.

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

diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 62641f2..5b5f403 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -771,7 +771,7 @@ static const struct attribute_group *elan_sysfs_groups[] = {
  */
 static void elan_report_contact(struct elan_tp_data *data,
 				int contact_num, bool contact_valid,
-				bool hover_event, u8 *finger_data)
+				u8 *finger_data)
 {
 	struct input_dev *input = data->input;
 	unsigned int pos_x, pos_y;
@@ -815,9 +815,7 @@ static void elan_report_contact(struct elan_tp_data *data,
 		input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
 		input_report_abs(input, ABS_MT_POSITION_X, pos_x);
 		input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y);
-		input_report_abs(input, ABS_MT_DISTANCE, hover_event);
-		input_report_abs(input, ABS_MT_PRESSURE,
-				 hover_event ? 0 : scaled_pressure);
+		input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure);
 		input_report_abs(input, ABS_TOOL_WIDTH, mk_x);
 		input_report_abs(input, ABS_MT_TOUCH_MAJOR, major);
 		input_report_abs(input, ABS_MT_TOUCH_MINOR, minor);
@@ -839,14 +837,14 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
 	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, hover_event,
-				    finger_data);
+		elan_report_contact(data, i, contact_valid, finger_data);
 
 		if (contact_valid)
 			finger_data += ETP_FINGER_DATA_LEN;
 	}
 
 	input_report_key(input, BTN_LEFT, tp_info & 0x01);
+	input_report_abs(input, ABS_DISTANCE, hover_event != 0);
 	input_mt_report_pointer_emulation(input, true);
 	input_sync(input);
 }
@@ -922,6 +920,7 @@ static int elan_setup_input_device(struct elan_tp_data *data)
 	input_abs_set_res(input, ABS_Y, data->y_res);
 	input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0);
 	input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0);
+	input_set_abs_params(input, ABS_DISTANCE, 0, 1, 0, 0);
 
 	/* And MT parameters */
 	input_set_abs_params(input, ABS_MT_POSITION_X, 0, data->max_x, 0, 0);
@@ -934,7 +933,6 @@ static int elan_setup_input_device(struct elan_tp_data *data)
 			     ETP_FINGER_WIDTH * max_width, 0, 0);
 	input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0,
 			     ETP_FINGER_WIDTH * min_width, 0, 0);
-	input_set_abs_params(input, ABS_MT_DISTANCE, 0, 1, 0, 0);
 
 	data->input = input;






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

* Re: [PATCH] Input: elan_i2c - Change the hover event from MT to ST
  2015-07-07  5:37 [PATCH] Input: elan_i2c - Change the hover event from MT to ST duson
@ 2015-07-07 18:06 ` Dmitry Torokhov
  2015-07-08 22:58   ` Benjamin Tissoires
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2015-07-07 18:06 UTC (permalink / raw)
  To: duson; +Cc: linux-input, linux-kernel

On Tue, Jul 07, 2015 at 01:37:14PM +0800, duson wrote:
> We want the hover event like BTN_LEFT, even no contract object,
> it still can be reported to upper OS system.
> 
> Signed-off by: Duson Lin <dusonlin@emc.com.tw>

Applied, thank you.

> ---
>  drivers/input/mouse/elan_i2c_core.c |   12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index 62641f2..5b5f403 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -771,7 +771,7 @@ static const struct attribute_group *elan_sysfs_groups[] = {
>   */
>  static void elan_report_contact(struct elan_tp_data *data,
>  				int contact_num, bool contact_valid,
> -				bool hover_event, u8 *finger_data)
> +				u8 *finger_data)
>  {
>  	struct input_dev *input = data->input;
>  	unsigned int pos_x, pos_y;
> @@ -815,9 +815,7 @@ static void elan_report_contact(struct elan_tp_data *data,
>  		input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
>  		input_report_abs(input, ABS_MT_POSITION_X, pos_x);
>  		input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y);
> -		input_report_abs(input, ABS_MT_DISTANCE, hover_event);
> -		input_report_abs(input, ABS_MT_PRESSURE,
> -				 hover_event ? 0 : scaled_pressure);
> +		input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure);
>  		input_report_abs(input, ABS_TOOL_WIDTH, mk_x);
>  		input_report_abs(input, ABS_MT_TOUCH_MAJOR, major);
>  		input_report_abs(input, ABS_MT_TOUCH_MINOR, minor);
> @@ -839,14 +837,14 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
>  	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, hover_event,
> -				    finger_data);
> +		elan_report_contact(data, i, contact_valid, finger_data);
>  
>  		if (contact_valid)
>  			finger_data += ETP_FINGER_DATA_LEN;
>  	}
>  
>  	input_report_key(input, BTN_LEFT, tp_info & 0x01);
> +	input_report_abs(input, ABS_DISTANCE, hover_event != 0);
>  	input_mt_report_pointer_emulation(input, true);
>  	input_sync(input);
>  }
> @@ -922,6 +920,7 @@ static int elan_setup_input_device(struct elan_tp_data *data)
>  	input_abs_set_res(input, ABS_Y, data->y_res);
>  	input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0);
>  	input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0);
> +	input_set_abs_params(input, ABS_DISTANCE, 0, 1, 0, 0);
>  
>  	/* And MT parameters */
>  	input_set_abs_params(input, ABS_MT_POSITION_X, 0, data->max_x, 0, 0);
> @@ -934,7 +933,6 @@ static int elan_setup_input_device(struct elan_tp_data *data)
>  			     ETP_FINGER_WIDTH * max_width, 0, 0);
>  	input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0,
>  			     ETP_FINGER_WIDTH * min_width, 0, 0);
> -	input_set_abs_params(input, ABS_MT_DISTANCE, 0, 1, 0, 0);
>  
>  	data->input = input;
> 
> 
> 
> 
> 

-- 
Dmitry

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

* Re: [PATCH] Input: elan_i2c - Change the hover event from MT to ST
  2015-07-07 18:06 ` Dmitry Torokhov
@ 2015-07-08 22:58   ` Benjamin Tissoires
  2015-07-08 23:11     ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Tissoires @ 2015-07-08 22:58 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: duson, linux-input, linux-kernel@vger.kernel.org, Peter Hutterer

On Tue, Jul 7, 2015 at 2:06 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Tue, Jul 07, 2015 at 01:37:14PM +0800, duson wrote:
>> We want the hover event like BTN_LEFT, even no contract object,
>> it still can be reported to upper OS system.
>>
>> Signed-off by: Duson Lin <dusonlin@emc.com.tw>
>
> Applied, thank you.

Sorry for waking up too late but I am not sure we want this patch.

Why do we need to remove the ABS_MT_DISTANCE bits? I can understand
that we would want to to have ABS_DISTANCE for the pointer emulation,
but removing the per-finger information does not make much sense.
libinput knows now how to deal with per-finger hovering through
ABS_MT_DISTANCE, and you are just breaking the touchpad/screens with
this patch.

Cheers,
Benjamin

>
>> ---
>>  drivers/input/mouse/elan_i2c_core.c |   12 +++++-------
>>  1 file changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
>> index 62641f2..5b5f403 100644
>> --- a/drivers/input/mouse/elan_i2c_core.c
>> +++ b/drivers/input/mouse/elan_i2c_core.c
>> @@ -771,7 +771,7 @@ static const struct attribute_group *elan_sysfs_groups[] = {
>>   */
>>  static void elan_report_contact(struct elan_tp_data *data,
>>                               int contact_num, bool contact_valid,
>> -                             bool hover_event, u8 *finger_data)
>> +                             u8 *finger_data)
>>  {
>>       struct input_dev *input = data->input;
>>       unsigned int pos_x, pos_y;
>> @@ -815,9 +815,7 @@ static void elan_report_contact(struct elan_tp_data *data,
>>               input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
>>               input_report_abs(input, ABS_MT_POSITION_X, pos_x);
>>               input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y);
>> -             input_report_abs(input, ABS_MT_DISTANCE, hover_event);
>> -             input_report_abs(input, ABS_MT_PRESSURE,
>> -                              hover_event ? 0 : scaled_pressure);
>> +             input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure);
>>               input_report_abs(input, ABS_TOOL_WIDTH, mk_x);
>>               input_report_abs(input, ABS_MT_TOUCH_MAJOR, major);
>>               input_report_abs(input, ABS_MT_TOUCH_MINOR, minor);
>> @@ -839,14 +837,14 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
>>       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, hover_event,
>> -                                 finger_data);
>> +             elan_report_contact(data, i, contact_valid, finger_data);
>>
>>               if (contact_valid)
>>                       finger_data += ETP_FINGER_DATA_LEN;
>>       }
>>
>>       input_report_key(input, BTN_LEFT, tp_info & 0x01);
>> +     input_report_abs(input, ABS_DISTANCE, hover_event != 0);
>>       input_mt_report_pointer_emulation(input, true);
>>       input_sync(input);
>>  }
>> @@ -922,6 +920,7 @@ static int elan_setup_input_device(struct elan_tp_data *data)
>>       input_abs_set_res(input, ABS_Y, data->y_res);
>>       input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0);
>>       input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0);
>> +     input_set_abs_params(input, ABS_DISTANCE, 0, 1, 0, 0);
>>
>>       /* And MT parameters */
>>       input_set_abs_params(input, ABS_MT_POSITION_X, 0, data->max_x, 0, 0);
>> @@ -934,7 +933,6 @@ static int elan_setup_input_device(struct elan_tp_data *data)
>>                            ETP_FINGER_WIDTH * max_width, 0, 0);
>>       input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0,
>>                            ETP_FINGER_WIDTH * min_width, 0, 0);
>> -     input_set_abs_params(input, ABS_MT_DISTANCE, 0, 1, 0, 0);
>>
>>       data->input = input;
>>
>>
>>
>>
>>
>
> --
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH] Input: elan_i2c - Change the hover event from MT to ST
  2015-07-08 22:58   ` Benjamin Tissoires
@ 2015-07-08 23:11     ` Dmitry Torokhov
  2015-07-08 23:24       ` Benjamin Tissoires
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2015-07-08 23:11 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: duson, linux-input, linux-kernel@vger.kernel.org, Peter Hutterer

On Wed, Jul 08, 2015 at 06:58:36PM -0400, Benjamin Tissoires wrote:
> On Tue, Jul 7, 2015 at 2:06 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Tue, Jul 07, 2015 at 01:37:14PM +0800, duson wrote:
> >> We want the hover event like BTN_LEFT, even no contract object,
> >> it still can be reported to upper OS system.
> >>
> >> Signed-off by: Duson Lin <dusonlin@emc.com.tw>
> >
> > Applied, thank you.
> 
> Sorry for waking up too late but I am not sure we want this patch.
> 
> Why do we need to remove the ABS_MT_DISTANCE bits? I can understand
> that we would want to to have ABS_DISTANCE for the pointer emulation,
> but removing the per-finger information does not make much sense.
> libinput knows now how to deal with per-finger hovering through
> ABS_MT_DISTANCE, and you are just breaking the touchpad/screens with
> this patch.

Because the device does not provide per-finger information about
hovering. It can only tell that there is "something" hovering over the
surface, but it doe snot provide the data that there are 2 fingers
hovering or that finger 1 was in contact but now is hovering, etc.

Thanks.

-- 
Dmitry

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

* Re: [PATCH] Input: elan_i2c - Change the hover event from MT to ST
  2015-07-08 23:11     ` Dmitry Torokhov
@ 2015-07-08 23:24       ` Benjamin Tissoires
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Tissoires @ 2015-07-08 23:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: duson, linux-input, linux-kernel@vger.kernel.org, Peter Hutterer

On Wed, Jul 8, 2015 at 7:11 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Jul 08, 2015 at 06:58:36PM -0400, Benjamin Tissoires wrote:
>> On Tue, Jul 7, 2015 at 2:06 PM, Dmitry Torokhov
>> <dmitry.torokhov@gmail.com> wrote:
>> > On Tue, Jul 07, 2015 at 01:37:14PM +0800, duson wrote:
>> >> We want the hover event like BTN_LEFT, even no contract object,
>> >> it still can be reported to upper OS system.
>> >>
>> >> Signed-off by: Duson Lin <dusonlin@emc.com.tw>
>> >
>> > Applied, thank you.
>>
>> Sorry for waking up too late but I am not sure we want this patch.
>>
>> Why do we need to remove the ABS_MT_DISTANCE bits? I can understand
>> that we would want to to have ABS_DISTANCE for the pointer emulation,
>> but removing the per-finger information does not make much sense.
>> libinput knows now how to deal with per-finger hovering through
>> ABS_MT_DISTANCE, and you are just breaking the touchpad/screens with
>> this patch.
>
> Because the device does not provide per-finger information about
> hovering. It can only tell that there is "something" hovering over the
> surface, but it doe snot provide the data that there are 2 fingers
> hovering or that finger 1 was in contact but now is hovering, etc.
>

OK, I see now. I have then no opinion on the patch itself (not sure
any client uses ABS_DISTANCE) :)

Cheers,
Benjamin

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

end of thread, other threads:[~2015-07-08 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07  5:37 [PATCH] Input: elan_i2c - Change the hover event from MT to ST duson
2015-07-07 18:06 ` Dmitry Torokhov
2015-07-08 22:58   ` Benjamin Tissoires
2015-07-08 23:11     ` Dmitry Torokhov
2015-07-08 23:24       ` Benjamin Tissoires

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).