summary refs log tree commit diff stats
path: root/include/hw/usb.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-01-19 20:44:51 +0100
committerGerd Hoffmann <kraxel@redhat.com>2021-01-22 14:51:35 +0100
commit0f6dba145a4be998e0e5e4ccd94d9df8609eb327 (patch)
treee9b82396f97243e698446634dbc65ac83089da48 /include/hw/usb.h
parentd755cb9696e8aa16e850ac5f0b908015520cd395 (diff)
downloadfocaccia-qemu-0f6dba145a4be998e0e5e4ccd94d9df8609eb327.tar.gz
focaccia-qemu-0f6dba145a4be998e0e5e4ccd94d9df8609eb327.zip
usb: add pcap support.
Log all traffic of a specific usb device to a pcap file for later
inspection.  File format is compatible with linux usb monitor.

Usage:
  qemu -device usb-${somedevice},pcap=file.pcap
  wireshark file.pcap

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210119194452.2148048-1-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'include/hw/usb.h')
-rw-r--r--include/hw/usb.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/hw/usb.h b/include/hw/usb.h
index a70a72e917..abfbfc5284 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -231,6 +231,9 @@ struct USBDevice {
     void *opaque;
     uint32_t flags;
 
+    char *pcap_filename;
+    FILE *pcap;
+
     /* Actual connected speed */
     int speed;
     /* Supported speeds, not in info because it may be variable (hostdevs) */
@@ -570,4 +573,9 @@ int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
                    uint8_t interface_class, uint8_t interface_subclass,
                    uint8_t interface_protocol);
 
+/* pcap.c */
+void usb_pcap_init(FILE *fp);
+void usb_pcap_ctrl(USBPacket *p, bool setup);
+void usb_pcap_data(USBPacket *p, bool setup);
+
 #endif