Hi,
if you go to disc.c, you can add the printf if your device is e.g. Attached.
go to void USB_App_Device_Callback(uint8_t event_type, void* val,void* arg)
and add following line
if(event_type == USB_DEV_EVENT_BUS_RESET)
{
g_disk.start_app=FALSE;
}
else if(event_type == USB_DEV_EVENT_ENUM_COMPLETE)
{
g_disk.start_app=TRUE;
USB_PRINTF("\n\rAttached\r\n");
}
and for rejected device (which you must eject by right click on the Removable Disc in Computer)
and add the following line:
switch(event_type)
{
...
case USB_MSC_START_STOP_EJECT_MEDIA :
/* Code to be added by user for starting, stopping or
ejecting the disk drive. e.g. starting/stopping the motor in
case of CD/DVD*/
USB_PRINTF("\n\rRejected\r\n");
break;
}
now you have an information, when the device was attached and rejected so if you create global variable e.g. unit8_t usb_attached = 0;
and above mentioned fuctions you can change this global variable. In your your logger task you can compare this variable and enable/disable logging.
I hope it helps,
Iva