Linux Input Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Input: elants_i2c - support palm detection
@ 2020-03-26  7:58 Johnny Chuang
  2020-03-29  2:14 ` Peter Hutterer
  0 siblings, 1 reply; 5+ messages in thread
From: Johnny Chuang @ 2020-03-26  7:58 UTC (permalink / raw)
  To: Dmitry Torokhov, Benjamin Tissoires, Peter Hutterer,
	linux-kernel, linux-input, Rob Schonberger, Johnny Chuang
  Cc: James Chen, Jennifer Tsai, Paul Liang, Jeff Chuang

From: Johnny Chuang <johnny.chuang@emc.com.tw>

Elan define finger/palm detection on the least significant bit of byte 33.
The default value is 1 for all firmwares, which report as MT_TOOL_FINGER.
If firmware support palm detection, the bit will change to 0 and
report as MT_TOOL_PALM when firmware detecting palm.

Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
---
 drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 14c577c..3b4d9eb3 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -73,6 +73,7 @@
 #define FW_POS_STATE		1
 #define FW_POS_TOTAL		2
 #define FW_POS_XY		3
+#define FW_POS_TOOL_TYPE	33
 #define FW_POS_CHECKSUM		34
 #define FW_POS_WIDTH		35
 #define FW_POS_PRESSURE		45
@@ -842,6 +843,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
 {
 	struct input_dev *input = ts->input;
 	unsigned int n_fingers;
+	unsigned int tool_type;
 	u16 finger_state;
 	int i;
 
@@ -852,6 +854,12 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
 	dev_dbg(&ts->client->dev,
 		"n_fingers: %u, state: %04x\n",  n_fingers, finger_state);
 
+	/* Note: all fingers have the same tool type */
+	if (buf[FW_POS_TOOL_TYPE] & 0x01)
+		tool_type = MT_TOOL_FINGER;
+	else
+		tool_type = MT_TOOL_PALM;
+
 	for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) {
 		if (finger_state & 1) {
 			unsigned int x, y, p, w;
@@ -867,7 +875,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
 				i, x, y, p, w);
 
 			input_mt_slot(input, i);
-			input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
+			input_mt_report_slot_state(input, tool_type, true);
 			input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
 			input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
 			input_event(input, EV_ABS, ABS_MT_PRESSURE, p);
@@ -1307,6 +1315,7 @@ static int elants_i2c_probe(struct i2c_client *client,
 	input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0, 0);
 	input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
 	input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0);
+	input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0);
 	input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
 	input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
 	input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);
-- 
2.7.4


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

* Re: [PATCH] Input: elants_i2c - support palm detection
  2020-03-26  7:58 [PATCH] Input: elants_i2c - support palm detection Johnny Chuang
@ 2020-03-29  2:14 ` Peter Hutterer
  2020-03-30  0:59   ` Johnny.Chuang
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Hutterer @ 2020-03-29  2:14 UTC (permalink / raw)
  To: Johnny Chuang
  Cc: Dmitry Torokhov, Benjamin Tissoires, linux-kernel, linux-input,
	Rob Schonberger, Johnny Chuang, James Chen, Jennifer Tsai,
	Paul Liang, Jeff Chuang

On Thu, Mar 26, 2020 at 03:58:45PM +0800, Johnny Chuang wrote:
> From: Johnny Chuang <johnny.chuang@emc.com.tw>
> 
> Elan define finger/palm detection on the least significant bit of byte 33.
> The default value is 1 for all firmwares, which report as MT_TOOL_FINGER.
> If firmware support palm detection, the bit will change to 0 and
> report as MT_TOOL_PALM when firmware detecting palm.
> 
> Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
> ---
>  drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 14c577c..3b4d9eb3 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -73,6 +73,7 @@
>  #define FW_POS_STATE		1
>  #define FW_POS_TOTAL		2
>  #define FW_POS_XY		3
> +#define FW_POS_TOOL_TYPE	33
>  #define FW_POS_CHECKSUM		34
>  #define FW_POS_WIDTH		35
>  #define FW_POS_PRESSURE		45
> @@ -842,6 +843,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
>  {
>  	struct input_dev *input = ts->input;
>  	unsigned int n_fingers;
> +	unsigned int tool_type;
>  	u16 finger_state;
>  	int i;
>  
> @@ -852,6 +854,12 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
>  	dev_dbg(&ts->client->dev,
>  		"n_fingers: %u, state: %04x\n",  n_fingers, finger_state);
>  
> +	/* Note: all fingers have the same tool type */
> +	if (buf[FW_POS_TOOL_TYPE] & 0x01)
> +		tool_type = MT_TOOL_FINGER;
> +	else
> +		tool_type = MT_TOOL_PALM;
> +
>  	for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) {
>  		if (finger_state & 1) {
>  			unsigned int x, y, p, w;
> @@ -867,7 +875,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
>  				i, x, y, p, w);
>  
>  			input_mt_slot(input, i);
> -			input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
> +			input_mt_report_slot_state(input, tool_type, true);
>  			input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
>  			input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
>  			input_event(input, EV_ABS, ABS_MT_PRESSURE, p);
> @@ -1307,6 +1315,7 @@ static int elants_i2c_probe(struct i2c_client *client,
>  	input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0, 0);
>  	input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
>  	input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0);
> +	input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0);

if you're only reporting pen and palm, can we set this to MT_TOOL_PALM
instead? Otherwise you're indicating you may also send MT_TOOL_DIAL which is
unlikely on this hardware :)

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> otherwise

Cheers,
   Peter

>  	input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
>  	input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
>  	input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);
> -- 
> 2.7.4
> 

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

* RE: [PATCH] Input: elants_i2c - support palm detection
  2020-03-29  2:14 ` Peter Hutterer
