MC70 - Power Management related questions

Hi all,
I have received power management related questions from our customer and would like to check them with you as I am not sure what is the correct answer.

Answers with my comments are below.

1. Can the display be powered off? I have tried this with DevicePowerNotify(_T("DDI1:"), D1, 1), but it did not work.

PS: I have found only how to turn off backlight but not the display itself. It seems it is possible as SymScript can disable display only.


2. For knowing, when te device can be powered off, we must know, when the last User-Input was done. How can we get this value as the (GetIdleTime()  shows only the cumulative Idle-Time, but ther is no clue, when the input happened.
 
PS: I am not sure what exactly customer would like to achieve so I have asked for more details.


3. Further request is to intercept the PowerButton. When our application is running and power button pressed, the device should not get powered off, only Keyboard, TouchScreen, Display and Backlight should be turned off. How can be prevented pressing the Power button that the device powers off? We tried this with RequestPowerNotifications. With this we are getting messages, that the Power-Status has changed, but the device powers off in the middle of processing an event.  

PS: Is something like this possible? If yes, do we have any recommendation/code snippet how to achieve this?

Thanks a lot for your help,
Petr
George Dellaratta
1 - Have you tried the API

1 - Have you tried the API "SetDevicePowerState"?

2 - There is no way to find out the last user action.  The method that they describe is probably the best.  Look at the current time and then subtract the current idle timer value.  Remember, the idle timer is reset on each user action.  But, you are correct, we need a bit more information about the purpose of this question.

3 - The power button is connected to the power micro and not the main CPU.  So, an application can not intercept power button processing.  Remember, when a terminal suspends all activity is stopped.  At resume the system picks up right where it left off.
Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Herbert De Jong
this looks they want to make

this looks they want to make a unattended mode application.

from other thread this should work:

Turn screen off to save power:

 

If you want to turn off the screen completely you can use the following key:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\State\BacklightOff\{EB91C7C9-8BF6-4a2d-9AB8-69724EED97D1}]
"Default"=dword:00000004

This will make the display power follow the backlight power so whatever timeout you set for the backlight will cause the display to power off


also attached document which was put togehter for recommendations around this base on recommendations from ECRT

Can this be reviewed if that is still valid



Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


George Dellaratta
Yes, this document is still

Yes, this document is still valid on the products listed.

Unattended mode is NOT supported for a customer's application.
Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Petr Selinger
Thanks a lot George and

Thanks a lot George and Herbie for your replies.

The only thing that does not seem to work for me is how to turn off the display. I tried with SetDevicePower and SetPowerRequirement APIs, but it does not work. I think the "DDI1" is not the correct name for Display component. I tried to list all active devices from Drivers\Active key, but DDI1 is not there. The list of available devices is following:

        [0]   "ACM1:"   string
        [1]   "AEG0:"   string
        [2]   "BAT1:"   string
        [3]   "BKL1:"   string
        [4]   "BTS6:"   string
        [5]   "COM0:"   string
        [6]   "COM1:"   string
        [7]   "COM3:"   string
        [8]   "COM4:"   string
        [9]   "COM5:"   string
        [10]   "COM7:"   string
        [11]   "COM8:"   string
        [12]   "COM9:"   string
        [13]   "CPU1:"   string
        [14]   "DP60:"   string
        [15]   "DSK1:"   string
        [16]   "ETM1:"   string
        [17]   "GPD0:"   string
        [18]   "HCD1:"   string
        [19]   "IKE0:"   string
        [20]   "IMG1:"   string
        [21]   "IP60:"   string
        [22]   "IPD0:"   string
        [23]   "KBD1:"   string
        [24]   "KLT1:"   string
        [25]   "MOD1:"   string
        [26]   "MOD2:"   string
        [27]   "MOD3:"   string
        [28]   "MPX1:"   string
        [29]   "NAT0:"   string
        [30]   "NDS0:"   string
        [31]   "NDS1:"   string
        [32]   "NLD1:"   string
        [33]   "OTG1:"   string
        [34]   "RCM1:"   string
        [35]   "RDR0:"   string
        [36]   "RIL1:"   string
        [37]   "SCA1:"   string
        [38]   "SCN1:"   string
        [39]   "SDC1:"   string
        [40]   "SER2:"   string
        [41]   "SIM1:"   string
        [42]   "SIP0:"   string
        [43]   "SML1:"   string
        [44]   "SMS1:"   string
        [45]   "SPI1:"   string
        [46]   "SSP0:"   string
        [47]   "SYS1:"   string
        [48]   "TCH1:"   string
        [49]   "TCM1:"   string
        [50]   "TCP0:"   string
        [51]   "UFN1:"   string
        [52]   "UIO1:"   string
        [53]   "V6H1:"   string
        [54]   "VCA1:"   string
        [55]   "VCA2:"   string
        [56]   "VCA3:"   string
        [57]   "VCA4:"   string
        [58]   "VDA1:"   string
        [59]   "VDA2:"   string
        [60]   "WAM1:"   string
        [61]   "WAP1:"   string
        [62]   "WAV1:"   string
        [63]   "WCS1:"   string
        [64]   "WLP1:"   string
        [65]   "WWN0:"   string
        [66]   "ZCF1:"   string

