[Gta04-owner] Wakelocks working on GTA04/Replicant

Lukas Maerdian luk at slyon.de
Sun May 11 10:50:16 CEST 2014

Hi all,

I've reached another step in improving the suspend/wakelock behavior of
Replicant on the GTA04. The mainline implementation of wakelocks, which
is used in our kernel was already working in theory, but the Android
userspace was not able to acquire any locks, due to insufficient
permissions and process capabilities.

The solution was to change the permissions of the needed files in sysfs
(/sys/power/wake_[un]lock) [1] and to disable the process capabilities
check in the kernel [2]. The later is actually a workarround and the
process capabilities (i.e. CAP_BLOCK_SUSPEND) should be set correctly,
which I think is done in Android's libcore [3]. Our version of libcore
doesn't set CAP_BLOCK_SUSPEND, though. And as I don't want to fork
libcore, I disabled the capabilities check in the kernel. As soon as we
have a userspace, which sets correct capabilities, we can remove this

With this commits in place, the device now stays powered on if a
wakelock is held (e.g. if music is playing in the background). You can
see the current (kernel-) wakelocks with this command:
  cat /sys/power/wake_lock

Usually "PowerManagerService" is listed in there, which is the service
handling all the userspace/partial wakelocks. Those partial wakelocks
can be explored further with this command:
  dumpsys power



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20140511/ef563ed2/attachment.asc>

More information about the Gta04-owner mailing list