From owner-freebsd-hardware@FreeBSD.ORG Thu Jun 10 17:17:52 2004 Return-Path: Delivered-To: freebsd-hardware@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95F7816A4CE for ; Thu, 10 Jun 2004 17:17:52 +0000 (GMT) Received: from mail2.speakeasy.net (mail2.speakeasy.net [216.254.0.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 78D6843D2D for ; Thu, 10 Jun 2004 17:17:52 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 12399 invoked from network); 10 Jun 2004 17:17:38 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 10 Jun 2004 17:17:37 -0000 Received: from 10.50.41.233 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i5AHHXb6027059; Thu, 10 Jun 2004 13:17:33 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Anish Mistry Date: Thu, 10 Jun 2004 13:18:24 -0400 User-Agent: KMail/1.6 References: <200406091838.i59Icugc063061@smsgw.vianetworks.ch> <200406101122.35454.jhb@FreeBSD.org> <200406101215.24347.mistry.7@osu.edu> In-Reply-To: <200406101215.24347.mistry.7@osu.edu> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200406101318.24419.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: Markus Wild cc: freebsd-hardware@FreeBSD.org Subject: Re: Fix for Logitech DiNovo cordless mouse [PATCH] X-BeenThere: freebsd-hardware@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: General discussion of FreeBSD hardware List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2004 17:17:52 -0000 On Thursday 10 June 2004 12:15 pm, Anish Mistry wrote: > On Thursday 10 June 2004 11:22 am, John Baldwin wrote: > > On Wednesday 09 June 2004 08:16 pm, Anish Mistry wrote: > > > On Wednesday 09 June 2004 02:38 pm, Markus Wild wrote: > > > > Since yesterday I'm a happy owner of a Logitech dinovo > > > > cordless USB keyboard/mouse. The keyboard works fine, however > > > > the mouse didn't move a bit. I saw that other people had similar > > > > "luck", so I enabled a bit of debugging. This is with > > > > FreeBSD-current, btw. > > > > > > > > The result of the quest was: the hid.c:hid_report_size() function > > > > returns a bogus iid value: > > > > > > > > Jun 9 19:37:06 mothra kernel: ums0: Logitech USB Receiver, rev > > > > 1.10/24.04, addr 3, iclass 3/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: bLength=7 > > > > bDescriptorType=5 bEndpoint Address=2-in bmAttributes=3 > > > > wMaxPacketSize=8 bInterval=10 Jun 9 19:37:06 mothra kernel: ums0: 7 > > > > buttons and Z dir. > > > > Jun 9 19:37:06 mothra kernel: ums_attach: sc=0xc23a1800 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: X 8/12 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: Y 20/12 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: Z 32/8 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: B1 0/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: B2 1/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: B3 2/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: B4 3/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: B5 4/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: B6 5/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: B7 6/1 > > > > Jun 9 19:37:06 mothra kernel: ums_attach: size=36, id=17 > > > > > > > > Since actual interrupt reports are issed with id 2: > > > > Jun 9 18:42:10 mothra kernel: ums_intr: sc=0xc23a1800 status=0 > > > > Jun 9 18:42:10 mothra kernel: ums_intr: data = 02 00 fa > > > > > > > > So I added a bit of debugging to the id setting for-loop. It > > > > looks like the ID cycles thru the following values at attach() time: > > > > Jun 9 19:40:57 mothra kernel: hid_report_size: 00 -> 02 > > > > Jun 9 19:40:57 mothra kernel: hid_report_size: 02 -> 03 > > > > Jun 9 19:40:57 mothra kernel: hid_report_size: 03 -> 04 > > > > Jun 9 19:40:57 mothra kernel: hid_report_size: 04 -> 10 > > > > Jun 9 19:40:57 mothra kernel: hid_report_size: 10 -> 11 > > > > (numbers are hex here) > > > > > > > > With this, my current fix is simple: only set id if it's not > > > > set already: > > > > diff -u -r1.23 hid.c > > > > --- hid.c 24 Aug 2003 17:55:54 -0000 1.23 > > > > +++ hid.c 9 Jun 2004 18:34:23 -0000 > > > > @@ -374,9 +374,10 @@ > > > > int size, id; > > > > > > > > id = 0; > > > > + bzero (&h, sizeof (h)); > > > > for (d = hid_start_parse(buf, len, 1< > > > &h); ) - if (h.report_ID != 0) > > > > - id = h.report_ID; > > > > + if (h.report_ID != 0 && !id) > > > > + id = h.report_ID; > > > > hid_end_parse(d); > > > > size = h.loc.pos; > > > > if (id != 0) { > > > > > > I've attached at big patch that should fix the problem as well as a > > > bunch of updates from the NetBSD sources. This is a patch against > > > -CURRENT, so you may have to massage it a bit if you are on -STABLE. I > > > won't have an offending device to test for at least a week so let me > > > know of any problems. > > > > - M_ZERO is preferred to malloc() + memset(), so please don't make that > > change. > > - Lots of the changes add style bugs by adding spaces to the end of > > lines. Please remove any trailing whitespace from your files. > > > > Other than that the patch looks cool. > > Ok, I think the style changes are done and I've attached the updated patch. > I've got a question though, in style it says the enums should be in all > caps, but the previous code wasn't and the NetBSD import code wasn't. > Should I change it to what style says, or is it better to stay in sync with > NetBSD? Just keep it the way NetBSD has it. I also missed another minor nit (sorry!) in that you want to leave the earlier sys/cdefs.h and FBSDID() lines as that is a FreeBSD-specific change. Other than that it looks good. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org