call destroy for usb devices upon removal from guest
lo list. The attached patch calls the cleanup message destroy when
the device is detached by the user from the guest.
hw/usb-hub.c +0 -1
@@ -194,7 +194,6 @@/* send the detach message */ dev->handle_packet (dev,USB_MSG_DETACH ,0 ,0 ,NULL ,0 ); - port->port.dev =NULL ; } } }
hw/usb-uhci.c +0 -1
@@ -355,7 +355,6 @@ dev->handle_packet (dev,USB_MSG_DETACH ,0 ,0 ,NULL ,0 ); } - port->port.dev =NULL ; } }
hw/usb-ohci.c +0 -1
@@ -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); }
vl.c +4 -0
@@ -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 ;