Skip to content

Commit 770601d

Browse files
committed
Merge branch 'samba_improvements' into zero
2 parents 1b90826 + a107037 commit 770601d

File tree

6 files changed

+315
-161
lines changed

6 files changed

+315
-161
lines changed

bootloaders/zero/drivers/cdc_enumerate.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,5 +750,16 @@ uint32_t cdc_read_buf_xmd(void* data, uint32_t length)
750750
return 0;
751751

752752
/* Blocking read till specified number of bytes is received */
753-
return USB_Read_blocking(&pCdc, (char *)data, length);
753+
// XXX: USB_Read_blocking is not reliable
754+
// return USB_Read_blocking(&pCdc, (char *)data, length);
755+
756+
char *dst = (char *)data;
757+
uint32_t remaining = length;
758+
while (remaining) {
759+
uint32_t readed = USB_Read(&pCdc, (char *)dst, remaining);
760+
remaining -= readed;
761+
dst += readed;
762+
}
763+
764+
return length;
754765
}

0 commit comments

Comments
 (0)