NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/55161 (Add support for Microsoft Wireless Desktop 900 Mouse)



On 11.04.20 08:58, jdolecek%NetBSD.org@localhost wrote:
> Synopsis: Add support for Microsoft Wireless Desktop 900 Mouse
> 
> State-Changed-From-To: open->closed
> State-Changed-By: jdolecek%NetBSD.org@localhost
> 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;
                }
        }



Home | Main Index | Thread Index | Old Index