NetBSD Problem Report #55161

From www@netbsd.org  Fri Apr 10 19:31:25 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id DDD9C1A9213
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 10 Apr 2020 19:31:25 +0000 (UTC)
Message-Id: <20200410193124.686761A921E@mollari.NetBSD.org>
Date: Fri, 10 Apr 2020 19:31:24 +0000 (UTC)
From: code@boerschig.net
Reply-To: code@boerschig.net
To: gnats-bugs@NetBSD.org
Subject: Add support for Microsoft Wireless Desktop 900 Mouse
X-Send-Pr-Version: www-1.0

>Number:         55161
>Category:       kern
>Synopsis:       Add support for Microsoft Wireless Desktop 900 Mouse
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 10 19:35:00 +0000 2020
>Closed-Date:    Sat Apr 11 06:58:18 +0000 2020
>Last-Modified:  Sun Apr 12 07:45:01 +0000 2020
>Originator:     M. Boerschig
>Release:        9.0, 9.99.55
>Organization:
>Environment:
NetBSD 9.99.55 (GENERIC)
>Description:
I use the Microsoft Wireless Desktop 900 Mouse via its 2.4 GHz transceiver.
When using on NetBSD Xorg appears to lock-up completely when moving the mouse.
Turning on usbhid debug levels showed:

[   331.239567] hidms_intr: x:-5 y:-9 z:1280 w:-1280 buttons:0x0
[   331.249570] uhidev6: expected 2 bytes, got 9
[   331.249570] hidms_intr: len=9

This confused the X server so much that it appears to freeze the whole system (well, keyboard won't react, so...)

I set this PR's priority to 'high' because it renders the system unusable when moving the mouse.

>How-To-Repeat:
Plug the Wireless Desktop 900 2.4GHz receiver in the USB port, start up X, move mouse. System freezes.
I run glxgears to demonstrate the freezing.
A slight mouse movement might take 20-30 seconds to recover, in that time glxgears is wedged.
Somehow the erroneous hid message seem to confuse X.

The workaround employed in ums.c  for other transceivers works fine.
>Fix:
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
index f81295d6d070..f8c4ed1a49b7 100644
--- a/sys/dev/usb/ums.c
+++ b/sys/dev/usb/ums.c
@@ -173,6 +173,7 @@ ums_attach(device_t parent, device_t self, void *aux)
                switch (uha->uiaa->uiaa_product) {
                case USB_PRODUCT_MICROSOFT_24GHZ_XCVR10:
                case USB_PRODUCT_MICROSOFT_24GHZ_XCVR20:
+               case USB_PRODUCT_MICROSOFT_24GHZ_XCVR80:
                case USB_PRODUCT_MICROSOFT_NATURAL_6000:
                        fixpos = 24;
                        break;
diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs
index fbe0a5b987d9..511c94854fe9 100644
--- a/sys/dev/usb/usbdevs
+++ b/sys/dev/usb/usbdevs
@@ -2328,6 +2328,7 @@ product MICROSOFT XBOX_CONTROLLER_S12     0x0289  Xbox Controller S (1.2)
 product MICROSOFT XBOX_360_WIRELESS_RECEIVER 0x0291 Xbox 360 Wireless Receiver
 product MICROSOFT 24GHZ_XCVR10         0x071d  2.4GHz Transceiver V1.0
 product MICROSOFT 24GHZ_XCVR20         0x071f  2.4GHz Transceiver V2.0
+product MICROSOFT 24GHZ_XCVR80         0x07b2  2.4GHz Transceiver V8.0
 product MICROSOFT CM6000               0x077d  Comfort Mouse 6000

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: jdolecek@NetBSD.org
State-Changed-When: Sat, 11 Apr 2020 06:58:18 +0000
State-Changed-Why:
Applied, thanks.


From: "Jaromir Dolecek" <jdolecek@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55161 CVS commit: src/sys/dev/usb
Date: Sat, 11 Apr 2020 06:54:59 +0000

 Module Name:	src
 Committed By:	jdolecek
 Date:		Sat Apr 11 06:54:59 UTC 2020

 Modified Files:
 	src/sys/dev/usb: usbdevs

 Log Message:
 add Microsoft 2.4GHz Transceiver V8.0 - PR kern/55161

 add also V7.0, found the ID


 To generate a diff of this commit:
 cvs rdiff -u -r1.779 -r1.780 src/sys/dev/usb/usbdevs

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jaromir Dolecek" <jdolecek@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55161 CVS commit: src/sys/dev/usb
Date: Sat, 11 Apr 2020 06:57:32 +0000

 Module Name:	src
 Committed By:	jdolecek
 Date:		Sat Apr 11 06:57:32 UTC 2020

 Modified Files:
 	src/sys/dev/usb: ums.c

 Log Message:
 enable the workaround for Microsoft transceiver v8.0 too - PR kern/55161

 while here enable also for v7.0, it's likely to have same problem


 To generate a diff of this commit:
 cvs rdiff -u -r1.96 -r1.97 src/sys/dev/usb/ums.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: MB <code@boerschig.net>
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
 netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, jdolecek@NetBSD.org
Cc: 
Subject: Re: kern/55161 (Add support for Microsoft Wireless Desktop 900 Mouse)
Date: Sat, 11 Apr 2020 20:13:39 +0200

 On 11.04.20 08:58, jdolecek@NetBSD.org wrote:
 > Synopsis: Add support for Microsoft Wireless Desktop 900 Mouse
 > 
 > State-Changed-From-To: open->closed
 > State-Changed-By: jdolecek@NetBSD.org
 > State-Changed-When: Sat, 11 Apr 2020 06:58:18 +0000
 > State-Changed-Why:
 > Applied, thanks.
 > 
 > 
 > 

 Sorry, I was a bit quick to submit the patch.
 I tested with TWM and everything seemed to work.
 However, after building XFCE4 it showed that x/y mouse movement also
 triggered mouse wheel events.

 So,I dumped the raw hidms_intr buffer with test input of the separate
 axes, wheel and buttons and double checked that the offsets are right.
 The device uses reports with sizes of 16, so Z and W were way off.
 The patch below introduces woffset, because otherwise W would start at
 Z+8 instead of Z+16 (the wrong offset doesn't seem to do any harm, but
 just to be correct).
 It now attaches as:
 [     8.414956] hidms_attach: X 8/16
 [     8.414956] hidms_attach: Y 24/16
 [     8.414956] hidms_attach: Z 40/16
 [     8.414956] hidms_attach: W 56/16


 Sorry for the hassle.

 diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
 index 2cac7cd1f1ee..14d2538e7df5 100644
 --- a/sys/dev/usb/ums.c
 +++ b/sys/dev/usb/ums.c
 @@ -164,6 +164,7 @@ ums_attach(device_t parent, device_t self, void *aux)

         if (uha->uiaa->uiaa_vendor == USB_VENDOR_MICROSOFT) {
                 int fixpos;
 +               int woffset=8;
                 /*
                  * The Microsoft Wireless Laser Mouse 6000 v2.0 and the
                  * Microsoft Comfort Mouse 2.0 report a bad position for
 @@ -176,6 +177,10 @@ ums_attach(device_t parent, device_t self, void *aux)
                 case USB_PRODUCT_MICROSOFT_NATURAL_6000:
                         fixpos = 24;
                         break;
 +               case USB_PRODUCT_MICROSOFT_24GHZ_XCVR80:
 +                       fixpos = 40;
 +                       woffset = sc->sc_ms.hidms_loc_z.size;
 +                       break;
                 case USB_PRODUCT_MICROSOFT_CM6000:
                         fixpos = 40;
                         break;
 @@ -190,7 +195,7 @@ ums_attach(device_t parent, device_t self, void *aux)
                         if ((sc->sc_ms.flags & HIDMS_W) &&
                             sc->sc_ms.hidms_loc_w.pos == 0)
                                 sc->sc_ms.hidms_loc_w.pos =
 -                                   sc->sc_ms.hidms_loc_z.pos + 8;
 +                                   sc->sc_ms.hidms_loc_z.pos + woffset;
                 }
         }

From: "Jaromir Dolecek" <jdolecek@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55161 CVS commit: src/sys/dev/usb
Date: Sun, 12 Apr 2020 07:41:11 +0000

 Module Name:	src
 Committed By:	jdolecek
 Date:		Sun Apr 12 07:41:11 UTC 2020

 Modified Files:
 	src/sys/dev/usb: ums.c

 Log Message:
 further tweaks for USB_PRODUCT_MICROSOFT_24GHZ_XCVR80 from PR kern/55161

 remove case for USB_PRODUCT_MICROSOFT_24GHZ_XCVR70, likely needs similar
 tweaks and can't really be added untested


 To generate a diff of this commit:
 cvs rdiff -u -r1.97 -r1.98 src/sys/dev/usb/ums.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.