Hello,
How I remember, first what you need is set USBMSD to non blocking mode in its constructor.
USBMSD usb(&sd, false);
And then somewhere (it is depend on application) periodically call the connect method until it is not true
.
while (true){
if(usb.connect()){
// your code for usb
}
thread_sleep_for(500);
}
Also you can do it in a separate thread instead of the main and so on.
BR, Jan