Yay! And very many thanks for doing that, much appreciated. That's already rolled into the latest 1.22.0-297 and works perfectly as far as I am concerned, as far as I have tested things.I've submitted a patch so the disconnect won't happen if USBDevice hasn't been set active:
https://github.com/micropython/micropython/pull/14194
My earlier 'mpremote run' to read and report 'machine.USBDevice' info, which provoked tear-down and having to be run twice because of instantiation, now runs each and every time.
So I'm happy. The 'machine.USBDevice' works as I'd expect it to by default. Dynamic USB can be disabled if one wants to use one's own USB descriptors instead, and that also works. Integrating the two is a work in progress, non-essential, at least non-urgent.
That is very welcome. Notionally it's easy to create binary descriptors but, yes, having something to create them for you from higher level definitions, a bit like using TinyUSB macros when compiled in, makes it a whole lot easier and simpler, even remotely possible for those who don't want to get into the low-level aspects of USB.I've just attended the Melbourne meetup where Damien demo'd the low-level USBDevice code. I'm really glad there's higher level library code for us mere mortals.
Having to actually do what the high-level stuff does is what kept me from moving to my own dynamic USB implementation, plus I was waiting to see what MicroPython implemented and adopted to save me that effort.
Between them, TinyUSB macros and the MicroPython high-level generator, we have a superb reference for anyone who does want to get into the low-level stuff. Nothing beats 'is what I'm generating the same as what something which works is generating' for checking you're on the right path and solving discrepancies in what it should be.
If nothing else it allows getting additional interface types working a lot easier than having to repeatedly build and upload new firmware.
Statistics: Posted by hippy — Wed Mar 27, 2024 8:09 pm