Skip to content

Commit 8ef9bb3

Browse files
committed
Make return value of USBDeviceClass::send the bytes sent
1 parent cfa831f commit 8ef9bb3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cores/arduino/USB/USBCore.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ uint8_t USBDeviceClass::armRecv(uint32_t ep)
605605
// Blocking Send of data to an endpoint
606606
uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
607607
{
608+
uint32_t written = 0;
608609
uint32_t length = 0;
609610

610611
if (!_usbConfiguration)
@@ -675,10 +676,11 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
675676
while (!usbd.epBank1IsTransferComplete(ep)) {
676677
; // need fire exit.
677678
}
679+
written += length;
678680
len -= length;
679681
data = (char *)data + length;
680682
}
681-
return len;
683+
return written;
682684
}
683685

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

0 commit comments

Comments
 (0)