@ 2020-03-30  0:59   ` Johnny.Chuang
  2020-03-30  3:47     ` Peter Hutterer
  0 siblings, 1 reply; 5+ messages in thread
From: Johnny.Chuang @ 2020-03-30  0:59 UTC (permalink / raw)
  To: 'Peter Hutterer', 'Johnny Chuang'
  Cc: 'Dmitry Torokhov', 'Benjamin Tissoires',
	linux-kernel, linux-input, 'Rob Schonberger',
	'James Chen', 'Jennifer Tsai',
	'Paul Liang', 'Jeff Chuang'

> -----Original Message-----
> From: Peter Hutterer [mailto:peter.hutterer@who-t.net]
> Sent: Sunday, March 29, 2020 10:15 AM
> To: Johnny Chuang
> Cc: Dmitry Torokhov; Benjamin Tissoires; linux-kernel@vger.kernel.org;
> linux-input@vger.kernel.org; Rob Schonberger; Johnny Chuang; James Chen;
> Jennifer Tsai; Paul Liang; Jeff Chuang
> Subject: Re: [PATCH] Input: elants_i2c - support palm detection
> 
> On Thu, Mar 26, 2020 at 03:58:45PM +0800, Johnny Chuang wrote:
> > From: Johnny Chuang <johnny.chuang@emc.com.tw>
> >
> > Elan define finger/palm detection on the least significant bit of byte
33.
> > The default value is 1 for all firmwares, which report as
MT_TOOL_FINGER.
> > If firmware support palm detection, the bit will change to 0 and
> > report as MT_TOOL_PALM when firmware detecting palm.
> >
> > Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
> > ---
> >  drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/input/touchscreen/elants_i2c.c
> > b/drivers/input/touchscreen/elants_i2c.c
> > index 14c577c..3b4d9eb3 100644
> > --- a/drivers/input/touchscreen/elants_i2c.c
> > +++ b/drivers/input/touchscreen/elants_i2c.c
> > @@ -73,6 +73,7 @@
> >  #define FW_POS_STATE		1
> >  #define FW_POS_TOTAL		2
> >  #define FW_POS_XY		3
> > +#define FW_POS_TOOL_TYPE	33
> >  #define FW_POS_CHECKSUM		34
> >  #define FW_POS_WIDTH		35
> >  #define FW_POS_PRESSURE		45
> > @@ -842,6 +843,7 @@ static void elants_i2c_mt_event(struct elants_data
> > *ts, u8 *buf)  {
> >  	struct input_dev *input = ts->input;
> >  	unsigned int n_fingers;
> > +	unsigned int tool_type;
> >  	u16 finger_state;
> >  	int i;
> >
> > @@ -852,6 +854,12 @@ static void elants_i2c_mt_event(struct elants_data
> *ts, u8 *buf)
> >  	dev_dbg(&ts->client->dev,
> >  		"n_fingers: %u, state: %04x\n",  n_fingers, finger_state);
> >
> > +	/* Note: all fingers have the same tool type */
> > +	if (buf[FW_POS_TOOL_TYPE] & 0x01)
> > +		tool_type = MT_TOOL_FINGER;
> > +	else
> > +		tool_type = MT_TOOL_PALM;
> > +
> >  	for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) {
> >  		if (finger_state & 1) {
> >  			unsigned int x, y, p, w;
> > @@ -867,7 +875,7 @@ static void elants_i2c_mt_event(struct elants_data
> *ts, u8 *buf)
> >  				i, x, y, p, w);
> >
> >  			input_mt_slot(input, i);
> > -			input_mt_report_slot_state(input, MT_TOOL_FINGER,
true);
> > +			input_mt_report_slot_state(input, tool_type, true);
> >  			input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
> >  			input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
> >  			input_event(input, EV_ABS, ABS_MT_PRESSURE, p); @@
> -1307,6 +1315,7
> > @@ static int elants_i2c_probe(struct i2c_client *client,
> >  	input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0,
> 0);
> >  	input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
> >  	input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0);
> > +	input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 0,
> MT_TOOL_MAX, 0,
> > +0);
> 
> if you're only reporting pen and palm, can we set this to MT_TOOL_PALM
> instead? Otherwise you're indicating you may also send MT_TOOL_DIAL which
> is unlikely on this hardware :)
> 

