Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto hibernation: make sure auto-hibernation feature only happens when hibernatemode is set to 3. (Never when mode 0 or 25). #3

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

leon9078
Copy link
Contributor

@leon9078 leon9078 commented Apr 9, 2024

I'm a bit experimenting with hbfx-ahbm | Number | 1 on my desktop build. Laptops have hibernatemode 3 by default.
Desktops have hibernatemode 0, which cause a S3 Sleep/Wake cycle. However I found that with standby / autopoweroff 1, auto-hibernation triggers. This also happens when I want to force hibernation using mode 25...

Since hbfx-ahbm's should be used when hibernatemode 3 (https://applelife.ru/posts/670121/), I've fixed all this behaviors by adding a simple check in the auto-hibernation logic.

Here are all the logs. (latest DEBUG build, and with the fix applied)

pmset -g

System-wide power settings:
Currently in use:
 standby              1
 Sleep On Power Button 1
 womp                 0
 hibernatefile        /var/vm/sleepimage
 powernap             0
 networkoversleep     0
 disksleep            10
 standbydelayhigh     660
 sleep                1
 autopoweroffdelay    1980
 hibernatemode        0
 autopoweroff         0
 ttyskeepawake        0
 displaysleep         10
 highstandbythreshold 50
 standbydelaylow      660

sudo dmesg > dmesg_hib0_standby1.txt
dmesg_hib0_standby1.txt

log show --style syslog --last boot --predicate 'subsystem == "powerd" && category == "sleepWake" && (composedMessage CONTAINS " state due to" OR composedMessage CONTAINS " from ")' > log_SleepWake_hib0_standby1.txt
log_SleepWake_hib0_standby1.txt

hibernatemode 0
standby 0
autopoweroff 1

dmesg_hib0_autopoweroff1.txt
log_SleepWake_hib0_autopoweroff1.txt

hibernatemode 25
standby 1
autopoweroff 0

dmesg_hib25_standby1.txt
log_SleepWake_hib25_standby1.txt

Logs with the fix

dmesg_hib25_standby1_fix.txt
log_SleepWake_hib25_standby1_fix.txt
dmesg_hib0_standby1_fix.txt
log_SleepWake_hib0_standby1_fix.txt
dmesg_hib0_autopoweroff1_fix.txt
log_SleepWake_hib0_autopoweroff1_fix.txt

@leon9078
Copy link
Contributor Author

CC @lvs1974

Copy link
Collaborator

@lvs1974 lvs1974 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this change, but could you do some additional cleanup in this loop while (between lines 365 and 505)? We have many checks for pmset_default_mode, and they won't be needed at all after your change.

@leon9078
Copy link
Contributor Author

could you do some additional cleanup in this loop while (between lines 365 and 505)? We have many checks for pmset_default_mode, and they won't be needed at all after your change.

Okay, done.

@lvs1974 lvs1974 merged commit c309e34 into acidanthera:master Apr 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants