diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-01-04 00:33:31 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-01-04 00:33:31 +0000 |
commit | 1e1cf2c499d7ac0cfae536e1264af4645350813b (patch) | |
tree | 4b57c4d188af6d07e364c4e10ae3d4a219c0c863 /LUFA/Drivers/USB/Class/Host/CDC.c | |
parent | 71e5bcee3d1121be680990cabe8ae5dff2a78807 (diff) | |
download | lufa-1e1cf2c499d7ac0cfae536e1264af4645350813b.tar.gz lufa-1e1cf2c499d7ac0cfae536e1264af4645350813b.tar.bz2 lufa-1e1cf2c499d7ac0cfae536e1264af4645350813b.zip |
Fix CDC blocking streams in Host mode locking up when the device is removed.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/CDC.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index 030ad9464..7f5bcb940 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -445,6 +445,9 @@ static int CDC_Host_getchar_Blocking(FILE* Stream) {
while (!(CDC_Host_BytesReceived((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream))))
{
+ if (USB_HostState == HOST_STATE_Unattached)
+ return _FDEV_EOF;
+
CDC_Host_USBTask((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream));
USB_USBTask();
}
|