qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lonnie Mendez <lmendez19@austin.rr.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [usb] call destroy for usb devices upon removal from guest
Date: Mon, 17 Jul 2006 03:35:12 -0500	[thread overview]
Message-ID: <1153125312.4812.7.camel@vaio> (raw)

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

lo list.  I have found the old diff to be incorrect on many levels.  New
diff has additionally cleanup code for the linux redirector.  Please see
the attached patch for solution.

[-- Attachment #2: qemu-usb-cleanup.diff --]
[-- Type: text/x-patch, Size: 975 bytes --]

--- qemu/vl.c	2006-07-17 03:16:38.191157512 -0500
+++ qemu/vl.c	2006-07-17 03:18:13.402683160 -0500
@@ -3781,6 +3781,7 @@
 {
     USBPort *port;
     USBPort **lastp;
+    USBDevice *dev;
     int bus_num, addr;
     const char *p;
 
@@ -3805,8 +3806,10 @@
     if (!port)
         return -1;
 
+    dev = port->dev;
     *lastp = port->next;
     usb_attach(port, NULL);
+    dev->handle_reset(dev, 1);
     port->next = free_usb_ports;
     free_usb_ports = port;
     return 0;
--- qemu/usb-linux.c	2006-06-26 16:00:51.000000000 -0500
+++ qemu/usb-linux.c	2006-07-17 03:32:28.427699600 -0500
@@ -59,6 +59,14 @@
 
 static void usb_host_handle_reset(USBDevice *dev, int destroy)
 {
+    USBHostDevice *s = (USBHostDevice *)dev;
+    
+    if (destroy) {
+        if (s->fd >= 0)
+            close(s->fd);
+        qemu_free(s);
+        return;
+    }
 #if 0
     USBHostDevice *s = (USBHostDevice *)dev;
     /* USBDEVFS_RESET, but not the first time as it has already be

             reply	other threads:[~2006-07-17  8:35 UTC|newest]

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