I would write a windows program to safe remove usb storage device.

Currently, I use CM_Request_Device_Eject function to do this.
It works well for single usb storage device.

However, it didn't work smoothly if two usb storage device attached to PC.
My program uset SetupDiEnumDeviceInfo to enumerate the usb device node
and call CM_Request_Device_Eject to safe remove the usb device.

For the first enumerated device node, it's safe removed smoothly.
For the second enumerated device node, it took much longer time though
the device is safe removed successfully.

Does anyone know what's the correct procedure to safe remove usb storage
device?

Best Regards

Jackal Huang