From 8d0c1674628df1c2c7592f4fc17467c694f5a1be Mon Sep 17 00:00:00 2001 From: Sandeep Mistry <s.mistry@arduino.cc> Date: Fri, 27 May 2016 11:22:49 -0400 Subject: [PATCH] Change return value of Serial_::write to be the # of bytes written Previous 0 was always returned. --- cores/arduino/USB/CDC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 5a111dce..6bfc6e89 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -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(); -- GitLab