Re: Is libusb dead?

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
I sense a certain theme here...  :-)

On Sun, 22 Apr 2007, Greg KH wrote:

> > Something I've meant to ask for a while...  What about things that apply
> > to an entire interface or device, as opposed to a single endpoint?
> > 
> > In addition to sending or cancelling URBs, usbfs allows users to:
> > 
> > 	Issue a USB port reset to the device;
> > 
> > 	Find out the name of the driver bound to an interface;
> 
> Use sysfs

A little tricky, since it involves parsing the last component of a 
pathname stored in a symlink, but doable.

> > 	Unbind a kernel driver from an interface;
> 
> Use sysfs
> 
> > 	Find out the device's address and speed (although it doesn't
> > 	distinguish between full and high);
> 
> Use sysfs
> 
> > 	Change the altsetting for an interface;
> 
> Use sysfs

Actually this cannot be done using sysfs.  The bAlternateSetting attribute 
is read-only.  As it should be, since the altsetting is supposed to be 
determined by the driver owning the interface.

The case in question arises when a userspace driver owns the interface via 
usbfs.  The driver then needs a way to select an altsetting.

> > 	Change the device configuration;
> 
> Use sysfs
> 
> > 	Claim (bind usbfs to) an interface;
> 
> Use sysfs

Again, it can't be done.  You can use sysfs to bind a kernel driver to an 
interface, but you can't use it to bind a userspace program the way usbfs 
allows.

> > 	Release (unbind usbfs from) an interface.
> 
> Use sysfs

Likewise here.

> Let's not have a lot of duplication if we can help it :)

I agree.  Most of these things can indeed be done through sysfs.

The hardest aspect is matching up pathnames in usbfs with the
corresponding pathnames in sysfs.  Going from a usbfs name to a sysfs
path can be accomplished by looking in /sys/class/usb_device.  The other
direction is a little harder.  We have a "devnum" attribute but not a
"busnum" attribute.  Should I add one?

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/
_______________________________________________
[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.