none
Power properties RRS feed

  • Question

  • Hi,

    WinCE600R2 + iMX25.

    The current image i made after some minutes recalls the BSPTurnOffDisplay() function of the lcdc driver.

    How can i change this time interval?

    If i open the ControlPanel/Power Properties - Schemes i found the Power Scheme = Battery Power.

    How can i set this scheme to AC Power?

    Thanks


    SteMMo
    Wednesday, May 4, 2011 10:41 AM

All replies

  • power scheme are selected by the control panel power applet automatically based on the device that is currently working. this uses GetSystemPowerStatusEx() function to know the current power status.if it is working on battery, it will show the battery power scheme and if it is working on AC power it will show the AC power scheme.

    Refer \WINCE600\PUBLIC\WCESHELLFE\OAK\CTLPNL\CPLMAIN\power.cpp file to know above functional implementation

    Power Manager is using the API GetSystemPowerStatusEx2() to find the status of the current power status and based on that it will load the corresponding timeouts from the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\Timeouts] registry.

    Refer \WINCE600\PUBLIC\COMMON\OAK\DRIVERS\PM\PDD\COMMON\pddpower.cpp

    also \WINCE600\PUBLIC\COMMON\OAK\DRIVERS\PM\PDD\DEFAULT\pwstates.cpp


    Vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com


    Wednesday, May 4, 2011 11:25 AM
  • Vinoth,

    thanks a lot.

    I don't understand:

    - in pddpower.cpp i see the calls to BatteryDrvrGetLevels() i found in a battery driver, and GetSystemPowerStatusEx2 i didn't find.

    - into the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\Timeouts] registry keys i found 0 everywhere: why after 6 minutes the BSPTurnOffDisplay() is recalled?

     


    SteMMo
    Wednesday, May 4, 2011 2:33 PM
  • 1) you can find the gpfnGetSystemPowerStatusEx2(). this is a function pointer of GetSystemPowerStatusEx2() function.

    2) How and where you are making the registry settings to 0? Check it out the registry settings must be in

    ;HIVE BOOT SECTION

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\Timeouts]

    ....

    ....

    ; END HIVE BOOT SECTION

    provided you have enabled the Hive based registry


    Vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com
    Wednesday, May 4, 2011 4:13 PM
  • 1. yes, but where is the function (and the relative source code)? I'd like to set the AC scheme. In this case (AC power scheme), the power timeouts are active??

    2. i have that ones in the platform.reg file (but not under the ';HIVE BOOT SECTION' area), but why the turnoff function is fired after 6 minutes?


    SteMMo
    Thursday, May 5, 2011 12:42 PM
  • See the code snippet in pddpower.cpp

         DWORD dwLen = gpfnGetSystemPowerStatusEx2(&spsCurrent, sizeof(spsCurrent), FALSE);
            if(dwLen == 0) {
                PMLOGMSG(ZONE_WARN, (_T("%s: GetSystemPowerStatusEx2() failed\r\n"),
                    pszFname));
            } else {
                // fill in our new data structure
                pi.dwBatteryLifeTime = spsCurrent.BatteryLifeTime;
                pi.dwBatteryFullLifeTime = spsCurrent.BatteryFullLifeTime;
                pi.dwBackupBatteryLifeTime = spsCurrent.BackupBatteryLifeTime;
                pi.dwBackupBatteryFullLifeTime = spsCurrent.BackupBatteryFullLifeTime;
                pi.bACLineStatus = spsCurrent.ACLineStatus;
                pi.bBatteryFlag = spsCurrent.BatteryFlag;
                pi.bBatteryLifePercent = spsCurrent.BatteryLifePercent;
                pi.bBackupBatteryFlag = spsCurrent.BackupBatteryFlag;
                pi.bBackupBatteryLifePercent = spsCurrent.BackupBatteryLifePercent;
            }

            // determine whether we need to send out any notifications
            PMLOCK();
            if(memcmp(&gSystemPowerStatus, &pi, sizeof(gSystemPowerStatus)) != 0) {
                fPowerInfoChange = TRUE;
                if(gSystemPowerStatus.bACLineStatus != pi.bACLineStatus) {
                    fACLineStatusChange = TRUE;
                }
                gSystemPowerStatus = pi;
            }
            PMUNLOCK();

    gSystemPowerStatus is updated here and it is used in pwstates.cpp. see the below code snippet

     // Timeout Function.
        DWORD GetSuspendTimeOut () {
            return (gSystemPowerStatus.bACLineStatus == AC_LINE_OFFLINE? m_dwBattSuspendTimeout: m_dwACSuspendTimeout);
        }
        DWORD GetSystemIdleTimeOut() {
            return (gSystemPowerStatus.bACLineStatus == AC_LINE_OFFLINE? m_dwBattTimeoutToSystemIdle: m_dwACTimeoutToSystemIdle);
        }
        DWORD GetUserIdleTimeOut() {
            return (gSystemPowerStatus.bACLineStatus == AC_LINE_OFFLINE? m_dwBattUserIdleTimeout: m_dwACUserIdleTimeout);
        }

     

    2) if hive based registry is enabled, the timeout registry must be in ';HIVE BOOT SECTION'. because PM is part of the kernel and it takes the registry from BOOT hive. So to reflect your changes you have to maintain the timeout registry between the HIVE BOOT SECTION.

    See the blog for more info

    http://www.e-consystems.com/blog/workaround-to-reload-the-power-manager-activity-timeout-upon-every-booting-in-hive-based-registry/


    Vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com
    Thursday, May 5, 2011 12:59 PM
  • 1. thanks for the code, but i'm asking where the gpfnGetSystemPowerStatusEx2 code is. It should be a function inside the core.dll but I guess it is a part of BSP, to read the hardware and set properly the SYSTEM_POWER_STATUS_EX2

    2. I added the boot section directives and i'll test them.

    What about the

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\ActivityTimers\UserActivity]

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\ActivityTimers\SystemActivity]

    items?


    SteMMo
    Thursday, May 5, 2011 2:08 PM
  • Yes, this is a coredll.dll system call. yes. SYSTEM_POWER_STATUS_EX2 is updated by your BSP battery driver.

    See the sample battery driver used in VOIP_PXA270 BSP

    \WINCE600\PLATFORM\VOIP_PXA270\SRC\DRIVERS\BATTERY

    This is PDD driver and it is using \WINCE600\PUBLIC\COMMON\OAK\DRIVERS\BATTDRVR


    Vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com

    Thursday, May 5, 2011 2:39 PM