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.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/hw/usb/dump.c b/hw/usb/dump.c
index 4c6445e379..b756e5840b 100644
--- a/hw/usb/dump.c
+++ b/hw/usb/dump.c
@@ -105,7 +105,7 @@ static void usb_dump_packet(UsbDumpState *s, struct usbmon_packet *usbhdr,
{
struct pcap_sf_pkthdr hdr;
size_t orig_size;
- unsigned datalen = usbhdr->length;
+ unsigned datalen = usbhdr->len_cap;
/* Early return in case of previous error. */
if (s->fd < 0) {
@@ -224,11 +224,18 @@ static void init_from_usbpacket(UsbDumpState *s, struct usbmon_packet *u,
}
/* uint32_t - 32: Length of data (submitted or actual) */
- u->length = datalen;
+ if (ev_type == 'S') {
+ /* This is supposed to contain the length of the data buffer, but is
+ * much broken and probably unreliable. For IN transfers, it will always
+ * be 0 where Linux sets the size it would expect. */
+ u->length = p->actual_length;
+ } else {
+ /* actual length of the callback data */
+ u->length = datalen;
+ }
/* uint32_t - 36: Delivered length */
- u->len_cap = 0; /* TODO: find a sane value for this */
- // (this is also the "allowed" length for callback?)
+ u->len_cap = datalen;
// TODO: s.setup data? Only valid for Control Submissions
if (ev_type == 'S' && p->ep->type == USB_ENDPOINT_XFER_CONTROL) {