[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/7] usb-hub: implement reset
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 4/7] usb-hub: implement reset |
Date: |
Wed, 23 Nov 2011 18:25:14 +0100 |
based on a patch from address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb-hub.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 5b48763..e195937 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -222,7 +222,22 @@ static void usb_hub_complete(USBPort *port, USBPacket
*packet)
static void usb_hub_handle_reset(USBDevice *dev)
{
- /* XXX: do it */
+ USBHubState *s = DO_UPCAST(USBHubState, dev, dev);
+ USBHubPort *port;
+ int i;
+
+ for (i = 0; i < NUM_PORTS; i++) {
+ port = s->ports + i;
+ port->wPortStatus = PORT_STAT_POWER;
+ port->wPortChange = 0;
+ if (port->port.dev && port->port.dev->attached) {
+ port->wPortStatus |= PORT_STAT_CONNECTION;
+ port->wPortChange |= PORT_STAT_C_CONNECTION;
+ if (port->port.dev->speed == USB_SPEED_LOW) {
+ port->wPortStatus |= PORT_STAT_LOW_SPEED;
+ }
+ }
+ }
}
static int usb_hub_handle_control(USBDevice *dev, USBPacket *p,
@@ -497,9 +512,8 @@ static int usb_hub_initfn(USBDevice *dev)
&port->port, s, i, &usb_hub_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
usb_port_location(&port->port, dev->port, i+1);
- port->wPortStatus = PORT_STAT_POWER;
- port->wPortChange = 0;
}
+ usb_hub_handle_reset(dev);
return 0;
}
--
1.7.1
- [Qemu-devel] [PULL 1.0] usb fixes, Gerd Hoffmann, 2011/11/23
- [Qemu-devel] [PATCH 3/7] usb-hub: wakeup on detach too., Gerd Hoffmann, 2011/11/23
- [Qemu-devel] [PATCH 5/7] usb-ehci: codestyle fixups, Gerd Hoffmann, 2011/11/23
- [Qemu-devel] [PATCH 7/7] usb-host: add usb_host_do_reset function., Gerd Hoffmann, 2011/11/23
- [Qemu-devel] [PATCH 1/7] usb: make usb_create_simple catch and pass up errors., Gerd Hoffmann, 2011/11/23
- [Qemu-devel] [PATCH 2/7] usb: fix usb_qdev_init error handling., Gerd Hoffmann, 2011/11/23
- [Qemu-devel] [PATCH 6/7] usb-ehci: add register names, Gerd Hoffmann, 2011/11/23
- [Qemu-devel] [PATCH 4/7] usb-hub: implement reset,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PULL 1.0] usb fixes, Anthony Liguori, 2011/11/28