File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
libraries/USBDevice/USBDevice Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,27 @@ bool USBDevice::controlOut(void)
187
187
/* Check we should be transferring data OUT */
188
188
if (transfer.direction != HOST_TO_DEVICE)
189
189
{
190
- return false ;
190
+ #if defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F)
191
+ /*
192
+ * We seem to have a pending device-to-host transfer. The host must have
193
+ * sent a new control request without waiting for us to finish processing
194
+ * the previous one. This appears to happen when we're connected to certain
195
+ * USB 3.0 host chip set. Do a zeor-length send to tell the host we're not
196
+ * ready for the new request - that'll make it resend - and then just
197
+ * pretend we were successful here so that the pending transfer can finish.
198
+ */
199
+ uint8_t buf[1 ] = { 0 };
200
+ EP0write (buf, 0 );
201
+
202
+ /* execute our pending ttransfer */
203
+ controlIn ();
204
+
205
+ /* indicate success */
206
+ return true ;
207
+ #else
208
+ /* for other platforms, count on the HAL to handle this case */
209
+ return false ;
210
+ #endif
191
211
}
192
212
193
213
/* Read from endpoint */
You can’t perform that action at this time.
0 commit comments