[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 7/9] usb-hub: set PORT_STAT_C_SUSPEND on host-initiat
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 7/9] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up |
Date: |
Mon, 29 May 2017 15:09:54 +0200 |
From: Ladi Prosek <address@hidden>
PORT_STAT_C_SUSPEND should be set even on host-initiated wake-up,
i.e. on ClearPortFeature(PORT_SUSPEND). Windows is known to not
work properly otherwise.
Side note, since PORT_ENABLE looks similar and might appear to
have the same issue: According to 11.24.2.7.2.2 C_PORT_ENABLE:
"This bit is set when the PORT_ENABLE bit changes from one to
zero as a result of a Port Error condition (see Section 11.8.1).
This bit is not set on any other changes to PORT_ENABLE."
Signed-off-by: Ladi Prosek <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/dev-hub.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index 47b7519910..e82a6a6c44 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -402,7 +402,20 @@ static void usb_hub_handle_control(USBDevice *dev,
USBPacket *p,
port->wPortChange &= ~PORT_STAT_C_ENABLE;
break;
case PORT_SUSPEND:
- port->wPortStatus &= ~PORT_STAT_SUSPEND;
+ if (port->wPortStatus & PORT_STAT_SUSPEND) {
+ port->wPortStatus &= ~PORT_STAT_SUSPEND;
+
+ /*
+ * USB Spec rev2.0 11.24.2.7.2.3 C_PORT_SUSPEND
+ * "This bit is set on the following transitions:
+ * - On transition from the Resuming state to the
+ * SendEOP [sic] state"
+ *
+ * Note that this includes both remote wake-up and
+ * explicit ClearPortFeature(PORT_SUSPEND).
+ */
+ port->wPortChange |= PORT_STAT_C_SUSPEND;
+ }
break;
case PORT_C_SUSPEND:
port->wPortChange &= ~PORT_STAT_C_SUSPEND;
--
2.9.3
- [Qemu-devel] [PULL 0/9] usb patch queue, Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 3/9] usb: Deprecate HMP commands usb_add and usb_del, Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 2/9] usb: Deprecate the legacy -usbdevice option, Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 1/9] ehci: fix overflow in frame timer code, Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 9/9] ehci: fix frame timer invocation., Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 5/9] xhci: split into multiple files, Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 8/9] usb: don't wakeup during coldplug, Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 4/9] usb: Simplify the parameter parsing of the legacy usb serial device, Gerd Hoffmann, 2017/05/29
- [Qemu-devel] [PULL 7/9] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 6/9] xhci: add CONFIG_USB_XHCI_NEC option, Gerd Hoffmann, 2017/05/29
- Re: [Qemu-devel] [PULL 0/9] usb patch queue, Stefan Hajnoczi, 2017/05/30