Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
I pulled updates to libopenstm32 and noticed that some
of my experimental changes to the usb code have made
it into the library.
The API was changed for a simpler and more direct
handling of usb control requests from the application.
There is a bug in this code (or maybe the examples, since
it's not documented), but the CDC example registers the
control callback in the set_config callback, so if the device
receives multiple set_config requests the array of control
callbacks will fill up. The DFU example doesn't implement
a set_config callback, and the control callback is registered
from main(). So if control callbacks should be cleared on
set_config, then this example is broken.
Attached is a proposed patch to fix these issues:
control callbacks are cleared only if a user set_config
handler is installed. We should possibly do the same thing
with endpoints. It will simplify the implementation of devices
with only one configuration, by not requiring a set_config callback.
Let me know you how you feel the usb api should behave.
This is only a suggestion, but there is are bugs either way
that must be fixed.
Unrelated: Th patch also clears the CTR flag in usbd_poll() if an
endpoint doesn't have an associated callback function.
This fixes a problem when calling usbd_poll() from an ISR.
Black Sphere Technologies Ltd.
Mobile: +64 27 777 2182
Tel: +64 9 478 8885