USB stack / configuration 0

Daan Vreeken [PA4DAN] Danovitsch at Vitsch.net
Thu Jan 8 07:26:04 PST 2004


On Thursday 08 January 2004 07:01, Bernd wrote:
> Im mostly worried about having more than a single device with address 0.
> You can't do this as long as another device gets initialized.
> Therefor I thought disabling/enabling the port would be better, but I'm
> wrong as the result is be the same.
With the changes I have made, it is only possible to let the USB stack reset 
the device from the ATTACH routine of a driver. This should garantee that 
there is only one device with addr==0 , since the probe & attach routines are 
only called from one process.

> > For my device driver I have made a small change to the USB Stack and I
> > have introduced the return code "USB_ATTACH_NEED_RESET" for drivers to
> > tell the USB Stack thee device needs to be re-enumerated. The stack then
> > automatically re-assigns the device it's address, and re-probes for
> > drivers. This way even two seperate drivers could be made : one with the
> > firmware and one with the real driver.
> > Is anyone interrested in a patch maybe?
> Sounds interesting.
Have a look at the patch attached to this mail.

My idea is to let a driver upload the firmware from it's ATTACH routine and 
after that return with USB_ATTACH_NEED_RESET. Since some devices really 
require a reset to be sent to it and others only need to be re-configured, 
the USB stack doesn't send the reset itself. The ATTACH function is 
responsible for sending the reset to the device.
After getting the NEED_RESET response, the USB stack assumes the device is 
ready and listening at addr==0 again. The stack re-reads the device 
descriptor, sets the address again and tries another round of attaching 
drivers. We give up after 5 rounds of NEED_RESET.

If anyone knows a more elegant way to achieve the same functionality, I'm open 
to ideas :)

grtz,
Daan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff-2004-01-08-usb-reset
Type: text/x-diff
Size: 3077 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20040108/ca7bc736/diff-2004-01-08-usb-reset.bin


More information about the freebsd-hackers mailing list