diff options
| author | Julian Elischer <julian@FreeBSD.org> | 2004-12-13 02:20:48 +0000 |
|---|---|---|
| committer | Julian Elischer <julian@FreeBSD.org> | 2004-12-13 02:20:48 +0000 |
| commit | d0a9f61fea88fee417309b8b51b23ff59ebf5172 (patch) | |
| tree | 3da0fe1dfc5cff86dbba30ea1a05658664fb6458 /sys | |
| parent | e97cb7b11f804a2ac3029b0d4ba2c48c531f06e5 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/usb/ums.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 458aa9536458..d1e3d3db6d52 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -431,7 +431,8 @@ ums_intr(xfer, addr, status) DPRINTFN(5, ("ums_intr: sc=%p status=%d\n", sc, status)); DPRINTFN(5, ("ums_intr: data = %02x %02x %02x %02x %02x %02x\n", - sc->sc_ibuf[0], sc->sc_ibuf[1], sc->sc_ibuf[2], sc->sc_ibuf[3], sc->sc_ibuf[4], sc->sc_ibuf[5])); + sc->sc_ibuf[0], sc->sc_ibuf[1], sc->sc_ibuf[2], + sc->sc_ibuf[3], sc->sc_ibuf[4], sc->sc_ibuf[5])); if (status == USBD_CANCELLED) return; @@ -445,31 +446,43 @@ ums_intr(xfer, addr, status) } ibuf = sc->sc_ibuf; - if (sc->sc_iid) { - ibuf++; - } - - /* The M$ Wireless Intellimouse 2.0 sends 1 extra leading byte of + /* + * The M$ Wireless Intellimouse 2.0 sends 1 extra leading byte of * data compared to most USB mice. This byte frequently switches * from 0x01 (usual state) to 0x02. I assume it is to allow * extra, non-standard, reporting (say battery-life). However * at the same time it generates a left-click message on the button * byte which causes spurious left-click's where there shouldn't be. - * This should sort that. */ - if ((sc->sc_ibuf != ibuf) && (sc->sc_ibuf[0] == 0x02)) - return; + * This should sort that. + * Currently it's the only user of UMS_T so use it as an identifier. + * We probably should switch to some more official quirk. + */ + if (sc->flags & UMS_T) { + if (sc->sc_iid) { + if (*ibuf++ == 0x02) + return; + } + } else { + if (sc->sc_iid) { + if (*ibuf++ != sc->sc_iid) + return; + } + } dx = hid_get_data(ibuf, &sc->sc_loc_x); dy = -hid_get_data(ibuf, &sc->sc_loc_y); dz = -hid_get_data(ibuf, &sc->sc_loc_z); - dt = -hid_get_data(ibuf, &sc->sc_loc_t); + if (sc->flags & UMS_T) + dt = -hid_get_data(ibuf, &sc->sc_loc_t); + else + dt = 0; for (i = 0; i < sc->nbuttons; i++) if (hid_get_data(ibuf, &sc->sc_loc_btn[i])) buttons |= (1 << UMS_BUT(i)); if (dx || dy || dz || dt || (sc->flags & UMS_Z) || buttons != sc->status.button) { - DPRINTFN(5, ("ums_intr: x:%d y:%d z:%d aa:%d buttons:0x%x\n", + DPRINTFN(5, ("ums_intr: x:%d y:%d z:%d t:%d buttons:0x%x\n", dx, dy, dz, dt, buttons)); sc->status.button = buttons; |
