qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [usb] call destroy for usb devices upon removal from guest


From: Lonnie Mendez
Subject: [Qemu-devel] [usb] call destroy for usb devices upon removal from guest
Date: Fri, 26 May 2006 17:36:29 -0500
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

lo list. The attached patch calls the cleanup message destroy when the device is detached by the user from the guest.
--- 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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]