Bug 257992

Summary: Touchpad buttons don't work on Dell Precision 7550 laptop
Product: Base System Reporter: Shawn Webb <shawn.webb>
Component: kernAssignee: Vladimir Kondratyev <wulf>
Status: Closed FIXED    
Severity: Affects Only Me CC: hselasky, tomek, wulf
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
`pciconf -lv` output
none
`usbconfig list` output
none
dmesg from dmesg.boot
none
devinfo -rv
none
hid-recorder output
none
missing_button_type.patch
none
evemu-record output
none
copy of /var/log/messages with iichid debug enabled
none
missing_button_type.patch
none
copy of /var/log/messages with iichid debug enabled and the second version of the patch none

Description Shawn Webb 2021-08-22 00:48:47 UTC
Created attachment 227361 [details]
`pciconf -lv` output

On HardenedBSD 14-CURRENT/amd64 on a Dell Precision 7550, the touchpad semi-works. The mouse cursor can be manipulated (moved around), but the physical buttons don't work right. Buttons one and two don't work at all, and button three (middle button) does indeed work.

`uname -a`: FreeBSD hbsd-laptop-02 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD #0 : Tue Aug 10 16:30:04 UTC 2021     root@ci-06.md.hardenedbsd.lan:/usr/obj/usr/src/amd64.amd64/sys/HARDENEDBSD  amd64
Comment 1 Shawn Webb 2021-08-22 00:50:26 UTC
Created attachment 227362 [details]
`usbconfig list` output
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2021-08-23 19:54:15 UTC
Output from dmesg and devinfo is appreciated.

Adding, wulf@ and @cdrom. 

--HPS
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2021-08-23 19:57:04 UTC
s/cdrom/cedro
Comment 4 Shawn Webb 2021-08-23 19:57:58 UTC
Created attachment 227390 [details]
dmesg from dmesg.boot
Comment 5 Shawn Webb 2021-08-23 19:58:18 UTC
Created attachment 227391 [details]
devinfo -rv
Comment 6 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-08-24 13:30:58 UTC
Could you do following steps:
1. kldload hidraw.ko
2. install sysutils/hid-tools
3. run hid-recorder and choose 'DELL09C3:00 0488:120A'
4. press and release 3 buttons one after one
5. post output from hid-recorder here
Comment 7 Shawn Webb 2021-08-24 13:57:50 UTC
Created attachment 227402 [details]
hid-recorder output

Buttons pressed in order:

1. Button 1 (left button)
2. Button 2 (right button)
3. Button 3 (middle button)
Comment 8 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-08-24 15:50:24 UTC
Created attachment 227403 [details]
missing_button_type.patch

Report descriptor misses "button_type" usage resulting in touchpad detected as clickpad.

