Sorry for being so late with my reply.

Checking SYNAPTICS_CAP_MULTIFINGER is not sufficient.  There are Synaptics
touchpads that don't report this capability but do provide contact counts
(and that's not a rare case).

Adding a test for AGM support seems to be a viable workaround, see
    
https://github.com/torvalds/linux/blob/v6.3/drivers/input/mouse/synaptics.c#L1051

So the code should look like:


Index: dev/pckbc/pms.c
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.97
diff -u -p -r1.97 pms.c
--- dev/pckbc/pms.c     23 Jul 2022 05:55:16 -0000      1.97
+++ dev/pckbc/pms.c     22 May 2023 18:03:30 -0000
@@ -1075,7 +1075,11 @@ synaptics_get_hwinfo(struct pms_softc *s
        hw->y_max = (max_coords ?
            SYNAPTICS_Y_LIMIT(max_coords) : SYNAPTICS_YMAX_BEZEL);

-       hw->contacts_max = SYNAPTICS_MAX_FINGERS;
+       if ((syn->capabilities & SYNAPTICS_CAP_MULTIFINGER) ||
+           SYNAPTICS_SUPPORTS_AGM(syn->ext_capabilities))
+               hw->contacts_max = SYNAPTICS_MAX_FINGERS;
+       else
+               hw->contacts_max = 1;

        syn->sec_buttons = 0;

-----------

Tests and OKs would be welcome.


On 4/18/23 23:41, la ninpre wrote:
> Hello, tech@
> 
> So I installed OpenBSD on old Compaq laptop and noticed that scrolling
> with touchpad is not working. I started investigating to see why it
> is the case and found out a few odd things in wscons(4) and pckbc(4)
> drivers.
> 
> Basically, the laptop's touchpad lacks multifinger support (see dmesg
> below), but nevertheless, wscons(4) sets it to two-finger mode, which
> doesn't work, obviously. Initially, I thought about adding something
> like mouse.tp.edgescroll to wsconsctl(8). I then found out that there
> is already undocumented mouse.tp.param option, that can be used to
> force the edgescroll mode by setting 67 (WSMOUSECFG_TWOFINGERSCROLL)
> to 0 and 68 (WSMOUSECFG_EDGESCROLL) to 1, but I don't think it is
> very convenient and readable.
> 
> Later I continued to investigate, why wscons(4) defaults to two-finger
> mode and found that it does so by examining a field of a touchpad data
> structure called 'contacts_max' [1], which, I assumed, represents
> a number of maximum simultaneous touches. But when I grepped for
> this name to see where this value is set, I found that it is set
> in pckbc(4). It is done in a very simple way, so it sets it to 3
> (well, actually SYNAPTICS_MAX_FINGERS, but it is defined to be 3
> only there and nowhere else) if the device in question is a synaptics
> touchpad (!) [2], even though the touchpad has a capabilities field
> and it is recognized correctly (SYNAPTICS_CAP_MULTIFINGER is set
> to 0 in my case). So I think a solution would be at least checking
> SYNAPTIC_CAP_MULTIFINGER and setting contacts_max depending on that
> (3 if true, 1 if false). Maybe it is a bodge, but it works.
> 
> Index: pms.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.97
> diff -u -p -r1.97 pms.c
> --- pms.c    23 Jul 2022 05:55:16 -0000    1.97
> +++ pms.c    18 Apr 2023 21:36:10 -0000
> @@ -1075,7 +1075,10 @@ synaptics_get_hwinfo(struct pms_softc *s
>      hw->y_max = (max_coords ?
>          SYNAPTICS_Y_LIMIT(max_coords) : SYNAPTICS_YMAX_BEZEL);
> 
> -    hw->contacts_max = SYNAPTICS_MAX_FINGERS;
> +    if(syn->capabilities & SYNAPTICS_CAP_MULTIFINGER)
> +        hw->contacts_max = SYNAPTICS_MAX_FINGERS;
> +    else
> +        hw->contacts_max = 1;
> 
>      syn->sec_buttons = 0;
> 
> 
> 
> [1]: /sys/dev/wscons/wstpad.c:1573
> [2]: /sys/dev/pckbc/psm.c:1078
> 
> Here are relevant lines from dmesg(8):
> 
> pms0 at pckbc0 (aux slot)
> wsmouse0 at pms0 mux 0
> pms0: Synaptics touchpad, firmware 6.5, 0x1c0b1 0xa00000 0x0 0xa04751 0x0
> 
> So I'm looking forward for comments on this. Has anybody experienced
> something similar?
> 

Reply via email to