On Sat, 2 Jun 2007, Michael Hanselmann wrote:

> On Fri, Jun 01, 2007 at 10:19:30AM -0400, Alan Stern wrote:
> > > @@ -779,7 +790,11 @@ static int ohci_restart (struct ohci_hcd
> > >    */
> > >   spin_lock_irq(&ohci->lock);
> > >   disable (ohci);
> > > +
> > > +#ifdef CONFIG_PM
> > >   usb_root_hub_lost_power(ohci_to_hcd(ohci)->self.root_hub);
> > > +#endif
> > > +
> 
> > Suppose CONFIG_PM isn't defined.  How are you going to let usbcore 
> > know about all the old connections which no longer exist?
> 
> You're right, something is wrong there. The patch below uses
> usb_root_hub_lost_power again but disables CONFIG_PM specific code in it
> when CONFIG_PM isn't defined. It seems to work for me with and without
> CONFIG_PM, but I have to confess I might not know enough about Linux'
> USB core. Is it better now?

Well no, even this is still wrong.

What you don't understand is how usb_root_hub_lost_power() works.  It 
doesn't actually do much of anything itself; it simply sets a flag in 
the root hub's device structure.  Then later on, when the hub driver 
is resumed it will see the flag and disconnect all the devices below 
the root hub.

In your case the last step won't work, because the hub driver will
never be resumed since it wasn't suspended to begin with.  You need to
use a completely different approach.  For instance, you could force
ohci-hcd to report connect-change events on all the ports.  Perhaps it
does something like that anyway, in which case you wouldn't have to
worry about it.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to