Do you know which one refers to Display?

Thanks,
Petr
Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


George Dellaratta
I'm a bit concerned about the

I'm a bit concerned about the direction that this customer is taking.  By manipulating the system as they intend, there could be some serious power management problems.  Poor battery life, failure to wake up as expected, etc.

What is the real intent here?  If the customer does not want the terminal to suspend when it is performing an operation, then I recommend that the application reset the idle timer.  This will keep the terminal fully awake until processing is complete.  Then when the application finishes processing, it can then allow the idle timer to function normally and then the terminal will suspend.
Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jarod Fox
Petr, The following devices

Petr,

The following devices may assist in powering the display:

BKL1:  Screen Backlight
TCH1:  Touchpanel

Also remember that the lowest power state (off) is D4 and the highest (full on) is D0

 // Turn off the backlight

SetDevicePower( _T("BKL1:"), POWER_NAME, D4 ); 

//    Turn on the backlight
SetDevicePower( _T("BKL1:"), POWER_NAME, D0 ); 

On a WM device the preferred method would be to use the system power state:

//    Turn off screen
SetSystemPowerState( _T("ScreenOff), 0, POWER_FORCE );

//    Return system to normal state



Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Petr Selinger
Thanks everyone, the

Thanks everyone, the SetSystemPowerState( _T("ScreenOff), 0, POWER_FORCE ) API did the trick with turning off the display.
Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Petr Selinger
Customer sent us more info

Customer sent us more info about the question how to find the last user input:

We need to know when the last user input (display, keyboard, other buttons) was, because we need to switch the device into “unattended mode” after some time (and before the idle timeout has reached).

Therefore we need to know when the last user input was (idle time since last user input).

If we can catch a system event for all user input this is also sufficient, but we need to get all user input actions, not only the ones related to our application (hWnd).

Now there is a question if such system event for all user inputs exists? What is the best approach? Listen to Windows Messages and filter relevant messages?

Thanks!
Petr

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


George Dellaratta
We're not aware of a global

We're not aware of a global system event for any user input.

It is highly unusual that an application requires UNATTENDED MODE.  What process do they need to complete before allowing the terminal to suspend.  Remember, SUSPEND / RESUME is transparent to an application (unless it requires network communication)

Has the customer considered capturing the suspend event and request UNATTENDED MODE at that time rather than implementing their own timer?
Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jarod Fox
Petr, User activity will

Petr,

User activity will reset a named event which can be obtained from the device registry.  The application can then track the time between resets of the event.  The following pseudo code demonstrates:

HKEY        hKey                = NULL;
TCHAR    szEventName[_MAX_PATH];

DWORD    dwType        = 0;
DWORD    dwSize        = sizeof(szEventName);

//    DETERMINE THE NAME OF EVENT USED TO BY POWER MANAGER TO INDICATE USER
//    INPUT or SystemIdleTimerReset()
if( ::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("SYSTEM\\GWE"), 0, 0, &hKey) == ERROR_SUCCESS && )
    ::RegQueryValueEx( hKey, _T("ActivityEvent"), 0, &dwType, (BYTE*) szEventName, &dwSize) == ERROR_SUCCESS )
{
    HANDLE    hEvent    = ::OpenEvent( EVENT_ALL_ACCESS, FALSE, szEventName );
 
    if( hEvent )
    {
        DWORD    dwTicks            = ::GetTickCount();
        DWORD    dwDeltaTicks    = 0;
        while( true )
        {
            ::WaitForSingleObject( hEvent, INFINITE );
            dwDeltaTicks        = ::GetTickCount() - dwTicks;
            dwTicks = ::GetTickCount();
        }
        ::CloseHandle( hEvent );
    }
}

if( hKey )    ::RegCloseKey( hKey );

As you can see in the pseudo code the named event is stored in the HKEY_LOCAL_MACHINE\System\GWE\ActivityEvent registry value
Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Petr Selinger
Thanks everybody for feedback

Thanks everybody for feedback, I will let the customer know what are the possibilities.
Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments