Power Management USB Device

Hi,

I have a Cypress EZ USB FX based USB device. My problem is with Power Management
handling for this device on Window 2000.

Problem: USB device is removed after the system comes back from Standby (S1)
state

I have an application which does continuous I/O on this device. Now I bring
the system to a “Standby” state. After a few seconds, I press some key on
the keyboard leading to the system coming back to the Working state. (I am
using “DbgView” to view the debug messages.)

When I bring the system to the standy state, the debug messages are:

'UHCD.SYS: 'saving host controller state
'UHCD.SYS: 'Shutdown (Suspend) Host Controller
'UHCD.SYS: 'saving host controller state

When I bring the system back to the Working state, the sequence of messages
is

'UHCD.SYS: 'restoring host controller state
'UHCD.SYS: 'restoring HC from hibernate
'UHCD.SYS: 'detected (APM/HIBERNATE) loss of power during suspend
'UHCD.SYS: 'Warning: Host contoller did not respond to halt req

When the system comes up, I get IRP_MN_SURPRISE_REMOVAL and then IRP_MN_REMOVE_DEVICE
for my device. (I guess this is because UHCD.sys is going into “Suspend” state and
losing all context).

Does this mean that if continuous I/O is going on and my system goes into a
“standby” state (because of system settings), I will have to restart my
application as after “Standby”, the device is a totally new device.

My USB host controller is Intel 82801AA.

TIA …
Rahul Gupta

Are you using the Cypress EZ-USB example driver power management code in
your driver? I discovered the hard way that it is totally broken from the
word go.

Loren

Nops …
I am not using the example driver code. I have written my own …
The problem is even when my USB device is not attached to the System. It
still gives the same messages …
*********************************************************************
When I bring the system to the standy state, the debug messages are:

'UHCD.SYS: 'saving host controller state
'UHCD.SYS: 'Shutdown (Suspend) Host Controller
'UHCD.SYS: 'saving host controller state

When I bring the system back to the Working state, the sequence of
messages
is

'UHCD.SYS: 'restoring host controller state
'UHCD.SYS: 'restoring HC from hibernate
'UHCD.SYS: 'detected (APM/HIBERNATE) loss of power during suspend
'UHCD.SYS: 'Warning: Host contoller did not respond to halt req
**********************************************************************

Is this the expected behaviour under Windows 2000. ??

TIA …
Rahul Gupta

On Wed, 2004-02-04 at 17:44, Loren Wilton wrote:

Are you using the Cypress EZ-USB example driver power management code in
your driver? I discovered the hard way that it is totally broken from the
word go.

Loren


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
To unsubscribe send a blank email to xxxxx@lists.osr.com

> Does this mean that if continuous I/O is going on and my system goes into a

“standby” state (because of system settings), I will have to restart my
application as after “Standby”, the device is a totally new device.

I’m not the person to tell you if there is a way to avoid the device
removal. However, it is possible for your application to register for
device notification so that it can respond properly to a devices
coming and going (RegisterDeviceNotification).

Rob
xxxxx@telusplanet.net

Do you download firmware to the device upon start and the device gains a
new VID/PID? If so, does the device lose it’s firmware when it goes
into low power? if the answer is yes to both, that is why you are
seeing the removal of your device.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of rahul gupta
Sent: Wednesday, February 04, 2004 3:06 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Power Management USB Device

Hi,

I have a Cypress EZ USB FX based USB device. My problem is with Power
Management
handling for this device on Window 2000.

Problem: USB device is removed after the system comes back from Standby
(S1)
state

I have an application which does continuous I/O on this device. Now I
bring
the system to a “Standby” state. After a few seconds, I press some key
on
the keyboard leading to the system coming back to the Working state. (I
am
using “DbgView” to view the debug messages.)

When I bring the system to the standy state, the debug messages are:

'UHCD.SYS: 'saving host controller state
'UHCD.SYS: 'Shutdown (Suspend) Host Controller
'UHCD.SYS: 'saving host controller state

When I bring the system back to the Working state, the sequence of
messages
is

'UHCD.SYS: 'restoring host controller state
'UHCD.SYS: 'restoring HC from hibernate
'UHCD.SYS: 'detected (APM/HIBERNATE) loss of power during suspend
'UHCD.SYS: 'Warning: Host contoller did not respond to halt req

When the system comes up, I get IRP_MN_SURPRISE_REMOVAL and then
IRP_MN_REMOVE_DEVICE
for my device. (I guess this is because UHCD.sys is going into “Suspend”
state and
losing all context).

Does this mean that if continuous I/O is going on and my system goes
into a
“standby” state (because of system settings), I will have to restart my
application as after “Standby”, the device is a totally new device.

My USB host controller is Intel 82801AA.

