@Paul @mjs513 and others...
Expanding on my first issue in the 2nd post about MTP working with Serial or emulated Serial.
That is how MTP and Serial or Emulated Serial don't like to work with each other very well and sketch startup time.
I am having a little better luck with my experiment with changing the MTP Disk with emulated Serial, when I reordered the Interfaces in the usb_desc.h Maybe it is only circumstantial...
What I am wondering is how the USB client code works along with the PC, where for example if we have multiple USB interfaces:
In this case when MTP starts up, the host sends out a request message: of Start a Session, and waits for a response from us.
In the mean time, our code may be waiting for the Serial object to be available before we continue... Or I usually have a timeout of 5 seconds.
Currently the MTP code does not respond to the start session, until all of the setup() code completes and the loop code calls off to the mtpd.loop...
Again note: sometime wish some devices this may be awhile. like > 10 seconds.
Sometime about then the emulated serial output will start output at that time, other times it may not output anything, until I enter something .
In my last run the output started like:
Code:
5373 CMD: 1004(GET_STORAGE_IDS)l: 12 T:3
5373 RESP:2001(RSP:OK)l: 12 T:3
5373 CMD: 1005(GET_STORAGE_INFO)l: 16 T:4 : 10001
65537 0 name:Program
65537 0 name:Program
5373 RESP:2001(RSP:OK)l: 16 T:4 : 10001
5373 CMD: 1005(GET_STORAGE_INFO)l: 16 T:5 : 20001
Note: in my current code here the CMD/RESP lines the first number is millis(), so the first message response of OK was sent just before this and was lost but the next message received was 5+ seconds into the run, and that was with my bypassing the 10 seconds to get the used space of the SD Card...
Sorry I know this may be unclear, but not sure best way to ask this.
Simply put, can slow processing of inputs on one USB Interface case the Serial code to not receive the special message saying that the Serial port is there for an extended period of time?
Again I know that is probably unclear!
Edit: Next thing I may try on this, is to have the while(!Serial....) code
Is to maybe at startup, add in the code like we do in the background when we format drives, which is start intervalTimer and if it receives any messages, it responds back with MTP_RESPONSE_DEVICE_BUSY
...