diff options
author | 2013-04-17 11:53:10 +0000 | |
---|---|---|
committer | 2013-04-17 11:53:10 +0000 | |
commit | 9831f9b443d80fade9ab42b63c203b22caaf86ca (patch) | |
tree | 256fc6cda65d9c3c9b1823fb2f4dfacc7bdb59b0 /sys/dev/usb/usb.c | |
parent | revert rev 1.262; it fails because uid is already set here. ok djm@ (diff) | |
download | wireguard-openbsd-9831f9b443d80fade9ab42b63c203b22caaf86ca.tar.xz wireguard-openbsd-9831f9b443d80fade9ab42b63c203b22caaf86ca.zip |
Add new ioctl command USB_DEVICE_GET_DDESC to usb(4) to retrieve the
device descriptor.
Help and ok mpi@
Diffstat (limited to 'sys/dev/usb/usb.c')
-rw-r--r-- | sys/dev/usb/usb.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index b3bf1440a09..ca67a997c2f 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.86 2013/04/15 09:23:02 mglocker Exp $ */ +/* $OpenBSD: usb.c,v 1.87 2013/04/17 11:53:10 mglocker Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -679,6 +679,25 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) *(struct usb_device_stats *)data = sc->sc_bus->stats; break; + case USB_DEVICE_GET_DDESC: + { + struct usb_device_ddesc *udd = (struct usb_device_ddesc *)data; + int addr = udd->udd_addr; + struct usbd_device *dev; + + if (addr < 1 || addr >= USB_MAX_DEVICES) + return (EINVAL); + + dev = sc->sc_bus->devices[addr]; + if (dev == NULL) + return (ENXIO); + + udd->udd_bus = unit; + + udd->udd_desc = *usbd_get_device_descriptor(dev); + break; + } + case USB_DEVICE_GET_CDESC: { struct usb_device_cdesc *udc = (struct usb_device_cdesc *)data; |