Yes, we do not have MT_TOOL_DIAL on touch screen.
So I need to modify MT_TOOL_MAX to MT_TOOL_PALM, right?

> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> otherwise
> 
> Cheers,
>    Peter
> 
> >  	input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
> >  	input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
> >  	input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);
> > --
> > 2.7.4
> >


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

* Re: [PATCH] Input: elants_i2c - support palm detection
  2020-03-30  0:59   ` Johnny.Chuang
@ 2020-03-30  3:47     ` Peter Hutterer
  2020-03-30  5:45       ` Johnny.Chuang
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Hutterer @ 2020-03-30  3:47 UTC (permalink / raw)
  To: Johnny.Chuang
  Cc: 'Johnny Chuang', 'Dmitry Torokhov',
	'Benjamin Tissoires',
	linux-kernel, linux-input, 'Rob Schonberger',
	'James Chen', 'Jennifer Tsai',
	'Paul Liang', 'Jeff Chuang'

On Mon, Mar 30, 2020 at 08:59:51AM +0800, Johnny.Chuang wrote:
> > -----Original Message-----
> > From: Peter Hutterer [mailto:peter.hutterer@who-t.net]
> > Sent: Sunday, March 29, 2020 10:15 AM
> > To: Johnny Chuang
> > Cc: Dmitry Torokhov; Benjamin Tissoires; linux-kernel@vger.kernel.org;
> > linux-input@vger.kernel.org; Rob Schonberger; Johnny Chuang; James Chen;
> > Jennifer Tsai; Paul Liang; Jeff Chuang
> > Subject: Re: [PATCH] Input: elants_i2c - support palm detection
> > 
> > On Thu, Mar 26, 2020 at 03:58:45PM +0800, Johnny Chuang wrote:
> > > From: Johnny Chuang <johnny.chuang@emc.com.tw>
> > >
> > > Elan define finger/palm detection on the least significant bit of byte
> 33.
> > > The default value is 1 for all firmwares, which report as
> MT_TOOL_FINGER.
> > > If firmware support palm detection, the bit will change to 0 and
> > > report as MT_TOOL_PALM when firmware detecting palm.
> > >
> > > Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
> > > ---
> > >  drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
> > >  1 file changed, 10 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/input/touchscreen/elants_i2c.c
> > > b/drivers/input/touchscreen/elants_i2c.c
> > > index 14c577c..3b4d9eb3 100644
> > > --- a/drivers/input/touchscreen/elants_i2c.c
> > > +++ b/drivers/input/touchscreen/elants_i2c.c
> > > @@ -73,6 +73,7 @@
> > >  #define FW_POS_STATE		1
> > >  #define FW_POS_TOTAL		2
> > >  #define FW_POS_XY		3
> > > +#define FW_POS_TOOL_TYPE	33
> > >  #define FW_POS_CHECKSUM		34
> > >  #define FW_POS_WIDTH		35
> > >  #define FW_POS_PRESSURE		45
> > > @@ -842,6 +843,7 @@ static void elants_i2c_mt_event(struct elants_data
> > > *ts, u8 *buf)  {
> > >  	struct input_dev *input = ts->input;
> > >  	unsigned int n_fingers;
> > > +	unsigned int tool_type;
> > >  	u16 finger_state;
> > >  	int i;
> > >
> > > @@ -852,6 +854,12 @@ static void elants_i2c_mt_event(struct elants_data
> > *ts, u8 *buf)
> > >  	dev_dbg(&ts->client->dev,
> > >  		"n_fingers: %u, state: %04x\n",  n_fingers, finger_state);
> > >
> > > +	/* Note: all fingers have the same tool type */
> > > +	if (buf[FW_POS_TOOL_TYPE] & 0x01)
> > > +		tool_type = MT_TOOL_FINGER;
> > > +	else
> > > +		tool_type = MT_TOOL_PALM;
> > > +
> > >  	for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) {
> > >  		if (finger_state & 1) {
> > >  			unsigned int x, y, p, w;
> > > @@ -867,7 +875,7 @@ static void elants_i2c_mt_event(struct elants_data
> > *ts, u8 *buf)
> > >  				i, x, y, p, w);
> > >
> > >  			input_mt_slot(input, i);
> > > -			input_mt_report_slot_state(input, MT_TOOL_FINGER,
> true);
> > > +			input_mt_report_slot_state(input, tool_type, true);
> > >  			input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
> > >  			input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
> > >  			input_event(input, EV_ABS, ABS_MT_PRESSURE, p); @@
> > -1307,6 +1315,7
> > > @@ static int elants_i2c_probe(struct i2c_client *client,
> > >  	input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0,
> > 0);
> > >  	input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
> > >  	input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0);
> > > +	input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 0,
> > MT_TOOL_MAX, 0,
> > > +0);
> > 
> > if you're only reporting pen and palm, can we set this to MT_TOOL_PALM
> > instead? Otherwise you're indicating you may also send MT_TOOL_DIAL which
> > is unlikely on this hardware :)
> > 
> 
> Yes, we do not have MT_TOOL_DIAL on touch screen.
> So I need to modify MT_TOOL_MAX to MT_TOOL_PALM, right?

yes please.

Cheers,
   Peter

> 
> > Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> otherwise
> > 
> > Cheers,
> >    Peter
> > 
> > >  	input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
> > >  	input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
> > >  	input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);
> > > --
> > > 2.7.4
> > >
> 

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

* RE: [PATCH] Input: elants_i2c - support palm detection
  2020-03-30  3:47     ` Peter Hutterer
