For T4.x to allow MTP USB type device to generate events to send to the host, the Endpoint configuration need to change to say that we are transmitting on interrupt, not receiving.
Plus I updated the end point event size to 32 as some events might be > 16. 16 is only large enought so send one parameter. I noticed Kindle Fire has it set to something like 28...
I have done similar changes for T3.x but have not tested it yet.
There are times when I wish to debug the cores files, that I wish I could do debug output to USB. Note: can do with cpp files by doing Serial.printf or the like, but more of a pain with .c files.
The printf stuff put into cores has been very useful for debuging esperailly earlier on. I understand some of the time it is needed to debug usb stuff or early on stuff so TX pin of Serial4 makes sense.
But for other debugging sessions, wish you had option to go output to the logical Serial object.
So I added a new commented out define in the printf.h file that syas
#define PRINT_DEBUG_USING_USB
That is uncommented, the debug function putchar_debug is defined to either use usb_serial_putchar if we are using normal USB Serial or use usb_seremu_putchar if using Serial emulation.
So far my main testing has been with seremu..
Not sure if this is something you are interested in. but just in case.
Did this Pull Request
If called second time - fix the counts to reflect just the size of the new buffer plus the static buffer.
Also as a precaution, resets the TX or RX head tail pointers back to 0 to make sure it is not indexing into memory that may not exist.
An experiement to see how much work again it would take to add the T4 methods to allow user sketches to increase the size of Serial ports RX and TX buffers, without having to edit the Source code which does it then for all sketches.
T3.x SerialN Add extra memory capabilities for Serial1-6
Also
Fixed serialEventX yield handling when you call begin multiple times
There is an issue that if you are not using the serialEvent type code and you call SerialX.begin multiple times, it will add that item to the process list multiple times, which can overrun the memory and cause crash or the like.
Fix was to check the list first and see if we are already in the list.
Wondered if this had already been done earlier.
Was not so am trying it now.
One side effect was had to change interrupt.c as there were
#defines for things like DR, GDIR which then caused compile issues with the structure. So renamed the defines.
Built about 3 programs with it so far. Which appear to still be working.