qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Implement the function usb_hub_handle_reset


From: hkran
Subject: [Qemu-devel] [PATCH] Implement the function usb_hub_handle_reset
Date: Tue, 22 Nov 2011 16:58:37 +0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Red Hat/3.1.11-2.el6_1 Thunderbird/3.1.11

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]