linux: Refresh devices after waking up from sleep

System Internals / UPower - Christian Kellner [kellner.me] - 25 March 2017 13:04 EDT

The battery levels might have changed drastically compared to before sleep. Since we poll batteries at set intervals, it can take quite some time for the new level to be picked up by the polling code.

Listen to the "PrepareForSleep" signal emitted by logind, that gets emitted on suspend and wake up. Pause polling globally on suspend, and refresh all devices manually and resume polling when waking up.

https://bugs.freedesktop.org/show_bug.cgi?id=99763

01cd65c linux: Refresh devices after waking up from sleep
src/linux/up-backend.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)

Upstream: cgit.freedesktop.org


  • Share