Use standard blocking functions: _taskq_suspend and _taskq_resume.
Use USB_ATTACH and USB_DETACH events.
Do not suspend task, which executes USB_ATTACH and USB_DETACH event handlers.
It is problem to use fprintf instead of printf?
In the case you want to use printf, you have to assign stdin, stdout and stderr streams to USB virtual UART. This code handles the operation:
KERNEL_DATA_STRUCT_PTR kernel_data; _GET_KERNEL_DATA(kernel_data); kernel_data->PROCESSOR_STDIN = usb_cdc_file; kernel_data->PROCESSOR_STDOUT = usb_cdc_file; kernel_data->PROCESSOR_STDERR = usb_cdc_file;
jv
CDC device example and CDC device class does not provide any interface to the file now. So you cannot do it this way unless you code your own wrapper- open / read / write functions over a file for the new wrapper-driver.