USB mouse problem

Kris Maglione bsdaemon at comcast.net
Wed Oct 19 21:36:46 PDT 2005


I've had a Gyration USB keyboard/mouse combo for a few years, and haven't used 
the mouse, simply because it didn't work with FreeBSD. I've finally gotten 
around to trying to do something about that.

Both the mouse and keyboard are recognized. The problem is that all input is 
ignored unless the middle mouse button is depressed. In that case, though, the 
input is garbled... There are spurious button events and the x/y/z axes 
seemingly random values. y/z tend to stay around the same number, though those 
numbers change each time that ums is attached.

I've found where the input is disguarded, in ums.c:447 (RELENG_5 tag)
	ibuf = sc->sc_ibuf;
	/*
	 * 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.
	 * 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)
			    // Returns here
				return;
		}
	}

It returns in the else block as labeled by the comment. The value of *ibuf 
(i.e. sc->sc_ibuf[0]) is always 0x00 and sc->sc_iid is always 0x04. With the 
wheel down, they're both 0x04.

If I comment out the return line, I get the same garbled data that I get with 
the wheel button down. In that case, though, the x access movement values are 
more or less accurate.

This seems to me like the problems caused by setting the wrong protocol for 
ps/2/serial mice, but you can't choose the protocol for USB mice.

Any help on the matter would be appreciated. I have debugging output also, if 
that would help.

Here's what I get on ums attach:
> ums0: Gyration GyroPoint RF Technology Receiver, rev 1.10/1.20, addr 2, iclass 
> 3
> /1
> ums0: 7 buttons and Z dir.
> ums_attach: sc=0xc1faa000
> ums_attach: X   8/8
> ums_attach: Y   16/8
> ums_attach: Z   24/8
> ums_attach: B1  0/1
> ums_attach: B2  1/1
> ums_attach: B3  2/1
> ums_attach: B4  3/1
> ums_attach: B5  4/1
> ums_attach: B6  32/1
> ums_attach: B7  33/1
> ums_attach: size=15, id=4

Thanks
-- 
Kris Maglione

If you are already in a hole, there's no use to continue
digging.


More information about the freebsd-hackers mailing list