All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Peter Hutterer <peter.hutterer@who-t.net>
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Jiri Kosina <jikos@kernel.org>, Wen He <wen.he_1@nxp.com>
Subject: Re: [PATCH] HID: input: do not run GET_REPORT unless there's a Resolution Multiplier
Date: Thu, 14 May 2020 14:31:15 +0200	[thread overview]
Message-ID: <CAO-hwJJjoEyoKokK6DS_Kb0su2bkC2wzMx-gzaWQcG+dn5vVdw@mail.gmail.com> (raw)
In-Reply-To: <20200514111448.GA855579@jelly>

Hey,

On Thu, May 14, 2020 at 1:14 PM Peter Hutterer <peter.hutterer@who-t.net> wrote:
>
> hid-multitouch currently runs GET_REPORT for Contact Max and again to
> retrieve the Win8 blob. If both are within the same report, the
> Resolution Multiplier code calls GET_FEATURE again and this time,
> possibly due to timing, it causes the ILITEK-TP device interpret the
> GET_FEATURE as an instruction to change the mode and effectively stop
> the device from functioning as expected.
>
> Notably: the device doesn't even have a Resolution Multiplier so it
> shouldn't be affected by any of this at all.
>
> Fix this by making sure we only execute GET_REPORT if there is
> a Resolution Multiplier in the respective report.
>
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> Tested-by: Wen He <wen.he_1@nxp.com>
> ---
>  drivers/hid/hid-input.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git drivers/hid/hid-input.c drivers/hid/hid-input.c

Seems like you git format-patch is still busted, you are lacking the
'a/' and 'b/' in front of the files, and so the patch fails to apply
because 'hid/hid-input.c' is not in the tree.

Cheers,
Benjamin

> index dea9cc65bf80..a54824d451bf 100644
> --- drivers/hid/hid-input.c
> +++ drivers/hid/hid-input.c
> @@ -1560,21 +1560,12 @@ static bool __hidinput_change_resolution_multipliers(struct hid_device *hid,
>  {
>         struct hid_usage *usage;
>         bool update_needed = false;
> +       bool get_report_completed = false;
>         int i, j;
>
>         if (report->maxfield == 0)
>                 return false;
>
> -       /*
> -        * If we have more than one feature within this report we
> -        * need to fill in the bits from the others before we can
> -        * overwrite the ones for the Resolution Multiplier.
> -        */
> -       if (report->maxfield > 1) {
> -               hid_hw_request(hid, report, HID_REQ_GET_REPORT);
> -               hid_hw_wait(hid);
> -       }
> -
>         for (i = 0; i < report->maxfield; i++) {
>                 __s32 value = use_logical_max ?
>                               report->field[i]->logical_maximum :
> @@ -1593,6 +1584,17 @@ static bool __hidinput_change_resolution_multipliers(struct hid_device *hid,
>                         if (usage->hid != HID_GD_RESOLUTION_MULTIPLIER)
>                                 continue;
>
> +                       /*
> +                        * If we have more than one feature within this report we
> +                        * need to fill in the bits from the others before we can
> +                        * overwrite the ones for the Resolution Multiplier.
> +                        */
> +                       if (!get_report_completed && report->maxfield > 1) {
> +                               hid_hw_request(hid, report, HID_REQ_GET_REPORT);
> +                               hid_hw_wait(hid);
> +                               get_report_completed = true;
> +                       }
> +
>                         report->field[i]->value[j] = value;
>                         update_needed = true;
>                 }
> --
> 2.26.2
>


  reply	other threads:[~2020-05-14 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 11:14 [PATCH] HID: input: do not run GET_REPORT unless there's a Resolution Multiplier Peter Hutterer
2020-05-14 12:31 ` Benjamin Tissoires [this message]
2020-05-14 22:49   ` [PATCH RESEND] " Peter Hutterer
2020-05-15  7:48     ` Benjamin Tissoires
2020-05-28  3:03       ` Peter Hutterer
2020-06-09  6:03 ` [PATCH v2] " Peter Hutterer
2020-06-16 15:25   ` Jiri Kosina

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=CAO-hwJJjoEyoKokK6DS_Kb0su2bkC2wzMx-gzaWQcG+dn5vVdw@mail.gmail.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=wen.he_1@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.