Bug 213919 - x11/xorg: Xorg begins to lose mouse clicks at some point.
Summary: x11/xorg: Xorg begins to lose mouse clicks at some point.
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-30 16:50 UTC by Yuri Victorovich
Modified: 2016-11-07 08:19 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments
dmesg messages with sysctl hw.usb.ums.debug=16 (212.24 KB, text/plain)
2016-10-31 08:49 UTC, Yuri Victorovich
no flags Details
shar archive (18.42 KB, text/plain)
2016-10-31 08:59 UTC, Yuri Victorovich
no flags Details
mouse debug messages (212.24 KB, text/plain)
2016-10-31 09:00 UTC, Yuri Victorovich
no flags Details
UMS patch (531 bytes, patch)
2016-10-31 10:13 UTC, Hans Petter Selasky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2016-10-30 16:50:37 UTC
Beginning with some update during the last few months, Xorg begins to lose clicks from the USB mouse. The mouse moves, and clicks to some windows go through, but most don't (in kde4).

This happens almost immediately when moused is running. So I disabled "ums[0-9]+" section in /etc/devd.conf that starts moused. But this also happens without moused. Without moused it begins later, or possibly has the lower chance of happening.

This began when I upgraded 10.3 STABLE from some July revision to the current revision. Now this keeps happening when I upgraded to 11.0 STABLE. It looks like the update causing this regression has been merged into both 11 and 10.3.

Restarting Xorg helps, but then this starts happening again.
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-30 18:57:06 UTC
I observe this with USB mouse. Plugging/unplugging doesn't help. Restarting xorg helps, which suggests that the problem is in xorg, because it reopens the device every time it is plugged again and still has the problem.

Changing from kde4 to xfce4 doesn't help.

The upstream report: https://bugs.freedesktop.org/show_bug.cgi?id=98507
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-31 03:00:30 UTC
The mouse that caused the problem has "horizontal" (left/right) wheel. Replacing the mouse with the one without the wheel makes the problem go away.

I suspect that this commit to ums.c caused the problem:

> ------------------------------------------------------------------------
> r305828 | hselasky | 2016-09-15 01:34:16 -0700 (Thu, 15 Sep 2016) | 7 lines
> 
> MFC r305590:
> Correctly map the USB mouse tilt delta values into buttons 5 and 6
> instead of 3 and 4 which is used for the scroll wheel, according to
> X.org.
> 
> PR:             170358
> 
> ------------------------------------------------------------------------
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2016-10-31 07:43:10 UTC
Hi,

Can you provide more information about your mouse, like dmesg?

Is the tilt-wheel button based or a scrollwheel?

Can you send some output with hw.usb.ums.debug=16

Maybe the button to wheel conversion is simply too sensitive.

Have you tried the new EVDEV support in 12-current?

--HPS
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-31 08:23:51 UTC
It's Nano-transiver based mouse https://www.amazon.com/Microsoft-Explorer-Touch-Mouse-Black/dp/B00519UZM8:
> ukbd0: <Microsoft Microsoft Nano Transceiver v1.0, class 0/0, rev 2.00/6.74, addr 2> on usbus1

It doesn't have any moving wheels. It is a touch mouse. Moving fingers generate up/down/left/right signals.

> $ sysctl hw.usb.ums.debug=16
> hw.usb.ums.debug: 0

I didn't try EVDEV.

It worked fine for years before the update. Now left/right doesn't work at all. And additionally Xorg gets confused very quickly and wrong windows get clicks which renders workspace unusable.
Comment 5 Hans Petter Selasky freebsd_committer freebsd_triage 2016-10-31 08:26:07 UTC
After:
sysctl hw.usb.ums.debug=16

You should re-plug the device and collect debug prints from dmesg.

--HPS
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-31 08:49:19 UTC
Created attachment 176325 [details]
dmesg messages with sysctl hw.usb.ums.debug=16
Comment 7 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-31 08:59:16 UTC
Created attachment 176327 [details]
shar archive

Corrected the license.
Comment 8 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-31 09:00:17 UTC
Created attachment 176328 [details]
mouse debug messages

Sorry.
Comment 9 Hans Petter Selasky freebsd_committer freebsd_triage 2016-10-31 10:13:42 UTC
Created attachment 176331 [details]
UMS patch

Can you test the attached patch. Does it solve your problem?
Comment 10 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-31 17:45:28 UTC
Hi Hans,