TIA …
Rahul Gupta


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes I do download the firmware on the device and with a new VID/PID. But
my device is externally powered so it does not loose firmware in Low
power state.
I am getting IRP_MN_SURPRISE_REMOVAL & IRP_MN_REMOVE_DEVICE in my driver
immidiately after I resume from Standby (S1), while my firmware is still
intact.
Moreover, If you see the system messages below, It seems windows 2000,
while going in standby mode suspends or removes the USB host controller
itself. (Which probably means all devices connected to that controller
are gone).
Now Is this the expected behaviour for windows 2K ?? (Because this
prevents my application doing continous I/O on USB device to stop when
resuming from Low System power state.)
And Is there a way I can circumvent this behaviour in win2K ??

TIA
Rahul Gupta

On Wed, 2004-02-04 at 22:12, Doron Holan wrote:

Do you download firmware to the device upon start and the device gains a
new VID/PID? If so, does the device lose it’s firmware when it goes
into low power? if the answer is yes to both, that is why you are
seeing the removal of your device.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of rahul gupta
Sent: Wednesday, February 04, 2004 3:06 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Power Management USB Device

Hi,

I have a Cypress EZ USB FX based USB device. My problem is with Power
Management
handling for this device on Window 2000.

Problem: USB device is removed after the system comes back from Standby
(S1)
state

I have an application which does continuous I/O on this device. Now I
bring
the system to a “Standby” state. After a few seconds, I press some key
on
the keyboard leading to the system coming back to the Working state. (I
am
using “DbgView” to view the debug messages.)

When I bring the system to the standy state, the debug messages are:

'UHCD.SYS: 'saving host controller state
'UHCD.SYS: 'Shutdown (Suspend) Host Controller
'UHCD.SYS: 'saving host controller state

When I bring the system back to the Working state, the sequence of
messages
is

'UHCD.SYS: 'restoring host controller state
'UHCD.SYS: 'restoring HC from hibernate
'UHCD.SYS: 'detected (APM/HIBERNATE) loss of power during suspend
'UHCD.SYS: 'Warning: Host contoller did not respond to halt req

When the system comes up, I get IRP_MN_SURPRISE_REMOVAL and then
IRP_MN_REMOVE_DEVICE
for my device. (I guess this is because UHCD.sys is going into “Suspend”
state and
losing all context).

Does this mean that if continuous I/O is going on and my system goes
into a
“standby” state (because of system settings), I will have to restart my
application as after “Standby”, the device is a totally new device.

My USB host controller is Intel 82801AA.

TIA …
Rahul Gupta


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
To unsubscribe send a blank email to xxxxx@lists.osr.com

This is not the defacto behavior (look at a USB mouse in device
manager). The USB controller is not removed when you go into S1 or any
low power state. I would put a CATC on the bus, but if you are getting
a surprise remove, then your device is not addressable when coming out
of a lower state and USB assumes it is gone.

D

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of rahul gupta
Sent: Wednesday, February 04, 2004 8:49 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Power Management USB Device

Yes I do download the firmware on the device and with a new VID/PID. But
my device is externally powered so it does not loose firmware in Low
power state.
I am getting IRP_MN_SURPRISE_REMOVAL & IRP_MN_REMOVE_DEVICE in my driver
immidiately after I resume from Standby (S1), while my firmware is still
intact.
Moreover, If you see the system messages below, It seems windows 2000,
while going in standby mode suspends or removes the USB host controller
itself. (Which probably means all devices connected to that controller
are gone).
Now Is this the expected behaviour for windows 2K ?? (Because this
prevents my application doing continous I/O on USB device to stop when
resuming from Low System power state.)
And Is there a way I can circumvent this behaviour in win2K ??

TIA
Rahul Gupta

On Wed, 2004-02-04 at 22:12, Doron Holan wrote:

Do you download firmware to the device upon start and the device gains
a
new VID/PID? If so, does the device lose it’s firmware when it goes
into low power? if the answer is yes to both, that is why you are
seeing the removal of your device.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of rahul gupta
Sent: Wednesday, February 04, 2004 3:06 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Power Management USB Device

Hi,

I have a Cypress EZ USB FX based USB device. My problem is with Power
Management
handling for this device on Window 2000.

Problem: USB device is removed after the system comes back from
Standby
(S1)
state

I have an application which does continuous I/O on this device. Now I
bring
the system to a “Standby” state. After a few seconds, I press some key
on
the keyboard leading to the system coming back to the Working state.
(I
am
using “DbgView” to view the debug messages.)

When I bring the system to the standy state, the debug messages are:

'UHCD.SYS: 'saving host controller state
'UHCD.SYS: 'Shutdown (Suspend) Host Controller
'UHCD.SYS: 'saving host controller state

When I bring the system back to the Working state, the sequence of
messages
is

'UHCD.SYS: 'restoring host controller state
'UHCD.SYS: 'restoring HC from hibernate
'UHCD.SYS: 'detected (APM/HIBERNATE) loss of power during suspend
'UHCD.SYS: 'Warning: Host contoller did not respond to halt req

