From 3da0ede1d71b8fc082a4e734cc37deda0db90635 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 21 Sep 2019 20:54:30 +0200 Subject: Dump setup packet --- usbdump.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usbdump.c b/usbdump.c index 6558663..fd3358e 100644 --- a/usbdump.c +++ b/usbdump.c @@ -121,6 +121,14 @@ void process_packet(struct usbmon_packet *hdr, char *data) else snprintf(linebuf+strlen(linebuf), LINEBUF_LEN-strlen(linebuf), "-->%d ", hdr->epnum & 0x7f); + if (hdr->xfer_type == XFER_TYPE_CONTROL) { + uint8_t bmRequestType = hdr->s.setup[0]; + uint8_t bRequest = hdr->s.setup[1]; + uint16_t wValue = hdr->s.setup[2] | (hdr->s.setup[3] << 8); + uint16_t wIndex = hdr->s.setup[4] | (hdr->s.setup[5] << 8); + snprintf(linebuf+strlen(linebuf), LINEBUF_LEN-strlen(linebuf), "%02x %d %04x %04x ", bmRequestType, bRequest, wValue, wIndex); + } + if (hdr->len_cap > 0) { if (hdr->len_cap == hdr->length) snprintf(linebuf+strlen(linebuf), LINEBUF_LEN-strlen(linebuf), "%d: ", hdr->len_cap); -- cgit v1.2.3