Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2008 16:10:04 GMT
From:      Henrik Gulbrandsen <henrik@gulbra.net>
To:        freebsd-usb@FreeBSD.org
Subject:   Re: usb/107701: [usbd] [request] usbd ignores "detach"
Message-ID:  <200801281610.m0SGA4Va043744@freefall.freebsd.org>

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

From: Henrik Gulbrandsen <henrik@gulbra.net>
To: bug-followup@FreeBSD.org, atom@smasher.org
Cc:  
Subject: Re: usb/107701: [usbd] [request] usbd ignores "detach"
Date: Mon, 28 Jan 2008 16:42:09 +0100

 --=-bcbp/cJjit19VlGihz+i
 Content-Type: text/plain
 Content-Transfer-Encoding: 7bit
 
 This is a well-known problem covered in my original umass work:
 
 src/usb_subr.c.patch: the usbd fails to match a usbd.conf entry during
 detach, since the detach event is filled in after the device is gone.
 This is easily fixed by moving a line to fill in the information before
 we clear all the relevant data.
 
 The attached patch should still work. Of course, It may be irrelevant if
 using devd rather than usbd is the new method of choice...
 
 /Henrik
 
 
 --=-bcbp/cJjit19VlGihz+i
 Content-Disposition: attachment; filename=usb_subr.c.patch
 Content-Type: text/x-patch; name=usb_subr.c.patch; charset=ISO-8859-15
 Content-Transfer-Encoding: 7bit
 
 --- sys/dev/usb/usb_subr.c.orig	2007-06-30 22:18:44.000000000 +0200
 +++ sys/dev/usb/usb_subr.c	2007-10-29 15:54:54.000000000 +0100
 @@ -1367,6 +1367,9 @@
  	}
  #endif
  
 +	/* Fill in devinfo before clearing subdevs, so usbd gets it all. */
 +	usbd_add_dev_event(USB_EVENT_DEVICE_DETACH, dev);
 +
  	if (dev->subdevs != NULL) {
  		DPRINTFN(3,("usb_disconnect_port: disconnect subdevs\n"));
  		for (i = 0; dev->subdevs[i]; i++) {
 @@ -1385,7 +1388,6 @@
  		}
  	}
  
 -	usbd_add_dev_event(USB_EVENT_DEVICE_DETACH, dev);
  	dev->bus->devices[dev->address] = NULL;
  	up->device = NULL;
  	usb_free_device(dev);
 
 --=-bcbp/cJjit19VlGihz+i--
 



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