linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Chung-Yih Wang (王崇懿)" <cywang@chromium.org>
To: Linux Input <linux-input@vger.kernel.org>
Cc: Henrik Rydberg <rydberg@euromail.se>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Benjamin Tissoires <benjamin.tissoires@gmail.com>,
	Chung-yih Wang <cywang@chromium.org>
Subject: Re: [PATCH] input: fix BTN_TOUCH reporting in input_mt_report_pointer_emulation for hovering finger
Date: Wed, 15 Oct 2014 19:02:31 +0800	[thread overview]
Message-ID: <CAM2ehZa2OUH14_hQ5nbmzGfXGaRrd5bN43wBnriuL_zJUjv2MA@mail.gmail.com> (raw)
In-Reply-To: <1412861506-21732-1-git-send-email-cywang@chromium.org>

any comment for this patch?

On Thu, Oct 9, 2014 at 9:31 PM, Chung-yih Wang <cywang@chromium.org> wrote:
>   From the definition of BTN_TOUCH, BTN_TOOL_<name> and BTN_TOUCH codes are
> orthogonal. BTN_TOUCH should be zero if there is no physical contact, e.g.
> hovering finger, happened on device. The patch uses touch_count and finger_count
> to get the final reporting code for BTN_TOUCH and BTN_TOOL_<name>,
> respectively. In addition, as there are some hard-coded pressure thresholds
> defined in touch device's driver classes, 'touch_threshold' is introduced into
> struct input_dev in order to tell if a finger is considered as a touch one in
> input_mt_report_pointer_emulation().
>
> ---
>  drivers/input/input-mt.c | 15 ++++++++++-----
>  include/linux/input.h    |  2 ++
>  2 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
> index fbe29fc..47e41d6 100644
> --- a/drivers/input/input-mt.c
> +++ b/drivers/input/input-mt.c
> @@ -192,18 +192,21 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
>  {
>         struct input_mt *mt = dev->mt;
>         struct input_mt_slot *oldest;
> -       int oldid, count, i;
> +       int oldid, i;
> +       int touch_count, finger_count;
>
>         if (!mt)
>                 return;
>
>         oldest = NULL;
>         oldid = mt->trkid;
> -       count = 0;
> +       touch_count = 0;
> +       finger_count = 0;
>
>         for (i = 0; i < mt->num_slots; ++i) {
>                 struct input_mt_slot *ps = &mt->slots[i];
>                 int id = input_mt_get_value(ps, ABS_MT_TRACKING_ID);
> +               int pressure = input_mt_get_value(ps, ABS_MT_PRESSURE);
>
>                 if (id < 0)
>                         continue;
> @@ -211,12 +214,14 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
>                         oldest = ps;
>                         oldid = id;
>                 }
> -               count++;
> +               finger_count++;
> +               if (pressure > dev->touch_threshold)
> +                       touch_count++;
>         }
>
> -       input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
> +       input_event(dev, EV_KEY, BTN_TOUCH, touch_count > 0);
>         if (use_count)
> -               input_mt_report_finger_count(dev, count);
> +               input_mt_report_finger_count(dev, finger_count);
>
>         if (oldest) {
>                 int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
> diff --git a/include/linux/input.h b/include/linux/input.h
> index 82ce323..5b2739d 100644
> --- a/include/linux/input.h
> +++ b/include/linux/input.h
> @@ -187,6 +187,8 @@ struct input_dev {
>         struct input_value *vals;
>
>         bool devres_managed;
> +
> +       unsigned int touch_threshold;
>  };
>  #define to_input_dev(d) container_of(d, struct input_dev, dev)
>
> --
> 2.0.0.526.g5318336
>

  reply	other threads:[~2014-10-15 11:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09 13:31 [PATCH] input: fix BTN_TOUCH reporting in input_mt_report_pointer_emulation for hovering finger Chung-yih Wang
2014-10-15 11:02 ` Chung-Yih Wang (王崇懿) [this message]
2014-10-15 18:05   ` Dmitry Torokhov
2014-10-27 10:08 ` [PATCH v2] input: fix BTN_TOUCH reporting in input_mt_report_pointer_emulation Chung-yih Wang
2014-10-28 20:47   ` Benjamin Tissoires
2014-10-28 21:07     ` Dmitry Torokhov
2014-10-29  0:14       ` 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=CAM2ehZa2OUH14_hQ5nbmzGfXGaRrd5bN43wBnriuL_zJUjv2MA@mail.gmail.com \
    --to=cywang@chromium.org \
    --cc=benjamin.tissoires@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=rydberg@euromail.se \
    /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).