Commit 50836b37 authored by Radek Polak's avatar Radek Polak

phonepowermanager - increase interval between screen off and suspend

GTA02 has problem that it does not automatically suspends. This is
in the log:

PhonePowerManager::setIntervals: 1 10 10  size:  3
PhonePowerManager::setIntervals: 1000 9000 100
QtopiaPowerManager: restoring screen saver
Using Block level  1
PhonePowerManager::save() level 0 action 0 homescreen settings: "Never" false
QtopiaPowerManager: setBacklight => 1
Dimming light
PhonePowerManager::save() level 1 action 1 homescreen settings: "Never" false
QtopiaPowerManager: setBacklight => 0
turning light off
QtopiaPowerManager: restoring screen saver
QtopiaPowerManager: setBacklight => -1

Successful suspend looks like this:

QtopiaPowerManager: setBacklight => -3
PhonePowerManager::setIntervals: 1 10 10  size:  3
PhonePowerManager::setIntervals: 1000 9000 100
QtopiaPowerManager: restoring screen saver
Using Block level  1
PhonePowerManager::save() level 0 action 0 homescreen settings: "Never" false
QtopiaPowerManager: setBacklight => 1
Dimming light
PhonePowerManager::save() level 1 action 1 homescreen settings: "Never" false
QtopiaPowerManager: setBacklight => 0
turning light off
PhonePowerManager::save() level 2 action 2 homescreen settings: "Never" false
case PhonePowerManager::Suspend: m_powerConstraint 1000 m_suspendEnabled true
Suspending device
ModemSuspend(0xc0db88) checking whether canSuspend...
SystemSuspendHandler(0x637958) checking whether canSuspend...
ModemSuspend(0xc0db88) suspending...
 ...waiting for completion...

This is from my mail:

It seems i understand the problem and have a workaround that works on v58. The
problem seems to be in QtMoko power management handling. You can set intervals
for dim, screen off and suspend. There are intervals between them and it
always goes like:

dim->screen off->suspend

If you dont specify interval between screen off->suspend QtMoko automatically
places 100ms there. But this is probably not enough and suspend never happens.

The workaround: go to Settings->Power management->select "On battery" and fill
in good intevals - e.g. Dim=off, Display off=30s, Suspend=40s and it will auto
suspend ok. The trick is that Display off must be filled and must be more then
10s less then suspend.

From qwindowsystem_qws.cpp we are most likely hitting this case:

        if (screensavertime.elapsed() > *screensaverinterval*2) {
            // bogus (eg. unsuspend, system time changed)
            _q_screenSaverWake(); // try again
            return;
        }

because previous screen off took more then 100ms. The solution is to increase 100ms
to 1s which should be safe. We assume that tunring screen off wont take more then 1s.
parent 3457ab6c
......@@ -180,7 +180,7 @@ void PhonePowerManager::setIntervals(int* ivals, int size )
default:
case 3:
ivals[2] = interval(ivals[2], config, "Suspend","Interval", 60); // No tr
v[2] = qMax( 1000*ivals[2] + 100, 100);
v[2] = qMax( 1000*ivals[2] + 1000, 1000);
m_suspendEnabled = ( (ivals[2] != 0) ? config.value("Suspend", true).toBool() : false );
if (m_suspendEnabled)
timeToAction.insert(v[2], PhonePowerManager::Suspend);
......@@ -188,18 +188,18 @@ void PhonePowerManager::setIntervals(int* ivals, int size )
ivals[1] = interval(ivals[1], config, "LightOff","Interval_LightOff", 30);
if (ivals[1] == 0 && m_suspendEnabled)
ivals[1] = ivals[2];
v[1] = qMax( 1000*ivals[1], 100);
v[1] = qMax( 1000*ivals[1], 1000);
if (timeToAction.contains(v[1]))
v[1] = v[1]+100; //add few ms for next timeout
v[1] = v[1]+1000; //add few ms for next timeout
m_lightOffEnabled = ( (ivals[1] != 0 ) ? config.value("LightOff", true).toBool() : false );
m_lightOffEnabled |= m_suspendEnabled;
if (m_lightOffEnabled)
timeToAction.insert(v[1], PhonePowerManager::LightOff);
case 1:
ivals[0] = interval(ivals[0], config, "Dim","Interval_Dim", 20); // No tr
v[0] = qMax( 1000*ivals[0], 100);
v[0] = qMax( 1000*ivals[0], 1000);
while ( timeToAction.contains( v[0] ) )
v[0] = v[0]+100; //add few ms for next timeout
v[0] = v[0]+1000; //add few ms for next timeout
m_dimLightEnabled = ( (ivals[0] != 0) ? config.value("Dim", true).toBool() : false );
if (m_dimLightEnabled)
timeToAction.insert(v[0], PhonePowerManager::DimLight);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment