Fixed blocking CDC streams not aborting when the host is disconnected.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / CDC.c
index c274853..16bc015 100644 (file)
@@ -263,6 +263,9 @@ static int CDC_Device_getchar_Blocking(FILE* Stream)
 {\r
        while (!(CDC_Device_BytesReceived((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream))))\r
        {\r
+               if (USB_DeviceState == DEVICE_STATE_Unattached)\r
+                 return _FDEV_EOF;\r
+       \r
                CDC_Device_USBTask((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream));\r
                USB_USBTask();\r
        }\r