Bug 253279

Summary: kern/atkbdc/psm: Synaptics Touchpad detection fix when connected to both PS/2 and SMBus.
Product: Base System Reporter: Tomasz "CeDeROM" CEDRO <tomek>
Component: kernAssignee: Vladimir Kondratyev <wulf>
Status: Closed FIXED    
Severity: Affects Only Me CC: wulf
Priority: ---    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
psm.patch none

Description Tomasz "CeDeROM" CEDRO 2021-02-05 20:34:51 UTC
Synaptics Touchpad is not detected correctly when connected both to PS/2 and SMBus at the same time over multiplexer - by default it is detected as simple PS/2 mouse and no gestures work. This affects Panasonic Toughbook laptops.

This issue is detailed here:
https://github.com/wulf7/iichid/issues/53

The review is here:
https://reviews.freebsd.org/D28502

Credits for this fix goes to Wulf - Big Thank You :-)

Best regards :-)
Tomek
Comment 1 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-02-06 10:38:23 UTC
As this patch disables PS/2 bytestream synchronization checks for all Synaptics touchpads connected through the AUX MUX, we should find a better fix.

Could you:

1. Revert https://reviews.freebsd.org/D28502 patch
2. Find vendortype array in sys/dev/atkbdc/psm.c. It is located at 700-th line and sets a probe order for different PS/2 device types.
3. Start moving of Synaptics entry from 8-th position to the top of the array in one entry step with recompiling and testing of the kernel at each step until touchpad becomes fixed.

P.S. Most probably, culprit is /* Microsoft IntelliMouse Explorer */, so you can start iterating from it.
Comment 2 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-07-09 23:36:28 UTC
Created attachment 226336 [details]
psm.patch
Comment 3 Tomasz "CeDeROM" CEDRO 2021-07-10 00:26:39 UTC
Thank you Wulf! Will verify and report back tomorrow :-)
Comment 4 Tomasz "CeDeROM" CEDRO 2021-07-10 18:12:59 UTC
Wow that patch fixes scroll for all Panasonic Toughbook CF-MX4 derived mouses, looks like trackpad is now detected and works correctly!

TANK U SIR!! =)

