On Mon, 21 Jul 2003, Oliver Neukum wrote: > Am Montag, 21. Juli 2003 20:02 schrieb Alan Stern: > > David: > > > > My last patch for usbcore concerns usb_device_remove() in usb.c. The most > > annoying things about it is its name. The routine doesn't remove USB > > devices; it disconnects drivers from interfaces. So I renamed it > > usb_remove_driver(). Luckily it's not used in many places. > > Quite misleading as well :-) > It doesn't remove a driver, as the driver stays loaded. > I suggest calling it usb_unlink_interface_driver()
Sounds good to me. I didn't think the name I picked was all that great. > > The real problem is that it calls nuke_urbs() for the device containing > > the interface it's given. That is clearly a mistake, since nuke_urbs() > > gets rid of all URBs for the device, not just the one interface. I wrote > > another helper function, disable_interface(), which does the same thing as > > nuke_urbs() but only for endpoints belonging to a single interface. > > Would it be worthwhile to implement nuke_urbs() based on this? > What about ep 0? It's probably easier, certainly safer, to leave things as they are. enable_interface() and disable_interface() only touch the endpoints listed in the interface descriptor, so they don't affect ep 0. nuke_urbs() can ignore the interfaces entirely and just do all the endpoints. > > Disabling and enabling interfaces would be a lot easier and more reliable > > if struct urb contained a usb_interface field instead of (or in addition > > to) its usb_device field. But that would be an immense change, something > > for 2.7. > > URBs are addressed at device/endpoint pairs. Interfaces don't exist at > that level, so I don't think that they should be dragged into it. > But I might be wrong. You are right as far as the addressing goes. But there's more to it than that. URBs are processed on behalf of drivers, which are bound to interfaces. If you want to remove a driver (or do anything else that affects just a single interface) the only safe way to identify which URBs are affected is to have the URB say which interface it goes with. In particular, that's the only way to tell which of the URBs going to ep 0 belong to your driver. This might be considered a flaw in the USB specification. It would make some things easier if ep 0 were reserved for overall device manipulation functions (not class- or interface-specific) and each interface had its own control endpoint that it didn't share with any other interfaces. Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
