diff options
| author | Andrew Thompson <thompsa@FreeBSD.org> | 2010-04-07 00:32:59 +0000 |
|---|---|---|
| committer | Andrew Thompson <thompsa@FreeBSD.org> | 2010-04-07 00:32:59 +0000 |
| commit | 464b64f6c89b9876839958ad959e5f4913177cfd (patch) | |
| tree | 9d962f43117d45a0d90c10816727b455861d1314 /sys/dev/usb | |
| parent | fb8f1e2afc389d2518b8f7df946fda6c30f9033b (diff) | |
Notes
Diffstat (limited to 'sys/dev/usb')
| -rw-r--r-- | sys/dev/usb/usb_device.c | 1 | ||||
| -rw-r--r-- | sys/dev/usb/usb_device.h | 1 | ||||
| -rw-r--r-- | sys/dev/usb/usb_generic.c | 25 |
3 files changed, 21 insertions, 6 deletions
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c index 5aef59d379d0..d7f0c31c8d34 100644 --- a/sys/dev/usb/usb_device.c +++ b/sys/dev/usb/usb_device.c @@ -80,7 +80,6 @@ static void usb_init_endpoint(struct usb_device *, uint8_t, struct usb_endpoint_descriptor *, struct usb_endpoint *); static void usb_unconfigure(struct usb_device *, uint8_t); -static void usb_detach_device(struct usb_device *, uint8_t, uint8_t); static void usb_detach_device_sub(struct usb_device *, device_t *, uint8_t); static uint8_t usb_probe_and_attach_sub(struct usb_device *, diff --git a/sys/dev/usb/usb_device.h b/sys/dev/usb/usb_device.h index 66f975a5c1f8..3afdecf3ae94 100644 --- a/sys/dev/usb/usb_device.h +++ b/sys/dev/usb/usb_device.h @@ -196,6 +196,7 @@ struct usb_device *usb_alloc_device(device_t parent_dev, struct usb_bus *bus, enum usb_dev_speed speed, enum usb_hc_mode mode); usb_error_t usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index); +void usb_detach_device(struct usb_device *, uint8_t, uint8_t); usb_error_t usb_reset_iface_endpoints(struct usb_device *udev, uint8_t iface_index); usb_error_t usbd_set_config_index(struct usb_device *udev, uint8_t index); diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index 9fc0cc7eef2d..fb7d5df0fcb6 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -2095,17 +2095,32 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags) break; case USB_IFACE_DRIVER_ACTIVE: - /* TODO */ - *u.pint = 0; + + n = *u.pint & 0xFF; + + iface = usbd_get_iface(f->udev, n); + + if (iface && iface->subdev) + error = 0; + else + error = ENXIO; break; case USB_IFACE_DRIVER_DETACH: - /* TODO */ + error = priv_check(curthread, PRIV_DRIVER); - if (error) { + + if (error) + break; + + n = *u.pint & 0xFF; + + if (n == USB_IFACE_INDEX_ANY) { + error = EINVAL; break; } - error = EINVAL; + + usb_detach_device(f->udev, n, 0); break; case USB_SET_POWER_MODE: |
