References:
Http://topic.csdn.net/u/20100609/15/845468df-d0a6-4938-bef3-75f086c9319d.html
Http://topic.csdn.net/u/20100803/16/584eacc7-7440-4cf4-af4b-ec037cf41f36.html
Http://topic.csdn.net/u/20100426/14/1f2260b7-de6e-4615-9367-79139798325f.html
/// The first touch and button input are ignored when the screen backlight is awakened in wince.
Http://hi.baidu.com/lvoids/item/f91ab9cb7752cd0c0ad93ad5
//// Backlight driver analysis //////
Http://cky0612.blog.163.com/blog/static/2747891620117602421813
//// Power Management 1 /////////
Http://blog.mcuol.com/User/iwillbeback008/Article/11150_1.htm
Whether inControl Panel-> displayHow long it takes to read the acuseridle in the final pm-> PDD
The Code is as follows:
Dwstatus = regopenkeyex (HKEY_LOCAL_MACHINE, Szpath, 0, 0, & HK );
If (dwstatus = error_success)
{
// Read system power state timeouts
Gdwactimeouttouseridle = regreadstatetimeout (HK, _ T ("acuseridle"), def_timeouttouseridle );
Gdwactimeouttosystemidle = regreadstatetimeout (HK, _ T ("acsystemidle"), def_timeouttosystemidle );
Gdwactimeouttosuspend = regreadstatetimeout (HK, _ T ("acsuspend"), def_timeouttosuspend );
Gdwbatttimeouttouseridle = regreadstatetimeout (HK, _ T ("battuseridle"), def_timeouttouseridle );
Gdwbatttimeouttosystemidle = regreadstatetimeout (HK, _ T ("battsystemidle"), def_timeouttosystemidle );
Gdwbatttimeouttosuspend = regreadstatetimeout (HK, _ T ("battsuspend"), def_timeouttosuspend );
// Release resources
Regclosekey (HK );
}
Excuse me, if you want to setControl Panel-> displayThe time-out time will turn off the backlight. Do I need to modify the PM code?
Solution: In the bkldrvmain. cpp monitoring thread function:
Word fnbacklightthread (pvoid pvargument)
We can find:
While (1)
{
Dwresult = waitformultipleobjects (bkl_num_events, & waitevents [0], false, infinite );
........
........
While (1) endless loops constantly detect various backlight-related states. When you see waitformultipleobjects (bkl_num_events, & waitevents [0], false, infinite) in an endless loop, the waitformultipleobjects multi-event wait function is called, but the infinite time "infinite" is used as the wait time, which obviously does not use the backlight time to control the page Registry's read back, so I made the following changes:
// Add By wxm
DWORD dwtimeoutget;
// Add By wxm
// Add By wxm
Dwtimeoutget = gettimeout (pbklinfo) * 1000;
Dwresult = waitformultipleobjects (bkl_num_events, & waitevents [0], false, dwtimeoutget );
// Add By wxm
Use the backlight time read back from the control layout registry, and add the following to the switch (dwresult:
Case wait_timeout:
{
Debugmsg (1, (text ("wait_timeout \ r \ n ")));
Backlightsetstate (D4 );
}
// Add By wxm
Break;
In this way, you can control the backlight when the backlight time is set.
Why can't I wake up after the backlight is disabled at the specified time?
Solution:
Wake-up backlight mechanism: (here I changed it under wince 6.0)
(1) backlight control should of course enable the backlight when the user has input, but this MDD has not mentioned it. We only need to add a process to detect it. Wince user input event ("powermanager/activitytimer/useractivity"), which is mentioned by several people upstairs;
First, we add the input event definition to the bkl_mdd_info struct definition of bkli. h.
// Add By wxm
Handle hinputevent; // input trigger event
// Add By wxm
Add the value assignment of the input event to bkldrvapi. cpp.
// Add By wxm
Const tchar szevtuserinput [] = text ("powermanager/activitytimer/useractivity ");
// Add By wxm
Create event:
// Add By wxm
Pbklinfo-> hinputevent = createevent (null, false, false, szevtuserinput );
If (null = pbklinfo-> hexitevent)
{
Retailmsg (zone_error, (text ("blk_init: hinputevent opendevicekey failed with % u \ r \ n"), dwstatus ));
Goto error;
}
// Add By wxm
Add the following to bkldrvmian. cpp:
Location in event detection:
// Add By wxm
# Define bkl_event_input 4
// Add By wxm
Waiting for event assignment:
// Add By wxm
Waitevents [bkl_event_input] = pbklinfo-> hinputevent;
// Add By wxm
Processing of input events:
// Add By wxm
Case (wait_object_0 + bkl_event_input ):
{
Debugmsg (zone_backlight, (text ("bkl_event_input \ r \ n ")));
Backlightsetstate (D0 );
}
Break;
With the above modification, only input events such as touch screen input can light up the backlight.
3. When you press a button to wake up the backlight, how many times or when you touch the screen can you wake up the backlight?
Current solution:
The priority of the thread waiting for powermanager/activitytimer/useractivity is set to a high point, which is basically captured every time. You can test it.