When the system comes up, I get IRP_MN_SURPRISE_REMOVAL and then
IRP_MN_REMOVE_DEVICE
for my device. (I guess this is because UHCD.sys is going into
“Suspend”
state and
losing all context).

Does this mean that if continuous I/O is going on and my system goes
into a
“standby” state (because of system settings), I will have to restart
my
application as after “Standby”, the device is a totally new device.

My USB host controller is Intel 82801AA.

TIA …
Rahul Gupta


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

If the system is going into sby/hiber I would expect NT to power down as
much of the system as it could, at least if it is being a good boy. This
reduces the battery drain. I would expect it to power down the USB
subsystem *unless* the USB system happened to be capable of waking the
system from standby. If it isn’t then there is no point from NT’s view to
keep it even partially powered.

Admittedly this is a pain for devices that think they have some external
point in existance and should stay operational. The obvious solution is to
see that the system doesn’t power down if the app needs to continue to talk
to the devices. If you can allow the system to hibernate, but come up with
the connection intact, then you might be able to pull a nasty trick and
claim that your device is capable of waking the system from standby.

Now, if you are getting surprise removal on power up, and other USB devices
aren’t, then I can only think of two general possibilities that might be
causing this. One would be something in the driver that is somehow
convincing the stack that the device has been unplugged temporarily. The
second would be something in the device descriptors that falls into some
sort of hole or catch-22 in the logic that is making the machine think it
can’t tell that it is the same device. Maybe you don’t have a unique serial
number in the device info, so NT can’t tell if it is still the same device
after powering back up.

Loren

----- Original Message -----
From: “rahul gupta”
To: “Windows System Software Devs Interest List”
Sent: Wednesday, February 04, 2004 8:49 PM
Subject: RE: [ntdev] Power Management USB Device

> Yes I do download the firmware on the device and with a new VID/PID. But
> my device is externally powered so it does not loose firmware in Low
> power state.
> I am getting IRP_MN_SURPRISE_REMOVAL & IRP_MN_REMOVE_DEVICE in my driver
> immidiately after I resume from Standby (S1), while my firmware is still
> intact.
> Moreover, If you see the system messages below, It seems windows 2000,
> while going in standby mode suspends or removes the USB host controller
> itself. (Which probably means all devices connected to that controller
> are gone).
> Now Is this the expected behaviour for windows 2K ?? (Because this
> prevents my application doing continous I/O on USB device to stop when
> resuming from Low System power state.)
> And Is there a way I can circumvent this behaviour in win2K ??
>
> TIA
> Rahul Gupta
>
>
>
>
>
> On Wed, 2004-02-04 at 22:12, Doron Holan wrote:
> > Do you download firmware to the device upon start and the device gains a
> > new VID/PID? If so, does the device lose it’s firmware when it goes
> > into low power? if the answer is yes to both, that is why you are
> > seeing the removal of your device.
> >
> > D
> >
> > This posting is provided “AS IS” with no warranties, and confers no
> > rights
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of rahul gupta
> > Sent: Wednesday, February 04, 2004 3:06 AM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Power Management USB Device
> >
> > Hi,
> >
> > I have a Cypress EZ USB FX based USB device. My problem is with Power
> > Management
> > handling for this device on Window 2000.
> >
> > Problem: USB device is removed after the system comes back from Standby
> > (S1)
> > state
> >
> > I have an application which does continuous I/O on this device. Now I
> > bring
> > the system to a “Standby” state. After a few seconds, I press some key
> > on
> > the keyboard leading to the system coming back to the Working state. (I
> > am
> > using “DbgView” to view the debug messages.)
> >
> > When I bring the system to the standy state, the debug messages are:
> >
> > 'UHCD.SYS: 'saving host controller state
> > 'UHCD.SYS: 'Shutdown (Suspend) Host Controller
> > 'UHCD.SYS: 'saving host controller state
> >
> > When I bring the system back to the Working state, the sequence of
> > messages
> > is
> >
> > 'UHCD.SYS: 'restoring host controller state
> > 'UHCD.SYS: 'restoring HC from hibernate
> > 'UHCD.SYS: 'detected (APM/HIBERNATE) loss of power during suspend
> > 'UHCD.SYS: 'Warning: Host contoller did not respond to halt req
> >
> > When the system comes up, I get IRP_MN_SURPRISE_REMOVAL and then
> > IRP_MN_REMOVE_DEVICE
> > for my device. (I guess this is because UHCD.sys is going into “Suspend”
> > state and
> > losing all context).
> >
> > Does this mean that if continuous I/O is going on and my system goes
> > into a
> > “standby” state (because of system settings), I will have to restart my
> > application as after “Standby”, the device is a totally new device.
> >
> > My USB host controller is Intel 82801AA.
> >
> > TIA …
> > Rahul Gupta
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@dcmtech.co.in
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>