From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G2xTP-0002BQ-Uu for qemu-devel@nongnu.org; Tue, 18 Jul 2006 17:51:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G2xTP-0002B9-HD for qemu-devel@nongnu.org; Tue, 18 Jul 2006 17:51:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2xTP-0002B6-Dv for qemu-devel@nongnu.org; Tue, 18 Jul 2006 17:51:23 -0400 Received: from [84.96.92.61] (helo=sMtp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G2xWN-0006pD-Sl for qemu-devel@nongnu.org; Tue, 18 Jul 2006 17:54:28 -0400 Received: from [84.102.211.90] by sp604002mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0J2M00AY4C17IGF0@sp604002mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Tue, 18 Jul 2006 23:36:43 +0200 (CEST) Date: Tue, 18 Jul 2006 23:36:42 +0200 From: Fabrice Bellard Subject: Re: [Qemu-devel] [usb] call destroy for usb devices upon removal from guest In-reply-to: <1153125312.4812.7.camel@vaio> Message-id: <44BD546A.2040706@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <1153125312.4812.7.camel@vaio> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: lmendez19@austin.rr.com Cc: qemu-devel@nongnu.org Hi, Calling dev->handle_reset() is redundant with usb_attach(port, NULL) and is also incorrect because dev->handle_reset is a private helper for the usb devices (the real message is USB_DETACH). Regards, Fabrice. Lonnie Mendez wrote: > 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. > > > ------------------------------------------------------------------------ > > --- 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 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel