[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/21] usb: use USBDescriptor for interface descript
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 16/21] usb: use USBDescriptor for interface descriptors. |
Date: |
Tue, 17 Apr 2012 10:45:21 +0200 |
Add interface descriptor substruct to USBDescriptor,
use it in the descriptor generator code.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/desc.c | 20 +++++++++++---------
hw/usb/desc.h | 9 +++++++++
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/hw/usb/desc.c b/hw/usb/desc.c
index 3466968..2b8febb 100644
--- a/hw/usb/desc.c
+++ b/hw/usb/desc.c
@@ -159,20 +159,22 @@ int usb_desc_iface(const USBDescIface *iface, uint8_t
*dest, size_t len)
{
uint8_t bLength = 0x09;
int i, rc, pos = 0;
+ USBDescriptor *d = (void *)dest;
if (len < bLength) {
return -1;
}
- dest[0x00] = bLength;
- dest[0x01] = USB_DT_INTERFACE;
- dest[0x02] = iface->bInterfaceNumber;
- dest[0x03] = iface->bAlternateSetting;
- dest[0x04] = iface->bNumEndpoints;
- dest[0x05] = iface->bInterfaceClass;
- dest[0x06] = iface->bInterfaceSubClass;
- dest[0x07] = iface->bInterfaceProtocol;
- dest[0x08] = iface->iInterface;
+ d->bLength = bLength;
+ d->bDescriptorType = USB_DT_INTERFACE;
+
+ d->u.interface.bInterfaceNumber = iface->bInterfaceNumber;
+ d->u.interface.bAlternateSetting = iface->bAlternateSetting;
+ d->u.interface.bNumEndpoints = iface->bNumEndpoints;
+ d->u.interface.bInterfaceClass = iface->bInterfaceClass;
+ d->u.interface.bInterfaceSubClass = iface->bInterfaceSubClass;
+ d->u.interface.bInterfaceProtocol = iface->bInterfaceProtocol;
+ d->u.interface.iInterface = iface->iInterface;
pos += bLength;
for (i = 0; i < iface->ndesc; i++) {
diff --git a/hw/usb/desc.h b/hw/usb/desc.h
index 298e050..6f42eae 100644
--- a/hw/usb/desc.h
+++ b/hw/usb/desc.h
@@ -45,6 +45,15 @@ typedef struct USBDescriptor {
uint8_t bmAttributes;
uint8_t bMaxPower;
} config;
+ struct {
+ uint8_t bInterfaceNumber;
+ uint8_t bAlternateSetting;
+ uint8_t bNumEndpoints;
+ uint8_t bInterfaceClass;
+ uint8_t bInterfaceSubClass;
+ uint8_t bInterfaceProtocol;
+ uint8_t iInterface;
+ } interface;
} u;
} QEMU_PACKED USBDescriptor;
--
1.7.1
- [Qemu-devel] [PATCH 05/21] usb-host: trace emulated requests, (continued)
- [Qemu-devel] [PATCH 05/21] usb-host: trace emulated requests, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 17/21] usb: use USBDescriptor for endpoint descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 01/21] usb/vmstate: add parent dev path, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 11/21] usb-ehci: fix ehci_child_detach, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 14/21] usb: use USBDescriptor for device qualifier descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 10/21] usb-hub: add tracepoints, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 18/21] usb-host: rewrite usb_linux_update_endp_table, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 21/21] usb-ehci: drop assert(), Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 08/21] usb-host: add property to turn off pipelining, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 19/21] usb-ehci: Drop unused sofv value, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 16/21] usb: use USBDescriptor for interface descriptors.,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 09/21] usb_packet_set_state: handle p->ep == NULL, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 06/21] usb-host: trace canceled requests, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 20/21] usb-redir: Notify our peer when we reject a device due to a speed mismatch, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 13/21] usb: add USBDescriptor, use for device descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 12/21] usb-ehci: frindex always is a 14 bits counter, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 02/21] usb-uhci: stop queue filling when we find a in-flight td, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 15/21] usb: use USBDescriptor for config descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 04/21] Add bootindex support to usb-host and usb-redir, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 07/21] usb-host: add usb packet to request tracepoints, Gerd Hoffmann, 2012/04/17
- Re: [Qemu-devel] [PULL 00/21] usb patch queue, Hans de Goede, 2012/04/17