4 ms·
Yes, at least from what I've experienced, you can have "resume in 2 seconds" or "sleep for a week" but not both. (S0ix and S3 respectively) To be fair, I don't
by rcthompson 5y ago
Yes, at least from what I've experienced, you can have "resume in 2 seconds" or "sleep for a week" but not both. (S0ix and S3 respectively)
To be fair, I don't think this is Framework's fault. My understanding is that this is a limitation of the current generation of Intel CPUs, so pretty much any current-gen Intel-based computer will have the same issue.
- yencabulator 5y ago> you can have "resume in 2 seconds" or "sleep for a week" but not both. (S0ix and S3 respectively) The way Windows laptops do this is to go from light sleep to deep sleep after being idle for a long period. You should be able to pull off the same trick in Linux.
- rcthompson 5y agoI 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.