Blocked in an infinite loop in lpcusblib_MassStorageHost example

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by silvenebu on Thu Jun 18 00:46:31 MST 2015
Hey guys,
I work for a project with an LPC1768 and LPCOpen V2.10.
I use the MassStorageHost example and Freertos V8.2.1 to build an USB Mass storage HOST.
All works fine in a normal use. But I have made test for different "not normal" device removal because I must ensure that the aplication not crash when someone remove the USB Key before the end of the USB Task.
And i have noticed that if the key is unattached when the task has finished to enumerate the key and executes "MS_Host_RequestSense", in the EVENT_USB_Host_DeviceEnumerationComplete, the task is blocked in an infinite loop : "while(!Pipe_IsStatusOK(portnum))" (Line 331 MassStorageClassHost.c).
I think it's because the USB_Host_DeEnumerate ISR close all the pipe when the device is unattached.

Do you know if there is a proper way for prevent this trouble when device is removed before the end of the task without change the files of LPCUSB Lib. ?
If not it would be a good idea to change this in the next release.

Thank you for your help
Best Regards