linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Johnny Chuang <johnny.chuang.emc@gmail.com>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	Rob Schonberger <robsc@google.com>,
	Johnny Chuang <johnny.chuang@emc.com.tw>,
	James Chen <james.chen@emc.com.tw>,
	Jennifer Tsai <jennifer.tsai@emc.com.tw>,
	Paul Liang <paul.liang@emc.com.tw>,
	Jeff Chuang <jeff.chuang@emc.com.tw>
Subject: Re: [PATCH v2] Input: elants_i2c - support palm detection
Date: Thu, 9 Apr 2020 12:51:44 -0700	[thread overview]
Message-ID: <20200409195144.GO75430@dtor-ws> (raw)
In-Reply-To: <20200330225317.GB169282@jelly>

On Tue, Mar 31, 2020 at 08:53:17AM +1000, Peter Hutterer wrote:
> On Mon, Mar 30, 2020 at 03:02:36PM +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>
> 
> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
> 
> Cheers,
>    Peter
>    
> > ---
> > Changes in v2:
> > 	- Modify MT_TOOL_MAX to MT_TOOL_PALM
> > 
> >  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..93211fe 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;

I changed this to

	tool_type = buf[FW_POS_TOOL_TYPE] & BIT(0) ?
			MT_TOOL_FINGER : MT_TOOL_PALM;

to be a bit more compact, and applied.

Thanks.

-- 
Dmitry

      reply	other threads:[~2020-04-09 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  7:02 [PATCH v2] Input: elants_i2c - support palm detection Johnny Chuang
2020-03-30 22:53 ` Peter Hutterer
2020-04-09 19:51   ` Dmitry Torokhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409195144.GO75430@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=james.chen@emc.com.tw \
    --cc=jeff.chuang@emc.com.tw \
    --cc=jennifer.tsai@emc.com.tw \
    --cc=johnny.chuang.emc@gmail.com \
    --cc=johnny.chuang@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.liang@emc.com.tw \
    --cc=peter.hutterer@who-t.net \
    --cc=robsc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).