Re: wsmouse(4): make tap detection less restrictive

2021-03-23 Thread Klemens Nanni
On Wed, Mar 24, 2021 at 12:10:20AM +0100, Ulf Brosziewski wrote:
> This means we have two distinct issues here.  On the Thinkpad, it's
> coordinates, on the Pinebook, it's the timing - as your logs have shown,
> there are either overlong delays between some reports, or the clock is
> irregular.  Some events are missing.
Right, in that case OK kn for the diff as it fixes one problem and does
not introduce any new ones as far as I can tell/test.

> I'm afraid that there is no quick solution for the Pinebook problem.  A
> quick web search suggests that it is not rare with this hardware; however,
> I haven't looked at any details yet.
> 
> > 
> > Do you want me to provide the same logs with this diff?
> > Anything specific order/test/action/whatever I can carry out?
> > 
> I think a new log isn't necessary at present.  I'll try to find out more,
> and if I can come up with new insights or ideas, you'll hear from me.
Thanks a lot for your help.



Re: wsmouse(4): make tap detection less restrictive

2021-03-23 Thread Ulf Brosziewski
On 3/23/21 10:39 PM, Klemens Nanni wrote:
> On Tue, Mar 23, 2021 at 09:29:09PM +0100, Ulf Brosziewski wrote:
>> In order to distinguish tap gestures from short movements, the touchpad
>> input driver in wsmouse checks whether the distance between the initial
>> and the last position of a touch exceeds the 'maxdist' limit.  Some
>> touchpads provide unreliable coordinates when more than one contact is
>> being made simultaneously, and in this case the filter may be too strong
>> - and superfluous, because only one-finger contacts should trigger pointer
>> movement; it should be safe to skip the test for multi-finger contacts
>> (with Non-MT-touchpads, it isn't possible anyway).
> This fixes it for me on the ThinkPad X230 but it seems to have no
> effect on the Pinebook Pro where double and triple taps are barely^Wnot
> recognised at all.

This means we have two distinct issues here.  On the Thinkpad, it's
coordinates, on the Pinebook, it's the timing - as your logs have shown,
there are either overlong delays between some reports, or the clock is
irregular.  Some events are missing.

I'm afraid that there is no quick solution for the Pinebook problem.  A
quick web search suggests that it is not rare with this hardware; however,
I haven't looked at any details yet.

> 
> Do you want me to provide the same logs with this diff?
> Anything specific order/test/action/whatever I can carry out?
> 
I think a new log isn't necessary at present.  I'll try to find out more,
and if I can come up with new insights or ideas, you'll hear from me.




Re: wsmouse(4): make tap detection less restrictive

2021-03-23 Thread Klemens Nanni
On Tue, Mar 23, 2021 at 09:29:09PM +0100, Ulf Brosziewski wrote:
> In order to distinguish tap gestures from short movements, the touchpad
> input driver in wsmouse checks whether the distance between the initial
> and the last position of a touch exceeds the 'maxdist' limit.  Some
> touchpads provide unreliable coordinates when more than one contact is
> being made simultaneously, and in this case the filter may be too strong
> - and superfluous, because only one-finger contacts should trigger pointer
> movement; it should be safe to skip the test for multi-finger contacts
> (with Non-MT-touchpads, it isn't possible anyway).
This fixes it for me on the ThinkPad X230 but it seems to have no
effect on the Pinebook Pro where double and triple taps are barely^Wnot
recognised at all.

Do you want me to provide the same logs with this diff?
Anything specific order/test/action/whatever I can carry out?



wsmouse(4): make tap detection less restrictive

2021-03-23 Thread Ulf Brosziewski
In order to distinguish tap gestures from short movements, the touchpad
input driver in wsmouse checks whether the distance between the initial
and the last position of a touch exceeds the 'maxdist' limit.  Some
touchpads provide unreliable coordinates when more than one contact is
being made simultaneously, and in this case the filter may be too strong
- and superfluous, because only one-finger contacts should trigger pointer
movement; it should be safe to skip the test for multi-finger contacts
(with Non-MT-touchpads, it isn't possible anyway).

OK?


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 -  1.28
+++ dev/wscons/wstpad.c 23 Mar 2021 09:09:42 -
@@ -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);