Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 2008 02:30:11 GMT
From:      Kai Wang <kaiwang27@gmail.com>
To:        freebsd-usb@FreeBSD.org
Subject:   Re: usb/125941: not working wheel on my microsoft notebook optical mouse 3000
Message-ID:  <200808120230.m7C2UBu7034665@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR usb/125941; it has been noted by GNATS.

From: Kai Wang <kaiwang27@gmail.com>
To: Grzegorz Blach <magik@back-up.pl>
Cc: FreeBSD-gnats-submit@FreeBSD.org, freebsd-usb@FreeBSD.org
Subject: Re: usb/125941: not working wheel on my microsoft notebook optical
	mouse 3000
Date: Tue, 12 Aug 2008 04:27:10 +0200

 --y0ulUmNC+osPPQO6
 Content-Type: text/plain; charset=utf-8
 Content-Disposition: inline
 
 On Mon, Aug 11, 2008 at 01:30:57PM -0400, Grzegorz Blach wrote:
 > On Mon, 11 Aug 2008 17:19:41 +0200, Kai Wang <kaiwang27@gmail.com> wrote:
 > > On Mon, Aug 11, 2008 at 10:19:35AM -0400, Grzegorz Blach wrote:
 > >> 
 > >> 
 > >> On Mon, 11 Aug 2008 15:34:34 +0200, Kai Wang <kaiwang27@gmail.com>
 > > wrote:
 > >> > On Tue, Aug 05, 2008 at 10:03:15AM -0400, magik@back-up.pl wrote:
 > >> >> 
 > >> >> 
 > >> >> On Thu, 24 Jul 2008 23:30:07 GMT, FreeBSD-gnats-submit@FreeBSD.org
 > >> > wrote:
 > >> >> > Thank you very much for your problem report.
 > >> >> > It has the internal identification `usb/125941'.
 > >> >> > The individual assigned to look at your
 > >> >> > report is: freebsd-usb. 
 > >> >> > 
 > >> >> > You can access the state of your problem report at any time
 > >> >> > via this link:
 > >> >> > 
 > >> >> > http://www.freebsd.org/cgi/query-pr.cgi?pr=125941
 > >> >> > 
 > >> >> >>Category:       usb
 > >> >> >>Responsible:    freebsd-usb
 > >> >> >>Synopsis:       not working wheel on my microsoft notebook optical
 > >> > mouse
 > >> >> > 3000
 > >> >> >>Arrival-Date:   Thu Jul 24 23:30:07 UTC 2008
 > >> >> 
 > >> >> I just fixed problem with wheel on my mouse
 > >> >> and I'm sending in attachment patch for /usr/src/sys/dev/usb/ums.c
 > > file.
 > >> > 
 > >> >> --- ums.c.orig	2008-08-05 17:24:21.815936911 +0200
 > >> >> +++ ums.c	2008-08-05 17:24:51.885277111 +0200
 > >> >> @@ -402,6 +402,7 @@
 > >> >>  		sc->sc_loc_x.pos = 8;
 > >> >>  		sc->sc_loc_y.pos = 16;
 > >> >>  		sc->sc_loc_z.pos = 24;
 > >> >> +                sc->sc_loc_z.size = 8;
 > >> >>  		sc->sc_loc_btn[0].pos = 0;
 > >> >>  		sc->sc_loc_btn[1].pos = 1;
 > >> >>  		sc->sc_loc_btn[2].pos = 2;
 > >> > 
 > >> > 
 > >> > Hi,
 > >> > 
 > >> > Thanks for submitting the patch. It'd be great if you could also
 > >> > test the patch below for us and paste the result here, just for
 > >> > better understanding the problem.
 > >> > 
 > >> > The patch adds some debug printfs:
 > >> > 
 > >> > --- /sys/dev/usb/ums.c	2008-05-05 20:25:42.000000000 +0200
 > >> > +++ ums.c	2008-08-11 15:25:44.000000000 +0200
 > >> > @@ -284,6 +284,7 @@
 > >> >  	wheel = hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP,
 > >> >  						  HUG_WHEEL),
 > >> >  			    hid_input, &sc->sc_loc_z, &flags);
 > >> > +	printf("wheel=%d\n", wheel);
 > >> >  
 > >> >  	if (wheel) {
 > >> >  		if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
 > >> > @@ -323,6 +324,7 @@
 > >> >  			sc->flags |= UMS_Z;
 > >> >  		}
 > >> >  	}
 > >> > +	printf("sc->flags=0x%04x\n", sc->flags);
 > >> >  
 > >> >  	/*
 > >> >  	 * The Microsoft Wireless Intellimouse 2.0 reports it's wheel
 > >> > @@ -402,6 +404,7 @@
 > >> >  		sc->sc_loc_x.pos = 8;
 > >> >  		sc->sc_loc_y.pos = 16;
 > >> >  		sc->sc_loc_z.pos = 24;
 > >> > +		printf("sc->sc_loc_z.size=%u\n", sc->sc_loc_z.size);
 > >> >  		sc->sc_loc_btn[0].pos = 0;
 > >> >  		sc->sc_loc_btn[1].pos = 1;
 > >> >  		sc->sc_loc_btn[2].pos = 2;
 > >> 
 > >> this, what I see:
 > >> 
 > >> ums0: <Microsoft Microsoft Notebook Optical Mouse with Tilt Wheel, class
 > >> 0/0, rev 2.00/1.20, addr 2> on uhub0
 > >> wheel=0
 > >> sc->flags=0x0000
 > >> ums0: 3 buttons and a TILT dir.
 > >> sc->sc_loc_z.size=0
 > >> 
 > > 
 > > Interesting. Now I suspect that Optical Mouse 3000 model 1049 got
 > > different
 > > versions.
 > > 
 > > Could you please get krepdump
 > > (http://people.freebsd.org/~kaiw/tools/krepdump.tgz)
 > > 
 > >  # tar xzvf krepdump.tgz
 > >  # cd krepdump
 > >  # make
 > >  # kldload ./krepdump.ko
 > > 
 > > Then plug in your mouse and paste the result here?
 > > 
 > > There is one version of report desc of this mouse here:
 > > http://lists.freebsd.org/pipermail/freebsd-usb/2008-February/004617.html
 > > 
 > > and my guess is your mouse's report desc is different than that...
 > > 
 > > 
 > > Thanks,
 > > Kai
 > 
 > ---- my krepdump ----
 > ums0: at uhub0 port 2 (addr 2) disconnected
 > ums0: detached
 > 
 > [report desc size=196]
 > USAGE PAGE Consumer(0xc)
 > USAGE Consumer Control(0x1)[Consumer(0xc)]
 > COLLECTION Application(1)
 >   USAGE PAGE Generic Desktop(0x1)
 >   USAGE Mouse(0x2)[Generic Desktop(0x1)]
 >   COLLECTION Logical(2)
 >     REPORT ID 19
 >     USAGE PAGE Consumer(0xc)
 >     USAGE AC Pan(0x238)[Consumer(0xc)]
 >     REPORT COUNT 1
 >     REPORT SIZE 8
 >     LOGICAL MINIMUM -127
 >     LOGICAL MAXIMUM 127
 >     INPUT ( Data Variable Relative ) (6)
 >     REPORT ID 23
 >     USAGE PAGE Microsoft(0xff00)
 >     USAGE Unknown Usage(0xff06)[Microsoft(0xff00)]
 >     LOGICAL MINIMUM 0
 >     LOGICAL MAXIMUM 1
 >     PHYSICAL MINIMUM 1
 >     PHYSICAL MAXIMUM 4
 >     REPORT COUNT 1
 >     REPORT SIZE 2
 >     FEATURE ( Data Variable Absolute ) (2)
 >     PHYSICAL MINIMUM 0
 >     PHYSICAL MAXIMUM 0
 >     FEATURE ( Const Array Absolute ) (1)
 >     USAGE Unknown Usage(0xff04)[Microsoft(0xff00)]
 >     REPORT SIZE 1
 >     FEATURE ( Data Variable Absolute ) (2)
 >     REPORT SIZE 3
 >     FEATURE ( Const Array Absolute ) (1)
 >     REPORT ID 24
 >     USAGE Unknown Usage(0xff08)[Microsoft(0xff00)]
 >     REPORT SIZE 1
 >     FEATURE ( Data Variable Absolute ) (2)
 >     REPORT SIZE 7
 >     FEATURE ( Const Array Absolute ) (1)
 >   END COLLECTION
 > END COLLECTION
 > USAGE PAGE Generic Desktop(0x1)
 > USAGE Mouse(0x2)[Generic Desktop(0x1)]
 > COLLECTION Application(1)
 >   USAGE PAGE Generic Desktop(0x1)
 >   USAGE Mouse(0x2)[Generic Desktop(0x1)]
 >   COLLECTION Logical(2)
 >     REPORT ID 17
 >     USAGE Pointer(0x1)[Generic Desktop(0x1)]
 >     COLLECTION Physical(0)
 >       USAGE PAGE Button(0x9)
 >       USAGE MINIMUM Button1(1)
 >       USAGE MAXIMUM Button3(3)
 >       REPORT COUNT 3
 >       REPORT SIZE 1
 >       LOGICAL MAXIMUM 1
 >       INPUT ( Data Variable Absolute ) (2)
 >       REPORT COUNT 1
 >       INPUT ( Const Array Absolute ) (1)
 >       USAGE Button5(0x5)[Button(0x9)]
 >       INPUT ( Data Variable Absolute ) (2)
 >       REPORT COUNT 3
 >       INPUT ( Const Array Absolute ) (1)
 >       USAGE PAGE Generic Desktop(0x1)
 >       USAGE X(0x30)[Generic Desktop(0x1)]
 >       USAGE Y(0x31)[Generic Desktop(0x1)]
 >       REPORT COUNT 2
 >       REPORT SIZE 8
 >       LOGICAL MINIMUM -127
 >       LOGICAL MAXIMUM 127
 >       INPUT ( Data Variable Relative ) (6)
 >       COLLECTION Logical(2)
 >         REPORT ID 18
 >         USAGE Resolution Multiplier(0x48)[Generic Desktop(0x1)]
 >         REPORT COUNT 1
 >         REPORT SIZE 2
 >         LOGICAL MINIMUM 0
 >         LOGICAL MAXIMUM 1
 >         PHYSICAL MINIMUM 1
 >         PHYSICAL MAXIMUM 4
 >         FEATURE ( Data Variable Absolute ) (2)
 >         PHYSICAL MINIMUM 0
 >         PHYSICAL MAXIMUM 0
 >         REPORT SIZE 6
 >         FEATURE ( Const Array Absolute ) (1)
 >         REPORT ID 17
 >         USAGE Wheel(0x38)[Generic Desktop(0x1)]
 >         LOGICAL MINIMUM -127
 >         LOGICAL MAXIMUM 127
 >         REPORT SIZE 8
 >         INPUT ( Data Variable Relative ) (6)
 >       END COLLECTION
 >       USAGE PAGE Consumer(0xc)
 >       REPORT SIZE 8
 >       USAGE AC Pan(0x238)[Consumer(0xc)]
 >       INPUT ( Data Variable Relative ) (6)
 >     END COLLECTION
 >   END COLLECTION
 > END COLLECTION
 > [hexdump]
 > 0000 05 0C 09 01 A1 01 05 01 09 02 A1 02 85 13 05 0C
 > 0010 0A 38 02 95 01 75 08 15 81 25 7F 81 06 85 17 06
 > 0020 00 FF 0A 06 FF 15 00 25 01 35 01 45 04 95 01 75
 > 0030 02 B1 02 35 00 45 00 B1 01 0A 04 FF 75 01 B1 02
 > 0040 75 03 B1 01 85 18 0A 08 FF 75 01 B1 02 75 07 B1
 > 0050 01 C0 C0 05 01 09 02 A1 01 05 01 09 02 A1 02 85
 > 0060 11 09 01 A1 00 05 09 19 01 29 03 95 03 75 01 25
 > 0070 01 81 02 95 01 81 01 09 05 81 02 95 03 81 01 05
 > 0080 01 09 30 09 31 95 02 75 08 15 81 25 7F 81 06 A1
 > 0090 02 85 12 09 48 95 01 75 02 15 00 25 01 35 01 45
 > 00A0 04 B1 02 35 00 45 00 75 06 B1 01 85 11 09 38 15
 > 00B0 81 25 7F 75 08 81 06 C0 05 0C 75 08 0A 38 02 81
 > 00C0 06 C0 C0 C0
 > ums0: <Microsoft Microsoft Notebook Optical Mouse with Tilt Wheel, class
 > 0/0, rev 2.00/1.20, addr 2> on uhub0
 > wheel=0
 > sc->flags=0x0000
 > ums0: 3 buttons and a TILT dir.
 > sc->sc_loc_z.size=0
 > ---- end of krepdump ----
 > 
 > 
 > ---- diff between my report and this from lists.freebsd.org/.../004617.html
 > ----
 > --- 1.txt	2008-08-11 19:25:56.496820730 +0200
 > +++ dump.txt	2008-08-11 19:25:59.156847633 +0200
 > @@ -1,7 +1,7 @@
 > -ums1: at uhub0 port 4 (addr 4) disconnected
 > -ums1: detached
 > - 
 > -[report desc size=3D196]
 > +ums0: at uhub0 port 2 (addr 2) disconnected
 > +ums0: detached
 > +
 > +[report desc size=196]
 >  USAGE PAGE Consumer(0xc)
 >  USAGE Consumer Control(0x1)[Consumer(0xc)]
 >  COLLECTION Application(1)
 > @@ -114,6 +114,9 @@
 >  00A0 04 B1 02 35 00 45 00 75 06 B1 01 85 11 09 38 15
 >  00B0 81 25 7F 75 08 81 06 C0 05 0C 75 08 0A 38 02 81
 >  00C0 06 C0 C0 C0
 > -ums1: <Microsoft Microsoft Notebook Optical Mouse with Tilt Wheel, class
 > 0/0, rev 2.00/1.20, addr 4> on uhub0
 > -ums1: 3 buttons and Z dir and a TILT dir.
 > +ums0: <Microsoft Microsoft Notebook Optical Mouse with Tilt Wheel, class
 > 0/0, rev 2.00/1.20, addr 2> on uhub0
 > +wheel=0
 > +sc->flags=0x0000
 > +ums0: 3 buttons and a TILT dir.
 > +sc->sc_loc_z.size=0
 > ---- end of diff ----
 > 
 > and short info:
 > 
 > When I use RELENG_7_0, driver reports that my mouse have Z dir, but on
 > RELENG_7 not.
 
 The report descriptor is the same. After some experiments, I think
 the actual problem is inside our hid parser.
 
 Could you please try the patch attached against /sys/dev/usb/hid.c
 along with the debug printf patch for ums.c, and see what the result
 will be?
 
 
 
 --y0ulUmNC+osPPQO6
 Content-Type: text/x-diff; charset=utf-8
 Content-Disposition: attachment; filename="hid.diff"
 
 --- /sys/dev/usb/hid.c	2007-06-20 07:10:52.000000000 +0200
 +++ hid.c	2008-08-12 04:14:19.000000000 +0200
 @@ -131,6 +131,8 @@
  		if (s->multi < s->multimax) {
  			c->usage = s->usages[min(s->multi, s->nu-1)];
  			s->multi++;
 +			if (s->nu > 0)
 +				s->nu--;
  			*h = *c;
  			c->loc.pos += c->loc.size;
  			h->next = 0;
 @@ -193,8 +195,11 @@
  		case 0:			/* Main */
  			switch (bTag) {
  			case 8:		/* Input */
 -				if (!(s->kindset & (1 << hid_input)))
 +				if (!(s->kindset & (1 << hid_input))) {
 +					if (s->nu > 0)
 +						s->nu--;
  					continue;
 +				}
  				c->kind = hid_input;
  				c->flags = dval;
  			ret:
 @@ -223,8 +228,11 @@
  					return (1);
  				}
  			case 9:		/* Output */
 -				if (!(s->kindset & (1 << hid_output)))
 +				if (!(s->kindset & (1 << hid_output))) {
 +					if (s->nu > 0)
 +						s->nu--;
  					continue;
 +				}
  				c->kind = hid_output;
  				c->flags = dval;
  				goto ret;
 @@ -237,8 +245,11 @@
  				s->nu = 0;
  				return (1);
  			case 11:	/* Feature */
 -				if (!(s->kindset & (1 << hid_feature)))
 +				if (!(s->kindset & (1 << hid_feature))) {
 +					if (s->nu > 0)
 +						s->nu--;
  					continue;
 +				}
  				c->kind = hid_feature;
  				c->flags = dval;
  				goto ret;
 
 --y0ulUmNC+osPPQO6--



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