WinDriver provides you with an API for resetting your USB device:WD_UsbResetDevice() and WD_UsbResetDeviceEx() (added in version 5.0.4 of WinDriver). These functions cause the hub driver to reinitialize the device, while preserving the existing configuration.

WD_UsbResetDeviceEx() — added in version 5.0.4 — enables you to distinguish between performing a soft reset — which is similar to the reset performed with the WD_UsbResetDevice() function, used in previous versions; Or a hard reset.

The differences between a soft reset and a hard reset, performed withWD_UsbResetDeviceEx(), are as follows:

    • Soft reset: The reset request will be issued only if the device is in a disabled state (as done by Microsoft’s driver).


  • Hard reset: The reset request will always be issued — regardless if the device is in the disabled or enabled state.

To use the hard reset option, set the WD_USB_HARD_RESET flag in thedwOptions field of the WD_USB_RESET_DEVICE structure, which is passed toWD_UsbResetDeviceEx(). By default, when the dwOptions field is set to 0, the function will perform a soft reset — i.e., the reset request will be issued only if the device is currently disabled.

Following is an an example of using WD_UsbResetEx() to perform a hard reset:

    reset.hDevice = hDevice; // The handle received from
         // WD_UsbDeviceRegister()
    reset.dwOptions = WD_USB_HARD_RESET;
    WD_UsbResetDeviceEx(hWD, &reset);

NOTE: To prevent a system crash when performing hard reset, it is recommended to do the following: immediately after callingWD_UsbResetDeviceEx(), un-register the device (by callingWD_UsbDeviceUnregister()), scan for it (by calling WD_UsbScanDevice()) and then register it again (by calling WD_UsbDeviceRegister()). This will ensure that Windows will allocate all the resources for the device and will eliminate possible conflicts later on.