Non-Blocking USB CDC Read and Write and non Blocking plug and unplug USB


I have considered the attached example I found in the following forum,

The example works well.
However, if you disconnect and reconnect the USB cable, the callbacks stop working and cannot be reset

 tried to redo the initialization but the function ux_device_class_cdc_acm_ioctl with UX_SLAVE_CLASS_CDC_ACM_IOCTL_TRANSMISSION_START return 0x18, i tried to initialize the usb but the result doesn't change

how can I reset everything correctly?

/* Specify the read and write callback functions that can be used with the ux_device_class_cdc_acm_ioctl function */
call_back.ux_device_class_cdc_acm_parameter_read_callback = cdc_acm_read_callback;
call_back.ux_device_class_cdc_acm_parameter_write_callback = cdc_acm_write_callback;
status = ux_device_class_cdc_acm_ioctl(gp_cdc, UX_SLAVE_CLASS_CDC_ACM_IOCTL_TRANSMISSION_START, &call_back);

the return value the second time is 0x18