Re: USB device losing power

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Mon, 12 Feb 2007, Guilherme Salgado wrote:

> > On Thu, 11 Jan 2007, Jon Smirl wrote:
> >
> [...]
> >
> > Here we see a resume that failed.  The key indicator is the 0x1000 bit in
> > the portsc value; it means the port is still suspended even after it was
> > supposed to have resumed.  This is the Intel hardware-resume bug I
> > described earlier.  I have seen it on a few occasions but I cannot
> > duplicate it reproducibly.  If you can, your system would make a good test
> > case.  Try applying the diagnostic patch below and see what happens.
> >
> > When this sort of error occurs, the USB core resets the device and
> > re-enumerates it.
> >
> > > hub 3-0:1.0: port 2 status 0004.0107 after resume, 0
> > > hub 3-0:1.0: logical disconnect on port 2
> > > usb 3-2: can't resume, status -19
> >
> > This shows the core realizing that the resume failed.
> >
> 
> I've been experiencing a similar resume failure on my fingerprint
> reader (on a Thinkpad T60) and I can reproduce it easily. I applied
> your diagnostic patch on a 2.6.20 tree and this is what I got on
> syslog. Please let me know if this is of any help and if there's
> anything else I could do to help further debugging.
> 
> Feb 12 22:51:30 frida kernel: [ 3529.760000] usb usb5: usb auto-resume
> Feb 12 22:51:30 frida kernel: [ 3529.760000] usb usb5: finish resume
> Feb 12 22:51:30 frida kernel: [ 3529.760000] hub 5-0:1.0: hub_resume
> Feb 12 22:51:30 frida kernel: [ 3529.760000] usb usb5: wakeup_rh
> Feb 12 22:51:30 frida kernel: [ 3529.800000] hub 5-0:1.0: state 7
> ports 2 chg 0000 evt 0000
> Feb 12 22:51:30 frida kernel: [ 3529.800000] usb 5-2: usb auto-resume
> Feb 12 22:51:30 frida kernel: [ 3529.832000] uhci_hcd 0000:00:1d.3:
> port 2 resume iterations 0:0
> Feb 12 22:51:30 frida kernel: [ 3529.832000] uhci_hcd 0000:00:1d.3:
> port 2 portsc 1095,01

Yep, that's the problem.  It's good to have a reliable test case, thanks.

Below is a revised version of the diagnostic patch.  Try using it instead 
of the earlier one and let's see what happens.

Alan Stern



Index: 2.6.20/drivers/usb/host/uhci-hub.c
===================================================================
--- 2.6.20.orig/drivers/usb/host/uhci-hub.c
+++ 2.6.20/drivers/usb/host/uhci-hub.c
@@ -95,6 +95,7 @@ static void uhci_finish_suspend(struct u
 {
 	int status;
 	int i;
+	int j;
 
 	if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
 		CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
@@ -106,11 +107,17 @@ static void uhci_finish_suspend(struct u
 		 * which is supposed to take 3 bit times (= 2 microseconds).
 		 * Experiments show that some controllers take longer, so
 		 * we'll poll for completion. */
+	for (j = 0; j < 1000; ++j) {
 		for (i = 0; i < 10; ++i) {
-			if (!(inw(port_addr) & USBPORTSC_RD))
-				break;
+			if (!(inw(port_addr) &
+					(USBPORTSC_SUSP | USBPORTSC_RD)))
+				goto done; //break;
 			udelay(1);
 		}
+		CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
+	}
+done:		dev_info(uhci_dev(uhci), "port %d resume iterations %d:%d\n",
+				port+1, j, i);
 	}
 	clear_bit(port, &uhci->resuming_ports);
 }


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.