Home   |   Jungo Corporate Web Site   |   Connectivity Software Store   |   Contact us   |   Search:
Home Connectivity Software Support WinDriver Support Technical Documents

Technical Document #53



Doc ID: 53
Product: WinDriver
Version: 5.04 - 5.22

How do I reset my USB device using WinDriver (versions 5.04 - 5.22)?

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

WD_UsbResetDeviceEx() - added in version 5.04 - 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 with WD_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 the dwOptions field of the WD_USB_RESET_DEVICE structure, which is passed to WD_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:

    WD_USB_RESET_DEVICE reset;
    BZERO(resest);
    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 calling WD_UsbResetDeviceEx(), un-register the device (by calling WD_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.

Back to Top

WinDriver, version 5.04 - 5.22, USB, API, reset device, WD_UsbResetDevice,WD_UsbResetDeviceEx, USB_RESET_DEVICE