From owner-freebsd-stable@FreeBSD.ORG Thu Mar 18 22:02:22 2004 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B520116A4CF for ; Thu, 18 Mar 2004 22:02:22 -0800 (PST) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84C9843D48 for ; Thu, 18 Mar 2004 22:02:19 -0800 (PST) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (sccrmhc12) with ESMTP id <2004031906021501200a6tlte>; Fri, 19 Mar 2004 06:02:16 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id WAA93621; Thu, 18 Mar 2004 22:02:15 -0800 (PST) Date: Thu, 18 Mar 2004 22:02:14 -0800 (PST) From: Julian Elischer To: Matthew Dillon In-Reply-To: <200403190529.i2J5TLXs083918@apollo.backplane.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-stable@freebsd.org cc: Anthony Wood Subject: Re: USB bug fix for DETACH message. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2004 06:02:22 -0000 thanks! On Thu, 18 Mar 2004, Matthew Dillon wrote: > A DragonFly user noticed that usbd does not seem to get DETACH events > for UMASS devices. > > I tracked this down (in the FreeBSD-5 codebase for your convenience) > to line 1382 of usb_subr.c: > > /*usbd_add_dev_event(USB_EVENT_DEVICE_DETACH, dev);*/ > > This line was apparently commented out by wpaul in rev 1.22, in > January 2000. > > NetBSD has this line uncommented... that is, activated, and they > recently committed a bug fix (1.110 I believe in the NetBSD source > tree) that solves the problem I'm sure wpaul encountered that caused > him to comment the line out. The bug fix is trivial. Just above this > code, around line 1378, you simply need to NULL out dev->subdevs[i] > after detaching it: > > printf(" port %d", up->portno); > printf(" (addr %d) disconnected\n", dev->address); > config_detach(dev->subdevs[i], DETACH_FORCE); > dev->subdevs[i] = NULL; <<<<<<<<<<<<<<<<<< ADDME > > If you want DETACH events to work, uncomment the add_dev_event and > make the bug fix above and DETACH events will work again. If you are > going to do this, please do this in both FreeBSD-5.x and FreeBSD-4.x. > > You may also wish to commit NetBSD's 1.111 of sub_subr.c, which reorders > an address assignment to work around certain non-compliant USB devices > and allow them to work. The NetBSD repository can be accessed via > CVS using the server string ':pserver:anoncvs@anoncvs.netbsd.org:/cvsroot' > (don't accidently overwrite your FBsd tree, though! :-)). > > -Matt > >