With this patch the problem of Xorg unusableness is gone (click destination aren't getting messed up any more).

But left/right "wheel" signals don't work now in chrome (they definitely worked before).

In xev, left motion signal shows as:

> ButtonPress event, serial 40, synthetic NO, window 0x5000001,
>     root 0x29f, subw 0x5000002, time 1206689, (34,37), root:(981,646),
>     state 0x0, button 10, same_screen YES
> 
> EnterNotify event, serial 40, synthetic NO, window 0x5000001,
>     root 0x29f, subw 0x0, time 1206689, (34,37), root:(981,646),
>     mode NotifyGrab, detail NotifyInferior, same_screen YES,
>     focus YES, state 0
> 
> KeymapNotify event, serial 40, synthetic NO, window 0x0,
>     keys:  1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
>            0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   


Right motion signal shows as:

> ButtonPress event, serial 40, synthetic NO, window 0x5000001,
>     root 0x29f, subw 0x5000002, time 1291589, (33,23), root:(877,607),
>     state 0x0, button 11, same_screen YES
> 
> EnterNotify event, serial 40, synthetic NO, window 0x5000001,
>     root 0x29f, subw 0x0, time 1291589, (33,23), root:(877,607),
>     mode NotifyGrab, detail NotifyInferior, same_screen YES,
>     focus YES, state 0
> 
> KeymapNotify event, serial 40, synthetic NO, window 0x0,
>     keys:  4294967199 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
>            0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

Button numbers might be wrong? I didn't run such test when mouse was working, so not sure what they should be.
Comment 11 Hans Petter Selasky freebsd_committer freebsd_triage 2016-10-31 18:17:08 UTC
Hi,

Are you happy with this patch?

Button numbers can be assigned in Xorg.conf . Can you check that? /etc/X11/Xorg.conf .

--HPS
Comment 12 Yuri Victorovich freebsd_committer freebsd_triage 2016-10-31 18:30:40 UTC
What bothers me is that these buttons were working out of the box before, and now they require manual setting in xorg.conf, which simple users won't be able to do for sure.

So you know why this changed? Is this the consequence of the same patch, or maybe something else?
Comment 13 Hans Petter Selasky freebsd_committer freebsd_triage 2016-10-31 18:35:57 UTC
Hi,

The tilt wheel was assigned the wrong buttons before. The problem is that the initial testing was done using a mouse with 16-buttons, so button 5 && 6 were valid. Your mouse has fewer buttons, so the button 5 && 6 never got cleared. Did you look at PR 170358 ?

Check your Xorg.conf that the mapping of the buttons is not overwritten.

--HPS
Comment 14 commit-hook freebsd_committer freebsd_triage 2016-10-31 18:39:33 UTC
A commit references this bug:

Author: hselasky
Date: Mon Oct 31 18:38:50 UTC 2016
New revision: 308144
URL: https://svnweb.freebsd.org/changeset/base/308144

Log:
  Make sure the virtual T-axis buttons gets cleared for USB mice which has
  less than 6 buttons.

  PR:		213919
  MFC after:	3 days

Changes:
  head/sys/dev/usb/input/ums.c
Comment 15 commit-hook freebsd_committer freebsd_triage 2016-11-07 08:15:22 UTC
A commit references this bug:

Author: hselasky
Date: Mon Nov  7 08:14:29 UTC 2016
New revision: 308394
URL: https://svnweb.freebsd.org/changeset/base/308394

Log:
  MFC r308144 and r308165:
  Fixes for virtual T-axis buttons.

  Make sure the virtual T-axis buttons gets cleared for USB mice which has
  less than 6 buttons.

  Make sure the virtual T-axis buttons generate button release event(s)
  for continuous tilting.

  PR:		213919
  PR:		213957

Changes:
_U  stable/11/
  stable/11/sys/dev/usb/input/ums.c
Comment 16 commit-hook freebsd_committer freebsd_triage 2016-11-07 08:16:25 UTC
A commit references this bug:

Author: hselasky
Date: Mon Nov  7 08:15:58 UTC 2016
New revision: 308395
URL: https://svnweb.freebsd.org/changeset/base/308395

Log:
  MFC r308144 and r308165:
  Fixes for virtual T-axis buttons.

  Make sure the virtual T-axis buttons gets cleared for USB mice which has
  less than 6 buttons.

  Make sure the virtual T-axis buttons generate button release event(s)
  for continuous tilting.

  PR:	213919
  PR:	213957

Changes:
_U  stable/10/
  stable/10/sys/dev/usb/input/ums.c
Comment 17 commit-hook freebsd_committer freebsd_triage 2016-11-07 08:17:28 UTC
A commit references this bug:

Author: hselasky
Date: Mon Nov  7 08:17:24 UTC 2016
New revision: 308396
URL: https://svnweb.freebsd.org/changeset/base/308396

Log:
  MFC r308144 and r308165:
  Fixes for virtual T-axis buttons.

  Make sure the virtual T-axis buttons gets cleared for USB mice which has
  less than 6 buttons.

  Make sure the virtual T-axis buttons generate button release event(s)
  for continuous tilting.

  PR:	213919
  PR:	213957

Changes:
_U  stable/9/sys/
  stable/9/sys/dev/usb/input/ums.c
Comment 18 commit-hook freebsd_committer freebsd_triage 2016-11-07 08:19:31 UTC
A commit references this bug:

Author: hselasky
Date: Mon Nov  7 08:18:51 UTC 2016
New revision: 308397
URL: https://svnweb.freebsd.org/changeset/base/308397

Log:
  MFC r308144 and r308165:
  Fixes for virtual T-axis buttons.

  Make sure the virtual T-axis buttons gets cleared for USB mice which has
  less than 6 buttons.

  Make sure the virtual T-axis buttons generate button release event(s)
  for continuous tilting.

  PR:	213919
  PR:	213957

Changes:
_U  stable/8/sys/
_U  stable/8/sys/dev/
_U  stable/8/sys/dev/usb/
  stable/8/sys/dev/usb/input/ums.c