aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-hub.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-05-21 16:30:15 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-05-21 16:30:15 +0000
commit0d92ed3022694aa6ec9172938e999871fa04f711 (patch)
tree21a55018bcee0a0bbb8031431ca45b1c87a433b5 /hw/usb-hub.c
parent6650ee6d3365d7f246cd7a6523c15fb542fc6032 (diff)
OHCI USB host emulation.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1928 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/usb-hub.c')
-rw-r--r--hw/usb-hub.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index ec51ad9297..e2cb283ef9 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -179,6 +179,9 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev)
else
port->wPortStatus &= ~PORT_STAT_LOW_SPEED;
port->port.dev = dev;
+ /* send the attach message */
+ dev->handle_packet(dev,
+ USB_MSG_ATTACH, 0, 0, NULL, 0);
} else {
dev = port->port.dev;
if (dev) {
@@ -188,6 +191,9 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev)
port->wPortStatus &= ~PORT_STAT_ENABLE;
port->wPortChange |= PORT_STAT_C_ENABLE;
}
+ /* send the detach message */
+ dev->handle_packet(dev,
+ USB_MSG_DETACH, 0, 0, NULL, 0);
port->port.dev = NULL;
}
}
@@ -517,7 +523,7 @@ static int usb_hub_handle_packet(USBDevice *dev, int pid,
return usb_generic_handle_packet(dev, pid, devaddr, devep, data, len);
}
-USBDevice *usb_hub_init(USBPort **usb_ports, int nb_ports)
+USBDevice *usb_hub_init(int nb_ports)
{
USBHubState *s;
USBHubPort *port;
@@ -539,12 +545,9 @@ USBDevice *usb_hub_init(USBPort **usb_ports, int nb_ports)
s->nb_ports = nb_ports;
for(i = 0; i < s->nb_ports; i++) {
port = &s->ports[i];
+ qemu_register_usb_port(&port->port, s, i, usb_hub_attach);
port->wPortStatus = PORT_STAT_POWER;
port->wPortChange = 0;
- port->port.attach = usb_hub_attach;
- port->port.opaque = s;
- port->port.index = i;
- usb_ports[i] = &port->port;
}
return (USBDevice *)s;
}