Hacker News new | past | comments | ask | show | jobs | submit login

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.



Set 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.


How 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.


Maybe 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

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.


depends 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/...




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: