linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hutterer <peter.hutterer@who-t.net>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>,
	Henrik Rydberg <rydberg@bitmath.org>,
	Andi Shyti <andi@etezian.org>,
	Stephan Gerhold <stephan@gerhold.net>,
	linux-input@vger.kernel.org, Javi Ferrer <javi.f.o@gmail.com>
Subject: Re: [PATCH] Input: mms114: don't report 0 pressure while still tracking contact(s)
Date: Mon, 8 Jun 2020 11:06:15 +1000	[thread overview]
Message-ID: <20200608010615.GA58259@koala> (raw)
In-Reply-To: <20200606181806.GR89269@dtor-ws>

On Sat, Jun 06, 2020 at 11:18:06AM -0700, Dmitry Torokhov wrote:
> Hi Denis,
> 
> On Sat, Jun 06, 2020 at 05:50:17AM +0200, Denis 'GNUtoo' Carikli wrote:
> > In the middle of a sliding gesture, we manage to have events
> > that look like that:
> >     Event: time 1571859641.595517, -------------- SYN_REPORT ------------
> >     Event: time 1571859641.606593, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 1193
> >     Event: time 1571859641.606593, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 21
> >     Event: time 1571859641.606593, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 0
> >     Event: time 1571859641.606593, type 3 (EV_ABS), code 1 (ABS_Y), value 1193
> >     Event: time 1571859641.606593, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
> >     Event: time 1571859641.606593, -------------- SYN_REPORT ------------
> > 
> > In such cases, we still have a valid ABS_MT_TRACKING_ID along
> > with an ABS_MT_TOUCH_MAJOR that is > 0, which both indicates
> > that the sliding is still in progress.
> > 
> > However in Documentation/input/multi-touch-protocol.rst, we
> > have:
> >     ABS_MT_PRESSURE
> >         The pressure, in arbitrary units, on the contact
> >         area. May be used instead of TOUCH and WIDTH for
> >         pressure-based devices or any device with a spatial
> >         signal intensity distribution.
> > 
> > Because of that userspace may consider an ABS_MT_PRESSURE
> > of 0 as an indication that the sliding stopped. This has
> > side effects such as making it difficult to unlock the
> > screen under Android.
> > 
> > This fix was tested on the following devices:
> > - GT-I9300 with a glass screen protection
> > - GT-I9300 without any screen protection
> > - GT-N7105 with a glass screen protection
> > 
> > Reported-by: Javi Ferrer <javi.f.o@gmail.com>
> > Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
> > ---
> >  drivers/input/touchscreen/mms114.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
> > index 2ef1adaed9af..adc18cd9a437 100644
> > --- a/drivers/input/touchscreen/mms114.c
> > +++ b/drivers/input/touchscreen/mms114.c
> > @@ -183,7 +183,10 @@ static void mms114_process_mt(struct mms114_data *data, struct mms114_touch *tou
> >  	if (touch->pressed) {
> >  		touchscreen_report_pos(input_dev, &data->props, x, y, true);
> >  		input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, touch->width);
> > -		input_report_abs(input_dev, ABS_MT_PRESSURE, touch->strength);
> > +		if (touch->strength) {
> > +			input_report_abs(input_dev, ABS_MT_PRESSURE,
> > +					 touch->strength);
> 
> So this will result in userspace believing that pressure is unchanged
> from the previous packet. I wonder if we should report
> 
> 		input_report_abs(input_dev, ABS_MT_PRESSURE,
> 				 max(touch->strength, 1));
> 
> instead.

fwiw, this could still be interpreted as a lifted touch, especially if the
pressure values are comparatively high (say you go from 100 to 1).
we have to use thresholds for what is a touch up because a number of devices
give us nonzero pressure for ever-so-slight touches (or even hovers).
so a nonzero pressure isn't a guarantee for touch down.

not on this device, but from my POV I'd rather have the device pretend the
pressure is the same as the last known touch than just forcing it to 1, a
value that may be completely out of place.

Cheers,
   Peter

  reply	other threads:[~2020-06-08  1:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-06  3:50 [PATCH] Input: mms114: don't report 0 pressure while still tracking contact(s) Denis 'GNUtoo' Carikli
2020-06-06 18:18 ` Dmitry Torokhov
2020-06-08  1:06   ` Peter Hutterer [this message]
2020-06-12 17:46   ` Denis 'GNUtoo' Carikli
2020-06-14 23:57     ` Peter Hutterer
2020-06-23 16:25       ` Denis 'GNUtoo' Carikli
2020-06-26  0:04         ` Peter Hutterer
2020-07-26 21:42           ` Denis 'GNUtoo' Carikli
2020-09-07  3:06             ` Peter Hutterer

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=20200608010615.GA58259@koala \
    --to=peter.hutterer@who-t.net \
    --cc=GNUtoo@cyberdimension.org \
    --cc=andi@etezian.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=javi.f.o@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=rydberg@bitmath.org \
    --cc=stephan@gerhold.net \
    /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).