On Mon, 26 Feb 2007, Curran, Dominic wrote: > > Hi > > I looked at the driver binding code years ago (2.4.x). Since then > things seem to have got a lot more complicated :( > > Anyway I'm using 2.6.19 now... > I have loaded the gadget Zero driver on the Device side. > I wish to load the usbtest driver on the Host side. > > Problem is that usbtest does not seem to find a device to bind to.
What shows up in the host's dmesg log (with CONFIG_USB_DEBUG turned on, of course)? > >From usbtest_init(), and assuming everything works, then the stack seems > like it should look like this: > > usb_register( usb_driver* ) > driver_register( device_driver* ) > bus_add_driver( device_driver* ) > driver_attach( device_driver* ) > bus_for_each_dev( bus_type* ) > __driver_attach( device* dev, device_driver* drv ) <== Issue here. > driver_probe_device( device_driver* drv, device* dev ) > usb_device_match(..) > usb_match_id(..) > usb_match_one_id(..) > > In __driver_attach() there is a line that reads: > > if (!dev->driver) > driver_probe_device(drv, dev); Correct so far. > I've put printk's in here and the problem seems to be that dev->driver > is never NULL, thus driver_probe_device() never gets called. > > dev->driver seems to be the address for the generic_usb structure > (dev->driver->name="usb"). You're not looking at the right instance of dev. > Is that what is supposed to happen ? Yes. > If Gadget Zero is loaded on the Dev > side and the host enumerates it but doesn't find a specific driver (like > usbtest) then is the generic_usb supposed to be assigned to it ? > > How does generic_usb get removed if usbtest is then subsequently loaded > ? > > I obviously don't understand this process, any help is appreciated. You have to realize that usbcore distinguishes between USB devices and USB interfaces. They get handled separately, and each gets bound to its own driver. Normal USB drivers bind only to interfaces. usbtest, for instance, is supposed to bind to Gadget Zero's first interface (either echo or source/sink, depending on how it is configured). usb_generic, on the other hand, binds to USB devices. It is currently the only USB-device driver, although in the future there may be others intended for things like devices exported over the network. At any rate, you've been looking at the binding process for the USB device instead of the interface. Alan Stern ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel