Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cores/arduino/USB/CDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ size_t Serial_::write(const uint8_t *buffer, size_t size)
{
uint32_t r = usb.send(CDC_ENDPOINT_IN, buffer, size);

if (r == 0) {
if (r > 0) {
return r;
} else {
setWriteError();
Expand Down
4 changes: 3 additions & 1 deletion cores/arduino/USB/USBCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ uint8_t USBDeviceClass::armRecv(uint32_t ep)
// Blocking Send of data to an endpoint
uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
{
uint32_t written = 0;
uint32_t length = 0;

if (!_usbConfiguration)
Expand Down Expand Up @@ -675,10 +676,11 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
while (!usbd.epBank1IsTransferComplete(ep)) {
; // need fire exit.
}
written += length;
len -= length;
data = (char *)data + length;
}
return len;
return written;
}

uint32_t USBDeviceClass::armSend(uint32_t ep, const void* data, uint32_t len)
Expand Down