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>
This commit is contained in:
Gerd Hoffmann 2010-12-10 11:37:45 +01:00
parent fa7935c1e1
commit c7a2196a4f
6 changed files with 39 additions and 3 deletions

View file

@ -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,