Thanks for the report.  The logging shows that the contacts are recognized,
so we have indeed to look at the filters of the driver.  Two filters are
relevant here:  The first and essential one checks whether the duration of
a contact exceeds the "tapping timeout" (180ms by default).  The second
one discards contacts which are "too far" away from their initial position
(in order to distinguish a short movement sequence from a tap gesture).

Could you test whether the patch below helps, at least on the Thinkpad?
It makes the second filter less restrictive (plainly, it won't apply to
multi-finger taps).

As to the timeout, the "timestamp" values in the Pinebook output show some
large gaps.  Are the sequences complete?  Do you have the habit of tapping
very slowly?  Have you observed timing-related problems on that machine?

The four-digit numbers in the log lines represent the current low-precision
time in milliseconds modulo 10000. For example, this sequence
        [wsmouse0-in][4275] abs:636,444 mt:0x01:0
        [wsmouse0-in][4556] mt:0x00:-1
would indicate that the duration of the contact was about 4556-4275
milliseconds, which exceeds the default timeout by far.  If this happens
often, there might be some hardware problem.

You could try to mitigate a timeout problem by increasing the threshold
to, e.g., 250ms by issuing the command
    $ doas wsconsctl mouse.param=173:250
but I would recommend to keep it within reasonable limits.


On 3/23/21 12:26 PM, Klemens Nanni wrote:
> On Tue, Mar 23, 2021 at 02:00:43AM +0100, Ulf Brosziewski wrote:
>> On 3/22/21 10:19 PM, Klemens Nanni wrote:
>>> On Mon, Mar 22, 2021 at 08:18:45PM +0100, Klemens Nanni wrote:
>>>> I was too stupid to look at `wsconsctl' output (which needs root) and
>>>> only looked here.
>>>>
>>>> Mailing the diff for my lack of better wording, plus the knob atually
>>>> takes three values which I have yet to decode by reading wsconsctl(8)
>>>> code.
>>> The reason I had to look is because the (default) functionality does not
>>> work reliably at all:
>>>
>>>     $ doas wsconsctl mouse.tp.tapping=1
>>>     mouse.tp.tapping -> 1,3,2
>>>
>>> Single taps are always detected reliably and deliver left mouse button
>>> clicks, but tripple and double taps for middle and right mouse button
>>> clicks work are recognised so poorly that I first though multitouch
>>> support wasn't there at all.
>>
>> Can you tell whether that's a hardware or a driver problem?
> I'd assume it's a driver a problem since I get the exact same behaviour
> on both a Pinebook Pro and a Thinkpad X230.
> 
>> wsmouse logging might be helpful here. You could enable it by
>>     $ doas wsconsctl mouse.param=256:1,257:1
>> , make a few two-finger taps, and deactivate it with
>>     $ doas wsconsctl mouse.param=256:0,257:0
>> For the output:
>>     $ grep 'wsmouse0-' /var/log/messages
> Thanks!  Here goes the Pinebook Pro:
> 
> One-finger tap:
>       [wsmouse0-in][4275] abs:636,444 mt:0x01:0
>       [wsmouse0-in][4556] mt:0x00:-1
> 
> Two-finger tap:
>       [wsmouse0-in][0319] abs:786,516 mt:0x01:0
>       [wsmouse0-in][0329] mt:0x03:0
>       [wsmouse0-in][0772] abs:652,270 mt:0x02:1
> 
> Three-finger tap:
>       [wsmouse0-in][8821] abs:942,561 mt:0x01:0
>       [wsmouse0-in][8831] mt:0x03:0
>       [wsmouse0-in][8842] mt:0x07:0
>       [wsmouse0-in][8852] abs:942,563
>       [wsmouse0-in][9434] mt:0x05:0
>       [wsmouse0-in][9455] abs:539,210 mt:0x04:2
> 
> Only the one-finger tap does a left click, the others do nothing.
> 
> Double two-finger tap:
>       [wsmouse0-in][1894] abs:740,312 mt:0x01:0
>       [wsmouse0-in][1894] mt:0x03:0
>       [wsmouse0-in][2035] abs:554,44 mt:0x02:1
>       [wsmouse0-in][2045] mt:0x00:-1
>       [wsmouse0-ev][2045] 5:2 18:0
>       [wsmouse0-in][2055] abs:744,344 mt:0x01:0
>       [wsmouse0-ev][2055] 4:2 18:0
>       [wsmouse0-in][2065] mt:0x03:0
>       [wsmouse0-in][2497] abs:555,67 mt:0x02:1
> 
> This delivers a right-click in almost all attempts (this is the log of a
> successful one).
> 
> Touble three-finger tap:
> 
>       [wsmouse0-in][7276] abs:1114,734 mt:0x01:0
>       [wsmouse0-in][7286] mt:0x03:0
>       [wsmouse0-in][7296] mt:0x07:0
>       [wsmouse0-in][7427] abs:769,543 mt:0x06:1
>       [wsmouse0-in][7437] abs:468,284 mt:0x04:2
>       [wsmouse0-in][7437] mt:0x00:-1
>       [wsmouse0-ev][7437] 5:1 18:0
>       [wsmouse0-in][7447] abs:476,238 mt:0x01:0
>       [wsmouse0-ev][7447] 4:1 18:0
>       [wsmouse0-in][7457] abs:476,239
>       [wsmouse0-in][7467] mt:0x03:0
>       [wsmouse0-in][7477] mt:0x07:0
>       [wsmouse0-in][7648] abs:1121,718 mt:0x06:1
>       [wsmouse0-in][7658] abs:761,521 mt:0x04:2
> 
[...]


Index: dev/wscons/wstpad.c
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wstpad.c,v
retrieving revision 1.28
diff -u -p -r1.28 wstpad.c
--- dev/wscons/wstpad.c 21 Mar 2021 16:20:49 -0000      1.28
+++ dev/wscons/wstpad.c 23 Mar 2021 09:09:42 -0000
@@ -657,14 +657,8 @@ wstpad_is_tap(struct wstpad *tp, struct
        struct timespec ts;
        int dx, dy, dist = 0;

-       /*
-        * No distance limit applies if there has been more than one contact
-        * on a single-touch device.  We cannot use (t->x - t->orig.x) in this
-        * case.  Accumulated deltas might be an alternative, but some
-        * touchpads provide unreliable coordinates at the start or end of a
-        * multi-finger touch.
-        */
-       if (IS_MT(tp) || tp->tap.contacts < 2) {
+       /* Try to distinguish one-finger taps from short movements. */
+       if (tp->tap.contacts == (tp->ignore ? 2 : 1)) {
                dx = abs(t->x - t->orig.x) << 12;
                dy = abs(t->y - t->orig.y) * tp->ratio;
                dist = (dx >= dy ? dx + 3 * dy / 8 : dy + 3 * dx / 8);

Reply via email to