On Thu, 6 Jul 2006, Vlado Handziski wrote:

> Hi Alan,
> 
> one side question with respect to the -EPROTO handling code. We are
> using libusb  to power control ports on a hub that is chained behind
> another hub (we discussed this several months ago on the list). We are
> experiencing similar problems like Christopher since we are
> intervening behind the back of the driver from userspace. After ten
> -EPROTO events (because of the Interrupt URBs I presume) the hub
> driver starts a self-healing procedure repowering the whole tree,
> eventually powering the port on the hub that we want to keep off.
> 
> I wanted to ask if the new autosuspend/remote wakeup code that you
> have proposed, will in any way change this unfortunate behavior? Will
> there be a way for the user to control this using sysfs, achieving
> port power control on chained hubs without a re-power because of the
> -EPROTO events?

The autosuspend changes will not affect this behavior.  Or rather, they 
will affect it somewhat but not in a useful way.

However you can already accomplish what you want.  Your problem is that
you have hub B plugged into port P of hub A, which is plugged into the
computer, right?  So when you turn off power to port P, the hub driver
doesn't like it.

What you need to do is unbind the hub driver from hub B before turning off 
its power.  You do that as follows:

        echo -n PATHNAME >/sys/bus/usb/drivers/hub/unbind

where PATHNAME is the name of the hub interface for hub B, typically 
something like "2-3.4:1.0" -- you'll see it in the 
/sys/bus/usb/drivers/hub directory before doing the unbind.

After you turn the port power back on, the system should automatically
bind the hub driver back to hub B.  If it doesn't you'll probably want to
bind it back yourself.  As you might guess, you do that by:

        echo -n PATHNAME >/sys/bus/usb/drivers/hub/bind

If you prefer, it's possible to write a program using libusb to do the
unbind and bind operations.  That is, I think the current version of
libusb provides those features; I haven't actually checked.  You certainly
can do them using usbfs directly without libusb.

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