* [Qemu-devel] [PATCH] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up
@ 2017-05-22 12:33 Ladi Prosek
2017-05-29 12:20 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Ladi Prosek @ 2017-05-22 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
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 <lprosek@redhat.com>
---
One more usb-hub bug found with Windows guests. This one seems
to require input devices behind two levels of hubs to reproduce.
When one of the input devices remote-wakes up, Windows kicks the
other ones from suspend state using ClearPortFeature(PORT_SUSPEND).
Then it expects the change flag to be set by the hub.
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 47b7519..e82a6a6 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up
2017-05-22 12:33 [Qemu-devel] [PATCH] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up Ladi Prosek
@ 2017-05-29 12:20 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2017-05-29 12:20 UTC (permalink / raw)
To: Ladi Prosek, qemu-devel
On Mon, 2017-05-22 at 14:33 +0200, Ladi Prosek wrote:
> 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 <lprosek@redhat.com>
Added to usb queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-29 12:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 12:33 [Qemu-devel] [PATCH] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up Ladi Prosek
2017-05-29 12:20 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).