why this API (SetSystemPowerState) can not change the system power state??

why this API (SetSystemPowerState) can not change the system power state??

Post by Hzh » Fri, 18 Apr 2008 10:21:56


Does anyone can tell me why?

My system power state is in useridle mode, when I got an event in my driver
under CE 5.0, I want to change the system power state from useridle to on,
so I call this API, SetSystemPowerState(L"on",0,0); but it does not work,
the system power state still keep in useridle mode, and I could not get the
PBT_TRANSITION notification either. It seems that my system could not
broadcast the PBT_TRANSITION notification.

Anyone can give me some advice? Thank you all very much.

Ricky

--
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by eMV » Fri, 18 Apr 2008 16:36:10

Because the power manager decides what is best for the system, not some
random application. Note that *you* control the behavior of the power
manager!

Can you tell us *why* you want to move the system out of useridle into on?

In your case you should modify the PM pdd and implement a scheme that
makes sense for your system instead of trying to work against the PM
with your appplication. Take a look at
\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\PM\PDD\DEFAULT to gain a better
understanding of how the PM works. The code is very well documented and
quite easy to understand.

Good luck,

Michel Verhagen, eMVP
Check out my blog: http://www.yqcomputer.com/

GuruCE Ltd.
Microsoft Embedded Partner
http://www.yqcomputer.com/
Consultancy, training and development services.

 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by Hzh » Sat, 19 Apr 2008 10:36:13

Hi, Michel

Thank you very much for your response and advice.

My OS version is wince 5.0. And my system will get into useridle mode if we
don't operate my CE device after one or more minutes, the backlight of my CE
device will turn dark too. so if I plug in the usb cable and charge the
battery or communicate with the PC, I want to move the system out of
useridle into on and turn on the backlight.

so if I got the usb plug in evnet in my usb driver programe, I will call
this API and change the system power state from useridle into on, but it
does not work, the system power state still keep in useridle mode, and the
backlight still keep its old state too. most importantly, I can not get the
PBT_TRANSITION notification from the PM. That puzzles me greatly.

--


Michel Verhagen (eMVP)" < XXXX@XXXXX.COM >
??????:% XXXX@XXXXX.COM ...
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by eMV » Sun, 20 Apr 2008 13:37:39

Open the named event "PowerManager/ActivityTimer/UserActivity" and set
it whenever you want to transition to "on". It's all in the registry and
the code, and as I said, not difficult to find:

; This registry setting tells GWES to signal the Power Manager
; when user input devices are active. GWES will reset this activity timer
; whenever it dequeues any type of input event (keyboard, mouse, or
; touch) from its internal queue.
[HKEY_LOCAL_MACHINE\SYSTEM\GWE]
"ActivityEvent"="PowerManager/ActivityTimer/UserActivity"



Good luck,

Michel Verhagen, eMVP
Check out my blog: http://www.yqcomputer.com/

GuruCE Ltd.
Microsoft Embedded Partner
http://www.yqcomputer.com/
Consultancy, training and development services.
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by Hzh » Wed, 23 Apr 2008 20:10:33

Hi, Michel

Thank you.

According to what you said, it works. I can change the system power state
from useridle to on. Thank you very much.

But I still don't understand why this API, SetSystemPowerState, does not
work??? Could you tell me why?

Thank you again.

Best Regards

Ricky

--



"Michel Verhagen (eMVP)" < XXXX@XXXXX.COM >
??????: XXXX@XXXXX.COM ...
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by eMV » Thu, 24 Apr 2008 08:21:29

I could explain you but that would take a lot of time. As I said
earlier, take a look at the PM source code
(\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\PM) and read the code.

In short: The powermanager manages the entire system and knows about all
the different components (like drivers, applications, running threads,
user activity, system activity, etc). You, as an application (or
driver), can not know what is going on on the entire system so how can
you be the one making a decision for everyone else?

Learn the PM API and architecture. Documentation is very good on this.

Good luck,

Michel Verhagen, eMVP
Check out my blog: http://www.yqcomputer.com/

GuruCE Ltd.
Microsoft Embedded Partner
http://www.yqcomputer.com/
Consultancy, training and development services.
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by Hzh » Thu, 24 Apr 2008 10:07:59

Got it.

Thank you, Michel.


"Michel Verhagen (eMVP)" < XXXX@XXXXX.COM >
??????:ee0vY% XXXX@XXXXX.COM ...
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by Hzh » Fri, 25 Apr 2008 12:01:10

Hi, Michel
Could you help me again? I got another problem, and maybe this problem has
relationship with the PM too.

When my system get in suspend mode, I can not resume it. This function,
OEMPowerOff(), has been called, and I used a GPIO interrupt as a wake up
source to wake up my system, and the system can recognize this wake up
source, those functions, XXX_PowerUp, has been called too, but not all those
functions had been called. Could you tell me what and how we should do when
we want to wake up our system?

Could you give me some advice? Thank you.

Best Regards

Ricky

--


"Hzh" < XXXX@XXXXX.COM > : XXXX@XXXXX.COM ...
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by eMV » Fri, 25 Apr 2008 14:45:19

Suspend/Resume is board (hardware) specific. You'd have to debug exactly
where it stops and ask a targeted question (with all necessary info like
BSP used, hardware used, GPIO setup, interrupt (wake source) setup etc).


Good luck,

Michel Verhagen, eMVP
Check out my blog: http://www.yqcomputer.com/

GuruCE Ltd.
Microsoft Embedded Partner
http://www.yqcomputer.com/
Consultancy, training and development services.
 
 
 

why this API (SetSystemPowerState) can not change the system power state??

Post by Hzh » Tue, 29 Apr 2008 12:43:05

Hi, Michel

Could you tell me what is the IClass ID of the usb host driver?

I want to let the usb host driver keeping power on when the system get into
suspend mode. but I had not any better idea now.Maybe you can give me some
advice. Thanks.

--


Best Regards

Ricky


"Michel Verhagen (eMVP)" < XXXX@XXXXX.COM >
??????: XXXX@XXXXX.COM ...