Host suspend and resume with WINUSB App

My application runs on Windows XP, uses winUSB calls to communicate with my device. When the host PC goes to stand by, the host issues the suspend message to the device, but when the system resumes (by switching on the PC), it looks like my device is set to reset, it comes with the address 0, and i see the set address message to the device(through USB trace). First of all, I do not want the device to be reset,when it comes out of the suspend state. Is there any way to provent the reset?.
I am wondering even if the device is set to reset, how my application would know?. Is there any way that kernel can inform my application about the reset. If my application runs as a service, can it get the USB device reset events?. Thanks for your inputs.

Any help/inputs?

In general the Windows USB host controller and hub drivers will
attempt to suspend / resume the host controllers across a system
suspend / resume event, but in some cases on some platforms the host
controllers will no longer be in the state that they can be resumed
after a system resume. In that case the host controller will need to
be reset and all devices on the bus will need to be re-enumerated,
although the device re-enumeration will be hidden from PnP if
possible. There is no way to guarantee that the host controllers and
devices will not be reset across all versions of Windows on all
platforms.

No. If the USB host controller and hub drivers reset the host
controllers and devices across a system suspend / resume event and
hide that re-enumeration from PnP the last known configuration and
alternate interface settings of the devices should be restored, but
there is no explicit notification to the drivers of those devices that
they have been reset and re-enumerated. If there is volatile
configuration information that is lost when the device is reset it
might be best to always restore that from the client driver after a
system suspend / resume event.

If the driver needs to determine whether or not the device is in the
same state after a system suspend / resume event I’m not sure how you
could do that without some mechanism where the driver can query
volatile state information from the device which is reset whenever the
device is reset or loses power.

-Glen

Thanks for the detailed explanation.
I agree that it is safe for my application to assume that after the resume, the device is in the reset state, and re-initialze all the configuration values.
Since my application is a service (runs on XP), Can i get the System wide Suspend and Resume events?. ( Actually i tried to get the WM_POWERBROADCAST events in my service, i do not see those message when the system goes to stand by).

The proper way to get these notifications in a service is to use RegisterServiceCtrlHandlerEx and handle SERVICE_CONTROL_POWEREVENT.

  • S

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, May 18, 2010 5:08 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Host suspend and resume with WINUSB App

Thanks for the detailed explanation.
I agree that it is safe for my application to assume that after the resume, the device is in the reset state, and re-initialze all the configuration values.
Since my application is a service (runs on XP), Can i get the System wide Suspend and Resume events?. ( Actually i tried to get the WM_POWERBROADCAST events in my service, i do not see those message when the system goes to stand by).


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer