Improve support for detaching kernel drivers on a per interface basis.
MFC after: 1 week
This commit is contained in:
parent
03b0ca8b28
commit
d9073c1e6a
@ -750,10 +750,13 @@ usb_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
|
||||
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 *udev, uint8_t iface_index,
|
||||
{
|
||||
struct usb_interface *iface;
|
||||
|
||||
iface = usbd_get_iface(udev, iface_index);
|
||||
if (iface) {
|
||||
iface->parent_iface_index = parent_index;
|
||||
if (udev == NULL) {
|
||||
/* nothing to do */
|
||||
return;
|
||||
}
|
||||
iface = usbd_get_iface(udev, iface_index);
|
||||
if (iface != NULL)
|
||||
iface->parent_iface_index = parent_index;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2166,7 +2166,16 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user