From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSm5d-0002qT-0z for qemu-devel@nongnu.org; Tue, 22 Nov 2011 03:52:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSm5c-00018U-2H for qemu-devel@nongnu.org; Tue, 22 Nov 2011 03:52:28 -0500 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:54817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSm5b-00018J-GB for qemu-devel@nongnu.org; Tue, 22 Nov 2011 03:52:28 -0500 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Nov 2011 08:50:38 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pAM8q7FK4509890 for ; Tue, 22 Nov 2011 19:52:07 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pAM8q7Mn008521 for ; Tue, 22 Nov 2011 19:52:07 +1100 Message-ID: <4ECB62B5.6040108@linux.vnet.ibm.com> Date: Tue, 22 Nov 2011 16:52:05 +0800 From: hkran MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] Implement the function usb_hub_handle_reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: hkran , Stefan Hajnoczi , Gerd Hoffmann Implement the function usb_hub_handle_reset. without it the guest propablly fail to configure the usb device attached to the virtulized hub with a correct address. Typically, attaching more than one usb devices when lauch qemu may lead to the problem. Signed-off-by: hkran --- hw/usb-hub.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/hw/usb-hub.c b/hw/usb-hub.c index 3eb0f1a..6731075 100644 --- a/hw/usb-hub.c +++ b/hw/usb-hub.c @@ -220,7 +220,18 @@ static void usb_hub_complete(USBPort *port, USBPacket *packet) static void usb_hub_handle_reset(USBDevice *dev) { - /* XXX: do it */ + USBHubPort *port = NULL; + USBHubState *s = (USBHubState *)dev; + int i; + + for(i = 0; i < NUM_PORTS; i++) { + port = &(s->ports[i]); + if(port->wPortStatus & PORT_STAT_CONNECTION) { + usb_reset(&port->port); + port->wPortStatus = PORT_STAT_CONNECTION | PORT_STAT_POWER; + port->wPortChange = PORT_STAT_C_CONNECTION; + } + } } static int usb_hub_handle_control(USBDevice *dev, USBPacket *p, -- 1.7.1