Support dark resume
This is partial changeset to support so called dark resume which allows us to resume userspace but not turn display on where desirable. See commit descriptions for more detail.
Right now this does not do anything actually other than printing debug messages, but local logic I have blacklists certain devices from waking up device fully. I need some comments on approach before I go ahead with further changes.
More reading:
https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/power_manager/docs/dark_resume.md
https://github.com/systemd/systemd/issues/27077
CC: @sebas @jpetso @zamundaaa
How to test functionality
Test in combination of kwin!8031 (merged) on x86 systems.
Timer wakeups
- Configure system to go to sleep after 1 minute
- Run following command,
sudo rtcwake --date "+2min" -m noand keep system idle right away. - After one minute system will go in suspend, afterwords, at 2 minute mark system should wake-up without Display
- in 30 seconds system should go to sleep again if user does not interact with system
WoWLAN wakeups
- Note the IP and MAC address of your machine and enable magic-packet wakeup,
sudo iw phy phy0 wowlan enable magic-packet - Configure system to go to sleep after 1 minute
- Once system is asleep, send a wol packet from different system, you can for example use
wol -i <ip> <mac address>from different machine or Android apps which allows to send similar packets. - Once packet is sent, system should resume (without display)
- After 30 seconds, system should go to sleep again if user does not interact with system.
Power Management
(Right now this is not tied to any functionality but there is plan to integrate other functionality based on this architecture)
- Suspend system
- Plug-in AC adapter
- You should see following in logs,
Aug 28 16:05:30 antlia org_kde_powerdevil[165771]: org.kde.powerdevil: Wakeup source of type QFlags<SuspendController::WakeupSource>(PowerManagement) resumed from sleep, devices: QList("/sys/class/wakeup/wakeup33/device", "/sys/class/wakeup/wakeup43/device")as an example.