On Mon, Apr 23, 2007 at 03:34:21PM -0400, Alan Stern wrote: > 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.
$ basename `readlink -f /sys/bus/usb/devices/1-6.2:1.0/driver` usbhid Not that tough :) > > > 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. Oops, you are right, sorry. > > > 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. Well, if we allow usbfs2 to "bind" to any type of usb device, this can be pretty simple to add. Even if we don't do that, it only takes 2 lines of shell to allow that to happen. Oh, have you seen the 'drivers_autoprobe' and 'drivers_probe' stuff for the bus directories in sysfs that are in the -mm and my tree? That would also allow this to work pretty easily through sysfs, as HAL will soon be able to control almost all of the binding and unbinding of devices to drivers, something the distros have wanted for some time now. > > > Release (unbind usbfs from) an interface. > > > > Use sysfs > > Likewise here. See above :) > > 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? Isn't that implicit from the USB device id number? I'm sure there's a "simple" bash script that can get the bus number from the device id... thanks, greg k-h ------------------------------------------------------------------------- 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