diff options
| author | ShengYi Hung <aokblast@FreeBSD.org> | 2025-08-22 14:24:19 +0000 |
|---|---|---|
| committer | ShengYi Hung <aokblast@FreeBSD.org> | 2026-06-11 15:08:30 +0000 |
| commit | ff46acfd521e7b7b3761a395c8fa0a929e49e5d7 (patch) | |
| tree | b256aa8888595b3657763e8029788a13e81b878b /sys/dev/usb | |
| parent | f056e84e5b46acd33c5e872f384683718313bad8 (diff) | |
Diffstat (limited to 'sys/dev/usb')
| -rw-r--r-- | sys/dev/usb/usb_generic.c | 22 | ||||
| -rw-r--r-- | sys/dev/usb/usb_ioctl.h | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index ccb0b2184ec4..c564585acd5a 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -2376,6 +2376,28 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags) */ usbd_set_parent_iface(f->udev, n, n); break; + case USB_IFACE_DRIVER_ATTACH: + + error = priv_check(curthread, PRIV_DRIVER); + + if (error) + break; + + n = *u.pint & 0xFF; + + if (n == USB_IFACE_INDEX_ANY) { + error = EINVAL; + break; + } + + /* + * Attach the currently detached driver. + */ + usbd_set_parent_iface(f->udev, n, USB_IFACE_INDEX_ANY); + + usb_probe_and_attach(f->udev, n); + + break; case USB_SET_POWER_MODE: error = ugen_set_power_mode(f, *u.pint); diff --git a/sys/dev/usb/usb_ioctl.h b/sys/dev/usb/usb_ioctl.h index 85979b9cf778..a57e7bb7cbfc 100644 --- a/sys/dev/usb/usb_ioctl.h +++ b/sys/dev/usb/usb_ioctl.h @@ -273,7 +273,8 @@ struct usb_gen_quirk { #define USB_IFACE_DRIVER_DETACH _IOW ('U', 125, int) #define USB_GET_PLUGTIME _IOR ('U', 126, uint32_t) #define USB_READ_DIR _IOW ('U', 127, struct usb_read_dir) -/* 128 - 133 unused */ +#define USB_IFACE_DRIVER_ATTACH _IOW('U', 128, int) +/* 129 - 133 unused */ #define USB_GET_DEV_PORT_PATH _IOR ('U', 134, struct usb_device_port_path) #define USB_GET_POWER_USAGE _IOR ('U', 135, int) #define USB_SET_TX_FORCE_SHORT _IOW ('U', 136, int) |
