Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jun 2005 16:49:35 +0200
From:      Michal Vanco <vanco@satro.sk>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: MS USB Wireless Mouse
Message-ID:  <42AD9CFF.2080308@satro.sk>
In-Reply-To: <42AD7AEA.3010006@satro.sk>
References:  <42AD7AEA.3010006@satro.sk>

next in thread | previous in thread | raw e-mail | index | archive | help
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) {




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42AD9CFF.2080308>