Revision 0d92ed30 hw/usb-hub.c
b/hw/usb-hub.c | ||
---|---|---|
179 | 179 |
else |
180 | 180 |
port->wPortStatus &= ~PORT_STAT_LOW_SPEED; |
181 | 181 |
port->port.dev = dev; |
182 |
/* send the attach message */ |
|
183 |
dev->handle_packet(dev, |
|
184 |
USB_MSG_ATTACH, 0, 0, NULL, 0); |
|
182 | 185 |
} else { |
183 | 186 |
dev = port->port.dev; |
184 | 187 |
if (dev) { |
... | ... | |
188 | 191 |
port->wPortStatus &= ~PORT_STAT_ENABLE; |
189 | 192 |
port->wPortChange |= PORT_STAT_C_ENABLE; |
190 | 193 |
} |
194 |
/* send the detach message */ |
|
195 |
dev->handle_packet(dev, |
|
196 |
USB_MSG_DETACH, 0, 0, NULL, 0); |
|
191 | 197 |
port->port.dev = NULL; |
192 | 198 |
} |
193 | 199 |
} |
... | ... | |
517 | 523 |
return usb_generic_handle_packet(dev, pid, devaddr, devep, data, len); |
518 | 524 |
} |
519 | 525 |
|
520 |
USBDevice *usb_hub_init(USBPort **usb_ports, int nb_ports)
|
|
526 |
USBDevice *usb_hub_init(int nb_ports) |
|
521 | 527 |
{ |
522 | 528 |
USBHubState *s; |
523 | 529 |
USBHubPort *port; |
... | ... | |
539 | 545 |
s->nb_ports = nb_ports; |
540 | 546 |
for(i = 0; i < s->nb_ports; i++) { |
541 | 547 |
port = &s->ports[i]; |
548 |
qemu_register_usb_port(&port->port, s, i, usb_hub_attach); |
|
542 | 549 |
port->wPortStatus = PORT_STAT_POWER; |
543 | 550 |
port->wPortChange = 0; |
544 |
port->port.attach = usb_hub_attach; |
|
545 |
port->port.opaque = s; |
|
546 |
port->port.index = i; |
|
547 |
usb_ports[i] = &port->port; |
|
548 | 551 |
} |
549 | 552 |
return (USBDevice *)s; |
550 | 553 |
} |
Also available in: Unified diff