MS USB Wireless Mouse

Michal Vanco vanco at satro.sk
Mon Jun 13 14:49:34 GMT 2005


Michal Vanco wrote:

> ... seems like reported locations X,Y,Z and buttons are wrong.
>
well ... this works. but i'm not sure for other mices

diff -Nrua usb/ums.c /sys/dev/usb/ums.c
--- usb/ums.c   Sun Jan 30 02:00:10 2005
+++ /sys/dev/usb/ums.c  Mon Jun 13 16:24:50 2005
@@ -76,6 +76,7 @@
 #include <machine/mouse.h>
 #endif
 
+
 #ifdef USB_DEBUG
 #define DPRINTF(x)     if (umsdebug) logprintf x
 #define DPRINTFN(n,x)  if (umsdebug>(n)) logprintf x
@@ -287,6 +288,9 @@
        if (hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, 
HUG_TWHEEL),
                        hid_input, &sc->sc_loc_t, &flags)) {
                        sc->sc_loc_t.pos = sc->sc_loc_t.pos + 8;
+                       sc->sc_loc_x.pos = sc->sc_loc_x.pos - 40;
+                       sc->sc_loc_y.pos = sc->sc_loc_y.pos - 40;
+                       sc->sc_loc_z.pos = sc->sc_loc_z.pos - 40;
                        sc->flags |= UMS_T;
        }
 
@@ -307,9 +311,12 @@
               sc->nbuttons, sc->flags & UMS_Z? " and Z dir" : "",
               sc->flags & UMS_T?" and a TILT dir": "");
 
-       for (i = 1; i <= sc->nbuttons; i++)
+       for (i = 1; i <= sc->nbuttons; i++) {
                hid_locate(desc, size, HID_USAGE2(HUP_BUTTON, i),
                                hid_input, &sc->sc_loc_btn[i-1], 0);
+               if (sc->flags & UMS_T)
+                 sc->sc_loc_btn[i - 1].pos -= 40;
+       }
 
        sc->sc_isize = hid_report_size(desc, size, hid_input, &sc->sc_iid);
        sc->sc_ibuf = malloc(sc->sc_isize, M_USB, M_NOWAIT);
@@ -458,8 +465,9 @@
         */
        if (sc->flags & UMS_T) {
                if (sc->sc_iid) {
-                       if (*ibuf++ == 0x02)
-                               return;
+                 ibuf++;
+                 if (*(ibuf - 1) == 0x02 || *(ibuf - 1) == 0x14)
+                 return;
                }
        } else {
                if (sc->sc_iid) {



More information about the freebsd-stable mailing list