qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lonnie Mendez <lmendez19@austin.rr.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [usb] call destroy for usb devices upon removal from guest
Date: Fri, 26 May 2006 17:36:29 -0500	[thread overview]
Message-ID: <447782ED.5010407@austin.rr.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 123 bytes --]

   lo list.  The attached patch calls the cleanup message destroy when 
the device is detached by the user from the guest.

[-- Attachment #2: qemu-usb-destroy.diff --]
[-- Type: text/plain, Size: 1486 bytes --]

--- 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	other threads:[~2006-05-26 22:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26 22:36 Lonnie Mendez [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-07-17  8:35 [Qemu-devel] [usb] call destroy for usb devices upon removal from guest Lonnie Mendez
2006-07-18 21:36 ` Fabrice Bellard
2006-07-18 21:46 ` Fabrice Bellard
2006-07-19  3:12   ` Lonnie Mendez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=447782ED.5010407@austin.rr.com \
    --to=lmendez19@austin.rr.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).