summary refs log tree commit diff stats
path: root/hw/usb-hub.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-12-10 11:37:45 +0100
committerGerd Hoffmann <kraxel@redhat.com>2011-01-11 17:24:42 +0100
commitc7a2196a4fcdaba977b99aca0b6a6de5e5e7f64a (patch)
tree5067804286a0d78287d28f1443e05058387d3538 /hw/usb-hub.c
parentfa7935c1e1f84b600fcb1983485352b8d99e01d3 (diff)
downloadfocaccia-qemu-c7a2196a4fcdaba977b99aca0b6a6de5e5e7f64a.tar.gz
focaccia-qemu-c7a2196a4fcdaba977b99aca0b6a6de5e5e7f64a.zip
usb: keep track of physical port address.
Add a path string to USBPort.  Add usb_port_location() function to set
the physical location of the usb port.  Update all drivers implementing
usb ports to call it.  Update the monitor commands to print it.  Wind it
up in qdev.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-hub.c')
-rw-r--r--hw/usb-hub.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index ba712d6252..387c40c040 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -256,6 +256,16 @@ static void usb_hub_wakeup(USBDevice *dev)
     }
 }
 
+static void usb_hub_handle_attach(USBDevice *dev)
+{
+    USBHubState *s = DO_UPCAST(USBHubState, dev, dev);
+    int i;
+
+    for (i = 0; i < NUM_PORTS; i++) {
+        usb_port_location(&s->ports[i].port, dev->port, i+1);
+    }
+}
+
 static void usb_hub_handle_reset(USBDevice *dev)
 {
     /* XXX: do it */
@@ -542,6 +552,7 @@ static struct USBDeviceInfo hub_info = {
     .usb_desc       = &desc_hub,
     .init           = usb_hub_initfn,
     .handle_packet  = usb_hub_handle_packet,
+    .handle_attach  = usb_hub_handle_attach,
     .handle_reset   = usb_hub_handle_reset,
     .handle_control = usb_hub_handle_control,
     .handle_data    = usb_hub_handle_data,