From 40d9554ed333c363fee2f384295b8bcf800a6a97 Mon Sep 17 00:00:00 2001
From: Cristian Maglie <c.maglie@arduino.cc>
Date: Fri, 24 Jun 2016 16:01:17 +0200
Subject: [PATCH] USB-CDC: Avoid need to send ZLP by sending up to (EPX_SIZE-1)
 bytes at a time

---
 cores/arduino/USB/USBCore.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp
index 23378443..1be72247 100644
--- a/cores/arduino/USB/USBCore.cpp
+++ b/cores/arduino/USB/USBCore.cpp
@@ -627,8 +627,8 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
 	// Flash area
 	while (len != 0)
 	{
-		if (len >= 64) {
-			length = 64;
+		if (len >= EPX_SIZE) {
+			length = EPX_SIZE - 1;
 		} else {
 			length = len;
 		}
-- 
GitLab