--- qemu/hw/usb-hub.c 2006-05-25 18:58:51.000000000 -0500 +++ qemu/hw/usb-hub.c 2006-05-26 16:47:47.000000000 -0500 @@ -194,7 +194,6 @@ /* send the detach message */ dev->handle_packet(dev, USB_MSG_DETACH, 0, 0, NULL, 0); - port->port.dev = NULL; } } } --- qemu/hw/usb-uhci.c 2006-05-22 12:17:06.000000000 -0500 +++ qemu/hw/usb-uhci.c 2006-05-26 15:41:48.000000000 -0500 @@ -355,7 +355,6 @@ dev->handle_packet(dev, USB_MSG_DETACH, 0, 0, NULL, 0); } - port->port.dev = NULL; } } --- qemu/hw/usb-ohci.c 2006-05-25 18:37:07.000000000 -0500 +++ qemu/hw/usb-ohci.c 2006-05-26 16:58:03.000000000 -0500 @@ -308,7 +308,6 @@ dev->handle_packet(dev, USB_MSG_DETACH, 0, 0, NULL, 0); } - port->port.dev = NULL; dprintf("usb-ohci: Detached port %d\n", port1->index); } --- qemu/vl.c 2006-05-25 18:58:51.000000000 -0500 +++ qemu/vl.c 2006-05-26 15:42:55.000000000 -0500 @@ -3313,6 +3313,7 @@ { USBPort *port; USBPort **lastp; + USBDevice *dev; int bus_num, addr; const char *p; @@ -3339,6 +3340,9 @@ *lastp = port->next; usb_attach(port, NULL); + dev = port->dev; + dev->handle_packet(dev, USB_MSG_DESTROY, 0, 0, NULL, 0); + port->dev = NULL; port->next = free_usb_ports; free_usb_ports = port; return 0;