linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Coiby Xu <coiby.xu@gmail.com>
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: Advice on fixing the bug of MSFT0001:00 04F3:Touchpad being handled by hid_multitouch by mistake
Date: Fri, 4 Sep 2020 18:47:42 +0200	[thread overview]
Message-ID: <CAO-hwJJAOGNVnu1_dwXTMUyoSsNQifGFDUV6e9g96wHKmaZqSA@mail.gmail.com> (raw)
In-Reply-To: <20200904145916.nighviqyrvbm2ybx@Rk>

On Fri, Sep 4, 2020 at 4:59 PM Coiby Xu <coiby.xu@gmail.com> wrote:
>
> On Fri, Sep 04, 2020 at 10:16:51AM +0200, Benjamin Tissoires wrote:
> >Hi,
> >
> >On Tue, Aug 11, 2020 at 11:15 AM Coiby Xu <coiby.xu@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> I'm working on a touchpad device issue as reported on
> >> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1887190.
> >>
> >> This touchpad device MSFT0001:00 04F3:Touchpad should be handled by
> >> hid_rmi. But currently hid-core.c chooses hid_multitouch by mistake,
> >>
> >>      1. When scanning this device's report descriptor, HID_DG_CONTACTID
> >>         usage is found. Thus group HID_GROUP_MULTITOUCH is assigned to
> >>         the device.
> >>      2. The flag HID_SCAN_FLAG_MT_WIN_8 is also found. Thus group
> >>         HID_GROUP_MULTITOUCH_WIN_8 is assigned to the device.
> >>      3. hid-multitouch.c claims handling devices with the group of
> >>         HID_GROUP_MULTITOUCH_WIN_8
> >>
> >>          static const struct hid_device_id mt_devices[] = {
> >>                 /* Generic MT device */
> >>                 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
> >>
> >>                 /* Generic Win 8 certified MT device */
> >>                 {  .driver_data = MT_CLS_WIN_8,
> >>                         HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH_WIN_8,
> >>                                 HID_ANY_ID, HID_ANY_ID) },
> >>                 { }
> >>          };
> >>
> >> There are several potential solutions,
> >>      - Let the device vendor fix this problem since this device's report
> >>        descriptor shouldn't have the HID_DG_CONTACTID usage.
> >>      - Make it a special case by setting the device's group to
> >>        HID_GROUP_RMI in hid_scan_report when vendor id and product ID
> >>        are matched.
> >>      - hid-quirks.c seems to be designed to handle special cases, is it
> >>        suitable for this case?
> >
> >AFAIU, the touchpad doesn't work at all with hid-multitouch. So I
> >guess the best is to add the VID/PID to hid-quirks.c in
> >hid_have_special_driver[], and add it to the hid-rmi driver too.
> >This way, you will ensure hid-rmi will pick up the device all the time.
> >
> >Cheers,
> >Benjamin
>
> Thank you for the advice! I have exactly adopted this approach by looking
> at commit e9287099ba6539bccb20cd791269186f3ae28b85
> ("HID: rmi: Add support for the touchpad in the Razer Blade 14 laptop")
> as an example.
>
> My previous email is a bit misleading because 0x04F3 is the vendor code
> of ELAN while hid-rmi is for the Synaptics touchpad. And actually this
> laptop model of Lenovo Legion-5 15ARH05 is shipped with both kinds of
> touchpads,
>
> - for the Synaptics touchpad, hid-rmi could almost handle it perfectly
>    except the clicking is not sensitive enough. I need to let my finger
>    linger on the touchpad for a while. I notice when I click on the touchpad,
>    an HID report would be received by hid-recorder. But evtest couldn't receive
>    any EV_ event. If hid-multitouch is handling the device, the cursor
>    won't move but 2-4 finger touching events could still be received by
>    evtest.
>
> - for the ELAN touchpad, only HID reporters can be read and parsed by
>    hid-core then two input devices (mouse and touchpad) could created by
>    hid-multitouch as seen from /proc/bus/input/devices. But hid-recorder
>    could never get any HID report.

huh. So in both cases you have a buggy touchpad with hid-multitouch :(

Do both touchpads share the same VID/PID? If so, this is going to be
interesting to decide how any of those touchpad should be handled.

>
> AFAIU, isn't hid-multitouch supposed to be the implementation of Windows
> Precision Touchpad?

yes, it works for most of those. The only ones that are not working
are usually because OEM or device makers tend to do "fun" things.

>  And since Precision touchpad is mandatory for
> Windows 10 notebooks and this laptop model of Lenovo Legion-5 15ARH05
> seem to have been certificated by Windows 10, does it mean by theory
> hid-multiouch could handle these two touchpad devices?

Well, it should, yes, but it clearly can not. You can try to give a
try at hid-recorder from
https://gitlab.freedesktop.org/libevdev/hid-tools. This will show what
is actually exported by the hardware before any processing by the
kernel. Maybe there is a new simple thing to do in hid-multitouch to
handle those devices.

Also, last time I heard, Synaptics dropped the use of hid-rmi in favor
of hid-multitouch. Any hid-rmi touchpad should be able to use
hid-multitouch, as this is the preferred way on Windows. But sometimes
the various teams decide to change the rules.

>
> Anyway, it seems I need to install Windows Driver Kit to capture&analyze
> HID reports to see what's happening. Or do you have any suggestion?

Unless it changed recently (I think I have seen something like that
recently), I had to write a I2C man-in-the-middle to dump the logs
from Windows. Project is at
https://github.com/bentiss/SimplePeripheralBusProbe and requires a
little bit of manual work to be able to start capturing data :(

Cheers,
Benjamin

>
> --
> Best regards,
> Coiby
>


  reply	other threads:[~2020-09-04 16:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  9:14 Advice on fixing the bug of MSFT0001:00 04F3:Touchpad being handled by hid_multitouch by mistake Coiby Xu
2020-09-04  8:16 ` Benjamin Tissoires
2020-09-04 14:59   ` Coiby Xu
2020-09-04 16:47     ` Benjamin Tissoires [this message]
2020-09-10 16:37       ` Coiby Xu
2020-09-11 12:29         ` Benjamin Tissoires
2020-09-15 10:14           ` Coiby Xu
2020-09-24  7:17             ` Coiby Xu
2020-10-09  8:26               ` Coiby Xu
2020-10-09  8:55                 ` Benjamin Tissoires
2020-10-14 22:09                   ` Coiby Xu

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-hwJJAOGNVnu1_dwXTMUyoSsNQifGFDUV6e9g96wHKmaZqSA@mail.gmail.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=coiby.xu@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    /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).