Try attached patch.
Comment 9 Shawn Webb 2021-08-24 16:30:05 UTC
(In reply to Vladimir Kondratyev from comment #8)
Patch applied. Same behavior as before.
Comment 10 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-08-24 19:16:37 UTC
(In reply to Shawn Webb from comment #9)
> Patch applied. Same behavior as before.

Could you run evemu-record from devel/evemu, than choose 'DELL09C3:00 0488:120A TouchPad' device and provide its output after pressing the buttons
Comment 11 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-08-24 19:22:46 UTC
(In reply to Vladimir Kondratyev from comment #10)
> Could you run evemu-record
With "missing_button_type.patch" applied
Comment 12 Shawn Webb 2021-08-24 21:01:31 UTC
Created attachment 227415 [details]
evemu-record output

This, too, had the patch applied.
Comment 13 Shawn Webb 2021-08-24 21:02:05 UTC
(In reply to Shawn Webb from comment #12)
I forgot to note: same button presses as before: left, right, middle.
Comment 14 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-08-24 22:29:10 UTC
All looks OK except the touchpad is recognized as clickpad.

Could you
add 'options IICHID_DEBUG' line to kernel config
and 'hw.iichid.debug=1' to /boot/loader.conf
than rebuild kernel, reboot and post dmesg output from the boot process. especially lines starting from iichid?

as temporary workaround you may try to comment out 'evdev_support_prop(sc->evdev, INPUT_PROP_BUTTONPAD);' line (about #400) in sys/dev/hid/hmt.c.

P.S. I was wrong about missing "button_type" usage. It exists.
Comment 15 Shawn Webb 2021-08-24 22:37:14 UTC
(In reply to Vladimir Kondratyev from comment #14)
Will do tomorrow. Do you want me to keep the patch when building the new kernel?
Comment 16 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-08-24 23:11:24 UTC
(In reply to Shawn Webb from comment #15)
> Do you want me to keep the patch when building the new kernel?
It is up to you. It was inspired by following OpenBSD commit
https://github.com/openbsd/src/commit/db49bb0f212c1bd79ebc3bc96aadc7346a0dc1fe but looks irrelevant here.

I am interesting in content of report which contains "button_type" usage.
Comment 17 Shawn Webb 2021-08-25 20:41:12 UTC
Created attachment 227434 [details]
copy of /var/log/messages with iichid debug enabled

This includes the experimental patch. And it includes me hitting the left, right, and middle buttons.
Comment 18 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-08-26 09:11:53 UTC
Created attachment 227443 [details]
missing_button_type.patch

> Aug 25 16:37:06 hbsd-laptop-02 kernel[38]: iichid0: HID command I2C_HID_CMD_GET_REPORT 9 (type 3, len 3)
> Aug 25 16:37:06 hbsd-laptop-02 kernel[38]: iichid0: response size 4 != expected length 5
> Aug 25 16:37:06 hbsd-laptop-02 kernel[38]: iichid0: response: 04 00 09 05
You get report with "button type" data truncated.

Try updated patch
Comment 19 Shawn Webb 2021-08-26 15:54:00 UTC
Created attachment 227452 [details]
copy of /var/log/messages with iichid debug enabled and the second version of the patch

That new patch seems to do the trick!
Comment 20 Shawn Webb 2021-08-26 16:22:28 UTC
(In reply to Shawn Webb from comment #19)
Also, thanks a lot for helping with this. I really appreciate it.
Comment 21 commit-hook freebsd_committer freebsd_triage 2021-09-02 19:36:37 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9d04336b615d16faa631da2824ee719683540276

commit 9d04336b615d16faa631da2824ee719683540276
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-09-02 19:33:51 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-09-02 19:35:27 +0000

    hmt(4): Add support for touchpads with no "button type" or

    "maximum number of contacts" usages.

    Assume touchpad to be a clickpad if it has only internal button.
    Set number of contacts to 5 for touchpads and to 10 for touchscreens.
    Check for fetched report length to avoid reading of stalled data.
    Fixes Dell Precision 7550 laptop.

    Tested by:      Shawn Webb <shawn.webb_AT_hardenedbsd_DOT_org>
    PR:             257992
    MFC after:      2 week

 sys/dev/hid/hmt.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)
Comment 22 commit-hook freebsd_committer freebsd_triage 2021-09-21 23:44:45 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=470478ff012fd8a2c083fead60574ec6c798376f

commit 470478ff012fd8a2c083fead60574ec6c798376f
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-09-02 19:33:51 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-09-21 23:41:40 +0000

    hmt(4): Add support for touchpads with no "button type" or

    "maximum number of contacts" usages.

    Assume touchpad to be a clickpad if it has only internal button.
    Set number of contacts to 5 for touchpads and to 10 for touchscreens.
    Check for fetched report length to avoid reading of stalled data.
    Fixes Dell Precision 7550 laptop.

    Tested by:      Shawn Webb <shawn.webb_AT_hardenedbsd_DOT_org>
    PR:             257992

    (cherry picked from commit 9d04336b615d16faa631da2824ee719683540276)

 sys/dev/hid/hmt.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)