Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBDevice by
Diff: USBDevice/USBDevice.cpp
- Revision:
- 28:c09a0c9bf425
- Parent:
- 26:8ef73dd868a0
--- a/USBDevice/USBDevice.cpp Wed Jun 18 09:00:48 2014 +0100
+++ b/USBDevice/USBDevice.cpp Tue Aug 05 20:15:19 2014 +0100
@@ -187,7 +187,27 @@
/* Check we should be transferring data OUT */
if (transfer.direction != HOST_TO_DEVICE)
{
- return false;
+#if defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F)
+ /*
+ * We seem to have a pending device-to-host transfer. The host must have
+ * sent a new control request without waiting for us to finish processing
+ * the previous one. This appears to happen when we're connected to certain
+ * USB 3.0 host chip set. Do a zeor-length send to tell the host we're not
+ * ready for the new request - that'll make it resend - and then just
+ * pretend we were successful here so that the pending transfer can finish.
+ */
+ uint8_t buf[1] = { 0 };
+ EP0write(buf, 0);
+
+ /* execute our pending ttransfer */
+ controlIn();
+
+ /* indicate success */
+ return true;
+ #else
+ /* for other platforms, count on the HAL to handle this case */
+ return false;
+ #endif
}
/* Read from endpoint */
