From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROLaF-0007G1-VO for qemu-devel@nongnu.org; Wed, 09 Nov 2011 22:45:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROLaD-000511-F6 for qemu-devel@nongnu.org; Wed, 09 Nov 2011 22:45:47 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:35928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROLaC-0004wR-R1 for qemu-devel@nongnu.org; Wed, 09 Nov 2011 22:45:45 -0500 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp07.au.ibm.com (8.14.4/8.13.1) with ESMTP id pAA3jTiq011342 for ; Thu, 10 Nov 2011 14:45:29 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pAA3gPp91605708 for ; Thu, 10 Nov 2011 14:42:30 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pAA3jPoH004694 for ; Thu, 10 Nov 2011 14:45:25 +1100 Message-ID: <4EBB48D3.8030404@linux.vnet.ibm.com> Date: Thu, 10 Nov 2011 11:45:23 +0800 From: hkran MIME-Version: 1.0 References: <1320159390-29797-1-git-send-email-kraxel@redhat.com> <1320159390-29797-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1320159390-29797-2-git-send-email-kraxel@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] usb-hub: wakeup on attach List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On 11/01/2011 10:56 PM, Gerd Hoffmann wrote: > When attaching a new device we must send a wakeup request to the root > hub, otherwise the guest will not notice the new device in case the > usb hub is suspended. > > Signed-off-by: Gerd Hoffmann > --- > hw/usb-hub.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/hw/usb-hub.c b/hw/usb-hub.c > index 09c6516..7b47079 100644 > --- a/hw/usb-hub.c > +++ b/hw/usb-hub.c > @@ -163,6 +163,7 @@ static void usb_hub_attach(USBPort *port1) > } else { > port->wPortStatus&= ~PORT_STAT_LOW_SPEED; > } > + usb_wakeup(&s->dev); > } > > static void usb_hub_detach(USBPort *port1) It seems "attach" works. But the "detach" did not work. I added over two usbdevice "tablet" and usb_del them. I found sometimes the guest did not know that the tablet had been deleted in host when the port 's status changed to "suspend". After I add usb_wake like this in the function usb_hub_detach. the problem can be fixed. static void usb_hub_detach(USBPort *port1) { USBHubState *s = port1->opaque; USBHubPort *port = &s->ports[port1->index]; usb_wakeup(&s->dev); ---------------------------------->wakeup when detach /* Let upstream know the device on this port is gone */ s->dev.port->ops->child_detach(s->dev.port, port1->dev); port->wPortStatus &= ~PORT_STAT_CONNECTION; port->wPortChange |= PORT_STAT_C_CONNECTION; if (port->wPortStatus & PORT_STAT_ENABLE) { port->wPortStatus &= ~PORT_STAT_ENABLE; port->wPortChange |= PORT_STAT_C_ENABLE; } }