ChangeSet 1.1587.3.52, 2004/05/11 15:57:51-07:00, david-b@pacbell.net

[PATCH] USB: khubd turns port power back on after reset

This goes with the OHCI anti-deadlock patch, and is what
ensures that when a root hub loses power during suspend,
khubd can turn port power back on so devices can enumerate.


 drivers/usb/core/hub.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Fri May 14 15:28:32 2004
+++ b/drivers/usb/core/hub.c	Fri May 14 15:28:32 2004
@@ -1282,9 +1282,16 @@
 	/* Disconnect any existing devices under this port */
 	if (hub->children[port])
 		usb_disconnect(&hub->children[port]);
- 
+
 	/* Return now if nothing is connected */
 	if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
+
+		/* maybe switch power back on (e.g. root hub was reset) */
+		if ((hubstate->descriptor->wHubCharacteristics
+					& HUB_CHAR_LPSM) < 2
+				&& !(portstatus & (1 << USB_PORT_FEAT_POWER)))
+			set_port_feature(hub, port + 1, USB_PORT_FEAT_POWER);
+ 
 		if (portstatus & USB_PORT_STAT_ENABLE)
   			goto done;
 		return;
