I am using the MQX USB device stack. I am wondering if there is a way to force the usb connection to detach and shut down until the user unplugs and re-plugs the USB cable to the device.
If you want to reset the USB interface (resulting in a detach event), you could use the following functions (considering the CDC example):
Hope this will be useful for you.
Unfortunately, the HID class does not have the same function. I added one, but it does not do what I needed. Instead, I have put the USB peripheral into standby and controlled the pull-ups manually. Removing the D+ pullup, using the OTGCTL register, causes the device to detach through a software means. It can be recovered by just putting the pull-up control back and re-enabling the peripheral (plus plugging in the cable).
Retrieving data ...