From dba37f6f3f2b8cbec0cc4be630b63841d0a22d5c Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 17 Mar 2014 00:14:49 +0100 Subject: usbdump: do not hard-code bus number, use nr from USBBus Instead of changing bus.c (next_usb_bus) and possibly breaking configurations relying on this number, just add one in the dump code for cosmetic purposes. Signed-off-by: Peter Wu --- hw/usb/dump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/usb/dump.c b/hw/usb/dump.c index 2c94c6426d..6d35d46963 100644 --- a/hw/usb/dump.c +++ b/hw/usb/dump.c @@ -170,6 +170,7 @@ 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; + const USBBus *bus = usb_bus_from_device((USBDevice *) dev); bool is_data_in; if (p->ep->type == USB_ENDPOINT_XFER_CONTROL) { @@ -194,7 +195,8 @@ static void init_from_usbpacket(UsbDumpState *s, struct usbmon_packet *u, u->devnum = dev->addr; /* uint16_t - 12: Bus number */ - u->busnum = 1; /* does anybody care about this hard-coded bus? */ + /* The Linux guest starts numbering at 1 instead of 0 like QEMU does. */ + u->busnum = bus->busnr + 1; // TODO: usb_process_one() checks for EP0 (Default Control Pipe). Should we // also do that here? -- cgit v1.2.1