You are currently viewing the documentation for:
The USB_Device_Detach detaches the USB device, i.e. it de-activates the USB Device Port which allows the host to communicate with it.
ECUSB_ErrorCode ECUSB_Device_Detach(
   struct ECUSB_Device *pDevice
A pointer to a struct ECUSB_Device previously initialized by ECUSB_Device_Init.
Return value
Returns one of the ECUSB error codes (ECUSB_SUCCESS on success)
If you have a self-powered device and a configurable pull-up, you can call ECUSB_Device_Detach when you want the host to disconnect from your device. If you do not have a configurable pull-up it doesn't make sense to detach since the host most likely will report your device as broken.
Example Code

   err = ECUSB_Device_Detach(&myUsbDevice.m_device);
   if(err != ECUSB_SUCCESS)
      halt("ECUSB_Device_Detach failed", err);