On 01 Feb 2014, at 21:32, Ove Kåven <o...@arcticnet.no> wrote:
> If a synchronization starts with the screen off, there's a chance that the 
> phone enters "deep suspend" during the synchronization. If so, the other side 
> might time out and the sync will fail.
> 
> So I want prevent the CPU from suspending before the synchronization is 
> complete, which might take a few seconds (and there might not be network 
> activity all the time while it's running). I've read that to get periodic 
> wakeups, you could use libiphb or maybe timed, but what's the recommended way 
> to temporarily prevent suspending completely for a few seconds?

You can talk to MCE via the system D-Bus, this is quite low-level, but works 
already:

https://github.com/nemomobile/mce-dev/blob/master/include/mce/dbus-names.h#L329

To quote the documentation:

 * The idea is: if some process needs to do non-interactive
 * background processing, it can prevent the system from
 * entering late suspend by
 *
 * 1) get timer period via #MCE_CPU_KEEPALIVE_PERIOD_REQ call
 *
 * 2) call #MCE_CPU_KEEPALIVE_START_REQ
 *
 * 3) repeat #MCE_CPU_KEEPALIVE_START_REQ calls in interval
 *    that is shorter than the maximum obtained at (1)
 *
 * 4) call #MCE_CPU_KEEPALIVE_STOP_REQ when finished
 *
 * MCE keeps track of active clients and blocks late suspend
 * until all clients have called #MCE_CPU_KEEPALIVE_STOP_REQ,
 * lost D-Bus connection (exit, crash, ...) or all timeouts
 * have been missed.

There might be a higher-level API for this in the future (Qt-flavored C++ and 
QML), for a preview, see:
https://github.com/nemomobile/nemo-keepalive

HTH :)
Thomas
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to