On Sun, 11 Feb 2007, Tilman Schmidt wrote:

> Prompted by the current discussion on LKML, I am considering adding
> proper suspend/resume support to the USB drivers I maintain. I have
> read Documentation/power/devices.txt but much of it just refers me
> to bus specific mechanisms.
> 
> From what I found on linux-usb-devel so far, if a USB driver does
> not provide .suspend and .resume methods the suspend will proceed
> anyway, and any calls to usb_submit_urb() while the device is
> suspended will just return -EHOSTUNREACH.

Yes.

>  So if a driver is able
> to cope with that error code it should be fine. But what about
> the URBs already submitted? Will they be killed? If so, what will
> be their urb->status?

They will not be killed.  Instead most of them will eventually fail with a
low-level error like -ETIME or -EPROTO because the device, having been
suspended, won't respond to packets sent by the host.  Other odd things
might happen, however, and you shouldn't depend on any particular outcome.

> Another question is what will happen upon resume if the device has
> been unplugged while the system was suspended. Will the .resume
> (if present) and .disconnect methods both be called?

If the device has been unplugged then the resume method will not be called
and the disconnect method will.  Another possible course of events (not
yet fully implemented) is that the post_reset method will be called
instead of the resume method.  This might happen during a
resume-from-disk, for example; it tells the driver that the device has
been reset because power was lost during the suspend, so the driver should
redo any of its own device initialization.

> Is there any documentation on the specifics of supporting
> suspend/resume within a USB device driver, or a showcase driver
> which has perfect suspend/resume support and which I could use
> as reference?

I don't think there's any real documentation.  At least three USB drivers
have fully working suspending/resume support: usb-storage, usbhid, and the
hub driver.  (Maybe usblp does too; ISTR it was updated recently.)  The
hub driver is a little more complicated than the other two because it also
supports autosuspend.

Alan Stern


-------------------------------------------------------------------------
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

Reply via email to