All of lore.kernel.org
 help / color / mirror / Atom feed
From: hkran <hkran@linux.vnet.ibm.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: hkran <hkran@vnet.linux.ibm.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] Implement the function usb_hub_handle_reset
Date: Tue, 22 Nov 2011 16:52:05 +0800	[thread overview]
Message-ID: <4ECB62B5.6040108@linux.vnet.ibm.com> (raw)

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 <hkran@linux.vnet.ibm.com>
---
  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	other threads:[~2011-11-22  8:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22  8:52 hkran [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-11-22  9:08 [Qemu-devel] [PATCH] Implement the function usb_hub_handle_reset hkran
2011-11-22  8:58 hkran
2011-11-22 12:36 ` Gerd Hoffmann
2011-11-23  3:16   ` hkran
2011-11-22  8:37 hkran

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=4ECB62B5.6040108@linux.vnet.ibm.com \
    --to=hkran@linux.vnet.ibm.com \
    --cc=hkran@vnet.linux.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.