3 ms·
I would actually greatly appreciate such a feature. Essentially hybrid sleep except that the two types of sleep are different kinds of low power states instead
by rcthompson 5y ago
I would actually greatly appreciate such a feature. Essentially hybrid sleep except that the two types of sleep are different kinds of low power states instead of suspend to RAM and disk.
- yencabulator 5y agoSet up your laptop to RTC wake up x hours after suspend, go to deeper sleep. Should be 100% userspace, shouldn't need code changes in anything preexisting, and be mostly a question of configuration.
- rcthompson 5y agoHow do you tell if the wakeup is due to the RTC wake event or due to something initiated by the user (e.g. lid open, power button pressed, etc.)? Obviously you want to deep sleep after the former but not after the latter.
- detaro 5y agodepends a bit on the specific setup if and where it's exposed. dmidecode can sometimes see it, and various other bits might also log it so it's worth poking around dmesg/journalctl/...
- yencabulator 5y agoMaybe you can ask the RTC alarm whether it's still armed. I don't know if they automatically clear the enabled flag when the alarm occurs. See RTC_WKALM_RD in https://man7.org/linux/man-pages/man4/rtc.4.html https://man7.org/linux/man-pages/man4/rtc.4.html If not, well, you know what time the alarm is. That leaves a race, but there's a race regardless -- the human might have opened the laptop lid exactly after the RTC alarm went off. EDIT: Yup, confirmed in kernel source, Linux makes sure /sys/devices/platform/rtc_cmos/rtc/rtc*/wakealarm is single-shot, so you can see whether it triggered.