diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-03-15 11:20:45 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-03-16 00:10:06 +0100 |
commit | 291bcc09e3818fb138304663945c94f81a4101ad (patch) | |
tree | 56f43fad9591673f34f070a3cce96b688c87e335 /hw/usb/dump.c | |
parent | 62753fb57637c044fd89e05f8e4eb3c69458967e (diff) | |
download | qemu-291bcc09e3818fb138304663945c94f81a4101ad.tar.gz |
usbdump: get interval from descriptor
It looks very ugly, perhaps a helper function should moved to desc.c?
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'hw/usb/dump.c')
-rw-r--r-- | hw/usb/dump.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/hw/usb/dump.c b/hw/usb/dump.c index 727567a4c1..48da328126 100644 --- a/hw/usb/dump.c +++ b/hw/usb/dump.c @@ -26,11 +26,13 @@ */ #include "hw/usb.h" -#include "dump.h" +#include "hw/usb/dump.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/timer.h" +#include "hw/usb.h" +#include "hw/usb/desc.h" typedef struct UsbDumpState { int64_t start_ts; @@ -144,6 +146,23 @@ static uint8_t get_xfer_type_from_ep(USBEndpoint *ep) return xfer_types[ep->type]; } +static uint8_t get_ep_interval(USBEndpoint *ep) +{ + USBDevice *dev = ep->dev; + + if (ep->type != USB_ENDPOINT_XFER_ISOC && ep->type != USB_ENDPOINT_XFER_INT) { + return 0; + } + + assert(ep->ifnum < dev->ninterfaces); + const USBDescIface *iface = dev->ifaces[ep->ifnum]; + + assert(ep->nr < iface->bNumEndpoints); + const USBDescEndpoint *uep = iface->eps + ep->nr; + + return uep->bInterval; +} + /* initialize usbmon_packet header from USBPacket */ static void init_from_usbpacket(UsbDumpState *s, struct usbmon_packet *u, USBPacket *p, char ev_type, unsigned datalen) @@ -226,7 +245,7 @@ static void init_from_usbpacket(UsbDumpState *s, struct usbmon_packet *u, } /* int32_t - 48: Only for Interrupt and ISO */ - u->interval = 0; // FIXME iso, intr + u->interval = get_ep_interval(p->ep); /* int32_t - 52: For ISO */ u->start_frame = 0; // FIXME iso |