Fix possible infinite loop in the control stream write template functions.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 8 Jun 2014 05:33:29 +0000 (15:33 +1000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 8 Jun 2014 05:33:29 +0000 (15:33 +1000)
LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c
LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c
LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c

index 4fc242f..9888700 100644 (file)
@@ -79,6 +79,8 @@ uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer,
                  return ENDPOINT_RWCSTREAM_DeviceDisconnected;
                else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
                  return ENDPOINT_RWCSTREAM_BusSuspended;
+               else if (Endpoint_IsSETUPReceived())
+                 return ENDPOINT_RWCSTREAM_HostAborted;
        }
 
        return ENDPOINT_RWCSTREAM_NoError;
index 4fc242f..9888700 100644 (file)
@@ -79,6 +79,8 @@ uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer,
                  return ENDPOINT_RWCSTREAM_DeviceDisconnected;
                else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
                  return ENDPOINT_RWCSTREAM_BusSuspended;
+               else if (Endpoint_IsSETUPReceived())
+                 return ENDPOINT_RWCSTREAM_HostAborted;
        }
 
        return ENDPOINT_RWCSTREAM_NoError;
index 5bd4092..703f253 100644 (file)
@@ -81,6 +81,8 @@ uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer,
                  return ENDPOINT_RWCSTREAM_DeviceDisconnected;
                else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
                  return ENDPOINT_RWCSTREAM_BusSuspended;
+               else if (Endpoint_IsSETUPReceived())
+                 return ENDPOINT_RWCSTREAM_HostAborted;
        }
 
        return ENDPOINT_RWCSTREAM_NoError;