% xinput
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ System mouse                              id=6    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=10   [slave  pointer  (2)]
⎜   ↳ Generic PS/2 mouse                        id=11   [slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                     id=13   [slave  pointer  (2)]
⎜   ↳ Sharp Corp.   12.5EA0003                  id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ System keyboard multiplexer               id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ AT keyboard                               id=9    [slave  keyboard (3)]
    ↳ Logitech USB Receiver                     id=12   [slave  keyboard (3)]

% xinput list-props 6
Device 'System mouse':
        Device Enabled (159):   1
        Coordinate Transformation Matrix (160): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Natural Scrolling Enabled (282):       0
        libinput Natural Scrolling Enabled Default (283):       0
        libinput Scroll Methods Available (284):        0, 0, 1
        libinput Scroll Method Enabled (285):   0, 0, 0
        libinput Scroll Method Enabled Default (286):   0, 0, 0
        libinput Button Scrolling Button (287): 2
        libinput Button Scrolling Button Default (288): 2
        libinput Button Scrolling Button Lock Enabled (289):    0
        libinput Button Scrolling Button Lock Enabled Default (290):    0
        libinput Middle Emulation Enabled (291):        0
        libinput Middle Emulation Enabled Default (292):        0
        libinput Accel Speed (293):     0.000000
        libinput Accel Speed Default (294):     0.000000
        libinput Accel Profiles Available (295):        1, 1
        libinput Accel Profile Enabled (296):   1, 0
        libinput Accel Profile Enabled Default (297):   1, 0
        libinput Left Handed Enabled (298):     0
        libinput Left Handed Enabled Default (299):     0
        libinput Send Events Modes Available (300):     1, 0
        libinput Send Events Mode Enabled (301):        0, 0
        libinput Send Events Mode Enabled Default (302):        0, 0
        Device Node (303):      "/dev/input/event0"
        Device Product ID (304):        0, 0
        libinput Drag Lock Buttons (305):       <no items>
        libinput Horizontal Scroll Enabled (306):       1

% xinput list-props 10
Device 'SynPS/2 Synaptics TouchPad':
        Device Enabled (159):   1
        Coordinate Transformation Matrix (160): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Tapping Enabled (316): 1
        libinput Tapping Enabled Default (317): 0
        libinput Tapping Drag Enabled (318):    1
        libinput Tapping Drag Enabled Default (319):    1
        libinput Tapping Drag Lock Enabled (320):       1
        libinput Tapping Drag Lock Enabled Default (321):       0
        libinput Tapping Button Mapping Enabled (322):  1, 0
        libinput Tapping Button Mapping Default (323):  1, 0
        libinput Natural Scrolling Enabled (282):       1
        libinput Natural Scrolling Enabled Default (283):       0
        libinput Disable While Typing Enabled (324):    1
        libinput Disable While Typing Enabled Default (325):    1
        libinput Scroll Methods Available (284):        1, 1, 0
        libinput Scroll Method Enabled (285):   1, 0, 0
        libinput Scroll Method Enabled Default (286):   1, 0, 0
        libinput Accel Speed (293):     0.000000
        libinput Accel Speed Default (294):     0.000000
        libinput Accel Profiles Available (295):        1, 1
        libinput Accel Profile Enabled (296):   1, 0
        libinput Accel Profile Enabled Default (297):   1, 0
        libinput Left Handed Enabled (298):     0
        libinput Left Handed Enabled Default (299):     0
        libinput Send Events Modes Available (300):     1, 1
        libinput Send Events Mode Enabled (301):        0, 0
        libinput Send Events Mode Enabled Default (302):        0, 0
        Device Node (303):      "/dev/input/event5"
        Device Product ID (304):        2, 7
        libinput Drag Lock Buttons (305):       <no items>
        libinput Horizontal Scroll Enabled (306):       1


% xinput list-props 11
Device 'Generic PS/2 mouse':
        Device Enabled (159):   1
        Coordinate Transformation Matrix (160): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Natural Scrolling Enabled (282):       0
        libinput Natural Scrolling Enabled Default (283):       0
        libinput Scroll Methods Available (284):        0, 0, 1
        libinput Scroll Method Enabled (285):   0, 0, 1
        libinput Scroll Method Enabled Default (286):   0, 0, 1
        libinput Button Scrolling Button (287): 2
        libinput Button Scrolling Button Default (288): 2
        libinput Button Scrolling Button Lock Enabled (289):    0
        libinput Button Scrolling Button Lock Enabled Default (290):    0
        libinput Middle Emulation Enabled (291):        0
        libinput Middle Emulation Enabled Default (292):        0
        libinput Accel Speed (293):     0.000000
        libinput Accel Speed Default (294):     0.000000
        libinput Accel Profiles Available (295):        1, 1
        libinput Accel Profile Enabled (296):   1, 0
        libinput Accel Profile Enabled Default (297):   1, 0
        libinput Left Handed Enabled (298):     0
        libinput Left Handed Enabled Default (299):     0
        libinput Send Events Modes Available (300):     1, 0
        libinput Send Events Mode Enabled (301):        0, 0
        libinput Send Events Mode Enabled Default (302):        0, 0
        Device Node (303):      "/dev/input/event6"
        Device Product ID (304):        2, 1
        libinput Drag Lock Buttons (305):       <no items>
        libinput Horizontal Scroll Enabled (306):       1
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-07-14 10:32:21 UTC
A commit in branch main references this bug:

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

commit f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-07-14 10:30:26 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-07-14 10:30:26 +0000

    psm(4): Probe Synaptics touchpad with active multiplexing mode enabled

    if it is only multiplexed device. Also enable syncbit checks for them.
    This fixes touchpad recognition on Panasonic Toughbook CF-MX4 laptop.

    Reported by:    Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
    MFC after:      1 month
    PR:             253279
    Differential revision:  https://reviews.freebsd.org/D28502

 sys/dev/atkbdc/psm.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-08-16 00:50:30 UTC
A commit in branch stable/13 references this bug:

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

commit f2f52fbfdb282d740c02a92a47737c2c3f975791
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-07-14 10:30:26 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-08-16 00:47:18 +0000

    psm(4): Probe Synaptics touchpad with active multiplexing mode enabled

    if it is only multiplexed device. Also enable syncbit checks for them.
    This fixes touchpad recognition on Panasonic Toughbook CF-MX4 laptop.

    Reported by:    Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
    PR:             253279
    Differential revision:  https://reviews.freebsd.org/D28502

    (cherry picked from commit f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2)

 sys/dev/atkbdc/psm.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-08-16 01:00:35 UTC
A commit in branch stable/12 references this bug:

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

commit e57850820d4732b248458007cad2e70c43156a90
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-07-14 10:30:26 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-08-16 00:58:41 +0000

    psm(4): Probe Synaptics touchpad with active multiplexing mode enabled

    if it is only multiplexed device. Also enable syncbit checks for them.
    This fixes touchpad recognition on Panasonic Toughbook CF-MX4 laptop.

    Reported by:    Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
    PR:             253279
    Differential revision:  https://reviews.freebsd.org/D28502

    (cherry picked from commit f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2)

 sys/dev/atkbdc/psm.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)
Comment 8 Tomasz "CeDeROM" CEDRO 2021-08-16 01:26:11 UTC
TANK U WULF!! =)