summaryrefslogtreecommitdiff
path: root/hw/usb/dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/dump.c')
-rw-r--r--hw/usb/dump.c23
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