Wakelocks working on GTA04/Replicant

Lukas Maerdian luk at slyon.de
Sun May 11 08:50:16 UTC 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
workaround.

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

Regards,
  Lukas

[1]
http://git.goldelico.com/?p=gta04-replicant-device.git;a=commit;h=db1e834950f79c36230d9ede712b7d8eedc06ab8
[2]
http://git.goldelico.com/?p=gta04-kernel.git;a=commit;h=fa166e47ad34a583f730b34f38d7d25eb5f2864c
[3]
https://github.com/SuperNexus/android_libcore/commit/64f3de64a5adb86a605a7f055349798fcae6b1f4

-------------- 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.osuosl.org/pipermail/replicant/attachments/20140511/ef563ed2/attachment.asc>


More information about the Replicant mailing list