diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2012-03-29 12:15:01 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-04-17 10:23:28 +0200 |
commit | 3cfeee6177bb7c86db8e1fa01cd6f5d438e4c463 (patch) | |
tree | 6902a318cd04d722dda54dbb77d9a51b18ce47a1 /hw/usb/desc.c | |
parent | d3f904ea7b3027f58037e359cc199c2490dc5c3d (diff) | |
download | qemu-3cfeee6177bb7c86db8e1fa01cd6f5d438e4c463.zip qemu-3cfeee6177bb7c86db8e1fa01cd6f5d438e4c463.tar.gz qemu-3cfeee6177bb7c86db8e1fa01cd6f5d438e4c463.tar.bz2 |
usb: use USBDescriptor for device qualifier descriptors.
Add device qualifier substruct to USBDescriptor,
use it in the descriptor generator code.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/desc.c')
-rw-r--r-- | hw/usb/desc.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/hw/usb/desc.c b/hw/usb/desc.c index de7e204..5cecb25 100644 --- a/hw/usb/desc.c +++ b/hw/usb/desc.c @@ -53,22 +53,23 @@ int usb_desc_device_qualifier(const USBDescDevice *dev, uint8_t *dest, size_t len) { uint8_t bLength = 0x0a; + USBDescriptor *d = (void *)dest; if (len < bLength) { return -1; } - dest[0x00] = bLength; - dest[0x01] = USB_DT_DEVICE_QUALIFIER; - - dest[0x02] = usb_lo(dev->bcdUSB); - dest[0x03] = usb_hi(dev->bcdUSB); - dest[0x04] = dev->bDeviceClass; - dest[0x05] = dev->bDeviceSubClass; - dest[0x06] = dev->bDeviceProtocol; - dest[0x07] = dev->bMaxPacketSize0; - dest[0x08] = dev->bNumConfigurations; - dest[0x09] = 0; /* reserved */ + d->bLength = bLength; + d->bDescriptorType = USB_DT_DEVICE_QUALIFIER; + + d->u.device_qualifier.bcdUSB_lo = usb_lo(dev->bcdUSB); + d->u.device_qualifier.bcdUSB_hi = usb_hi(dev->bcdUSB); + d->u.device_qualifier.bDeviceClass = dev->bDeviceClass; + d->u.device_qualifier.bDeviceSubClass = dev->bDeviceSubClass; + d->u.device_qualifier.bDeviceProtocol = dev->bDeviceProtocol; + d->u.device_qualifier.bMaxPacketSize0 = dev->bMaxPacketSize0; + d->u.device_qualifier.bNumConfigurations = dev->bNumConfigurations; + d->u.device_qualifier.bReserved = 0; return bLength; } |