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.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/usb/dump.c b/hw/usb/dump.c
index 4274508c73..672204d9c1 100644
--- a/hw/usb/dump.c
+++ b/hw/usb/dump.c
@@ -170,7 +170,13 @@ static void init_from_usbpacket(UsbDumpState *s, struct usbmon_packet *u,
const USBPacket *p, char ev_type, unsigned datalen)
{
const USBDevice *dev = p->ep->dev;
- bool is_data_in = dev->setup_buf[0] & USB_DIR_IN;
+ bool is_data_in;
+
+ if (p->ep->type == USB_ENDPOINT_XFER_CONTROL) {
+ is_data_in = dev->setup_buf[0] & USB_DIR_IN;
+ } else {
+ is_data_in = p->pid == USB_TOKEN_IN;
+ }
u->id = p->id;
@@ -182,7 +188,7 @@ static void init_from_usbpacket(UsbDumpState *s, struct usbmon_packet *u,
u->xfer_type = get_xfer_type_from_ep(p->ep);
/* unsigned char - Endpoint number and transfer direction */
- u->epnum = (dev->setup_buf[0] & USB_DIR_IN) | p->ep->nr;
+ u->epnum = (is_data_in ? USB_DIR_IN : USB_DIR_OUT) | p->ep->nr;
/* unsigned char - Device address */
u->devnum = dev->addr;