[Gta04-owner] suspend with QTMOKO or SHR

Neil Jerram neil at ossau.homelinux.net
Sat Feb 23 13:55:39 CET 2013


Neil Jerram <neil at ossau.homelinux.net> writes:

> "arne anka" <openmoko at ginguppin.de> writes:
>
>> how do QTMOKO or SHR manage suspend?
>
> I'm afraid I don't really know, but have you tried "echo mem >
> /sys/power/state" ?

I realised that I could quite easily find a better answer for you.  In
QtMoko, the code (neosuspend.cpp) does this:

    QProcess::execute("before-suspend.sh");
    chargeNowBeforeSuspend = readChargeNow();
    suspendTime = QDateTime::currentDateTime();

    // Check if wakeup sources havent changed. If yes, then the write will fail
    // For more info see:
    // http://lists.goldelico.com/pipermail/gta04-owner/2012-July/002587.html
    if (Qtopia::
        writeFile("/sys/power/wakeup_count", wakeupCount.constData(),
                  wakeupCount.count(), false, 0, 1)) {
        qLog(PowerManagement) <<
            "suspend aborted because by kernel wakeup sources";
        return false;
    }

    Qtopia::writeFile("/sys/power/state", "mem", 3, false);

The before-suspend.sh script is a hook for users, and is empty by
default.

In summary, I think that means that "echo mem > /sys/power/state" is
mostly the right answer, but see also the referenced email (which, IIRC,
is to do with a race between wakeup sources and the suspend process).

     Neil


More information about the Gta04-owner mailing list