Revision 3cfeee61
b/hw/usb/desc.c | ||
---|---|---|
53 | 53 |
uint8_t *dest, size_t len) |
54 | 54 |
{ |
55 | 55 |
uint8_t bLength = 0x0a; |
56 |
USBDescriptor *d = (void *)dest; |
|
56 | 57 |
|
57 | 58 |
if (len < bLength) { |
58 | 59 |
return -1; |
59 | 60 |
} |
60 | 61 |
|
61 |
dest[0x00] = bLength;
|
|
62 |
dest[0x01] = USB_DT_DEVICE_QUALIFIER;
|
|
63 |
|
|
64 |
dest[0x02] = usb_lo(dev->bcdUSB);
|
|
65 |
dest[0x03] = usb_hi(dev->bcdUSB);
|
|
66 |
dest[0x04] = dev->bDeviceClass;
|
|
67 |
dest[0x05] = dev->bDeviceSubClass;
|
|
68 |
dest[0x06] = dev->bDeviceProtocol;
|
|
69 |
dest[0x07] = dev->bMaxPacketSize0;
|
|
70 |
dest[0x08] = dev->bNumConfigurations;
|
|
71 |
dest[0x09] = 0; /* reserved */
|
|
62 |
d->bLength = bLength;
|
|
63 |
d->bDescriptorType = USB_DT_DEVICE_QUALIFIER;
|
|
64 |
|
|
65 |
d->u.device_qualifier.bcdUSB_lo = usb_lo(dev->bcdUSB);
|
|
66 |
d->u.device_qualifier.bcdUSB_hi = usb_hi(dev->bcdUSB);
|
|
67 |
d->u.device_qualifier.bDeviceClass = dev->bDeviceClass;
|
|
68 |
d->u.device_qualifier.bDeviceSubClass = dev->bDeviceSubClass;
|
|
69 |
d->u.device_qualifier.bDeviceProtocol = dev->bDeviceProtocol;
|
|
70 |
d->u.device_qualifier.bMaxPacketSize0 = dev->bMaxPacketSize0;
|
|
71 |
d->u.device_qualifier.bNumConfigurations = dev->bNumConfigurations;
|
|
72 |
d->u.device_qualifier.bReserved = 0;
|
|
72 | 73 |
|
73 | 74 |
return bLength; |
74 | 75 |
} |
b/hw/usb/desc.h | ||
---|---|---|
26 | 26 |
uint8_t iSerialNumber; |
27 | 27 |
uint8_t bNumConfigurations; |
28 | 28 |
} device; |
29 |
struct { |
|
30 |
uint8_t bcdUSB_lo; |
|
31 |
uint8_t bcdUSB_hi; |
|
32 |
uint8_t bDeviceClass; |
|
33 |
uint8_t bDeviceSubClass; |
|
34 |
uint8_t bDeviceProtocol; |
|
35 |
uint8_t bMaxPacketSize0; |
|
36 |
uint8_t bNumConfigurations; |
|
37 |
uint8_t bReserved; |
|
38 |
} device_qualifier; |
|
29 | 39 |
} u; |
30 | 40 |
} QEMU_PACKED USBDescriptor; |
31 | 41 |
|
Also available in: Unified diff