@ 2020-03-30  5:45       ` Johnny.Chuang
  0 siblings, 0 replies; 5+ messages in thread
From: Johnny.Chuang @ 2020-03-30  5:45 UTC (permalink / raw)
  To: 'Peter Hutterer'
  Cc: 'Johnny Chuang', 'Dmitry Torokhov',
	'Benjamin Tissoires',
	linux-kernel, linux-input, 'Rob Schonberger',
	'James Chen', 'Jennifer Tsai',
	'Paul Liang', 'Jeff Chuang'

> -----Original Message-----
> From: Peter Hutterer [mailto:peter.hutterer@who-t.net]
> Sent: Monday, March 30, 2020 11:48 AM
> To: Johnny.Chuang
> Cc: 'Johnny Chuang'; 'Dmitry Torokhov'; 'Benjamin Tissoires';
> linux-kernel@vger.kernel.org; linux-input@vger.kernel.org; 'Rob
Schonberger';
> 'James Chen'; 'Jennifer Tsai'; 'Paul Liang'; 'Jeff Chuang'
> Subject: Re: [PATCH] Input: elants_i2c - support palm detection
> 
> On Mon, Mar 30, 2020 at 08:59:51AM +0800, Johnny.Chuang wrote:
> > > -----Original Message-----
> > > From: Peter Hutterer [mailto:peter.hutterer@who-t.net]
> > > Sent: Sunday, March 29, 2020 10:15 AM
> > > To: Johnny Chuang
> > > Cc: Dmitry Torokhov; Benjamin Tissoires; linux-kernel@vger.kernel.org;
> > > linux-input@vger.kernel.org; Rob Schonberger; Johnny Chuang; James
> Chen;
> > > Jennifer Tsai; Paul Liang; Jeff Chuang
> > > Subject: Re: [PATCH] Input: elants_i2c - support palm detection
> > >
> > > On Thu, Mar 26, 2020 at 03:58:45PM +0800, Johnny Chuang wrote:
> > > > From: Johnny Chuang <johnny.chuang@emc.com.tw>
> > > >
> > > > Elan define finger/palm detection on the least significant bit of
byte
> > 33.
> > > > The default value is 1 for all firmwares, which report as
> > MT_TOOL_FINGER.
> > > > If firmware support palm detection, the bit will change to 0 and
> > > > report as MT_TOOL_PALM when firmware detecting palm.
> > > >
> > > > Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
> > > > ---
> > > >  drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++-
> > > >  1 file changed, 10 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/input/touchscreen/elants_i2c.c
> > > > b/drivers/input/touchscreen/elants_i2c.c
> > > > index 14c577c..3b4d9eb3 100644
> > > > --- a/drivers/input/touchscreen/elants_i2c.c
> > > > +++ b/drivers/input/touchscreen/elants_i2c.c
> > > > @@ -73,6 +73,7 @@
> > > >  #define FW_POS_STATE		1
> > > >  #define FW_POS_TOTAL		2
> > > >  #define FW_POS_XY		3
> > > > +#define FW_POS_TOOL_TYPE	33
> > > >  #define FW_POS_CHECKSUM		34
> > > >  #define FW_POS_WIDTH		35
> > > >  #define FW_POS_PRESSURE		45
> > > > @@ -842,6 +843,7 @@ static void elants_i2c_mt_event(struct
> elants_data
> > > > *ts, u8 *buf)  {
> > > >  	struct input_dev *input = ts->input;
> > > >  	unsigned int n_fingers;
> > > > +	unsigned int tool_type;
> > > >  	u16 finger_state;
> > > >  	int i;
> > > >
> > > > @@ -852,6 +854,12 @@ static void elants_i2c_mt_event(struct
> elants_data
> > > *ts, u8 *buf)
> > > >  	dev_dbg(&ts->client->dev,
> > > >  		"n_fingers: %u, state: %04x\n",  n_fingers,
finger_state);
> > > >
> > > > +	/* Note: all fingers have the same tool type */
> > > > +	if (buf[FW_POS_TOOL_TYPE] & 0x01)
> > > > +		tool_type = MT_TOOL_FINGER;
> > > > +	else
> > > > +		tool_type = MT_TOOL_PALM;
> > > > +
> > > >  	for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) {
> > > >  		if (finger_state & 1) {
> > > >  			unsigned int x, y, p, w;
> > > > @@ -867,7 +875,7 @@ static void elants_i2c_mt_event(struct
> elants_data
> > > *ts, u8 *buf)
> > > >  				i, x, y, p, w);
> > > >
> > > >  			input_mt_slot(input, i);
> > > > -			input_mt_report_slot_state(input,
MT_TOOL_FINGER,
> > true);
> > > > +			input_mt_report_slot_state(input, tool_type,
true);
> > > >  			input_event(input, EV_ABS,
ABS_MT_POSITION_X, x);
> > > >  			input_event(input, EV_ABS,
ABS_MT_POSITION_Y, y);
> > > >  			input_event(input, EV_ABS, ABS_MT_PRESSURE,
p); @@
> > > -1307,6 +1315,7
> > > > @@ static int elants_i2c_probe(struct i2c_client *client,
> > > >  	input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0,
ts->y_max,
> 0,
> > > 0);
> > > >  	input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255,
0,
> 0);
> > > >  	input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0,
0);
> > > > +	input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 0,
> > > MT_TOOL_MAX, 0,
> > > > +0);
> > >
> > > if you're only reporting pen and palm, can we set this to MT_TOOL_PALM
> > > instead? Otherwise you're indicating you may also send MT_TOOL_DIAL
> which
> > > is unlikely on this hardware :)
> > >
> >
> > Yes, we do not have MT_TOOL_DIAL on touch screen.
> > So I need to modify MT_TOOL_MAX to MT_TOOL_PALM, right?
> 
> yes please.
> 
> Cheers,
>    Peter
> 

OK, I will submit patch v2 today.

> >
> > > Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> otherwise
> > >
> > > Cheers,
> > >    Peter
> > >
> > > >  	input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
> > > >  	input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
> > > >  	input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);
> > > > --
> > > > 2.7.4
> > > >
> >


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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26  7:58 [PATCH] Input: elants_i2c - support palm detection Johnny Chuang
2020-03-29  2:14 ` Peter Hutterer
2020-03-30  0:59   ` Johnny.Chuang
2020-03-30  3:47     ` Peter Hutterer
2020-03-30  5:45       ` Johnny.Chuang

Linux Input Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-input/0 linux-input/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-input linux-input/ https://lore.kernel.org/linux-input \
		linux-input@vger.kernel.org
	public-inbox-index linux-input

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-input


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git