svn commit: r236407 - head/sys/dev/usb
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Jun 1 16:30:54 UTC 2012
Author: hselasky
Date: Fri Jun 1 16:30:54 2012
New Revision: 236407
URL: http://svn.freebsd.org/changeset/base/236407
Log:
Improve support for detaching kernel drivers on a per interface basis.
MFC after: 1 week
Modified:
head/sys/dev/usb/usb_device.c
head/sys/dev/usb/usb_generic.c
Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c Fri Jun 1 15:52:41 2012 (r236406)
+++ head/sys/dev/usb/usb_device.c Fri Jun 1 16:30:54 2012 (r236407)
@@ -750,10 +750,13 @@ usb_config_parse(struct usb_device *udev
if (do_init) {
/* setup the USB interface structure */
iface->idesc = id;
- /* default setting */
- iface->parent_iface_index = USB_IFACE_INDEX_ANY;
/* set alternate index */
iface->alt_index = alt_index;
+ /* set default interface parent */
+ if (iface_index == USB_IFACE_INDEX_ANY) {
+ iface->parent_iface_index =
+ USB_IFACE_INDEX_ANY;
+ }
}
DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints);
@@ -1229,10 +1232,13 @@ usbd_set_parent_iface(struct usb_device
{
struct usb_interface *iface;
+ if (udev == NULL) {
+ /* nothing to do */
+ return;
+ }
iface = usbd_get_iface(udev, iface_index);
- if (iface) {
+ if (iface != NULL)
iface->parent_iface_index = parent_index;
- }
}
static void
Modified: head/sys/dev/usb/usb_generic.c
==============================================================================
--- head/sys/dev/usb/usb_generic.c Fri Jun 1 15:52:41 2012 (r236406)
+++ head/sys/dev/usb/usb_generic.c Fri Jun 1 16:30:54 2012 (r236407)
@@ -2166,7 +2166,16 @@ ugen_ioctl_post(struct usb_fifo *f, u_lo
break;
}
+ /*
+ * Detach the currently attached driver.
+ */
usb_detach_device(f->udev, n, 0);
+
+ /*
+ * Set parent to self, this should keep attach away
+ * until the next set configuration event.
+ */
+ usbd_set_parent_iface(f->udev, n, n);
break;
case USB_SET_POWER_MODE:
More information about the svn-src-head
mailing list