diff --git a/Changelog.md b/Changelog.md index 8491989..be5f402 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,9 @@ HibernationFixup Changelog ============================ +#### v1.5.0 +- Auto hibernation: make sure auto-hibernate feature only happens when hibernatemode is set to 3. (Never with mode 0 or 25). + #### v1.4.9 - Add macOS 14 (Sonoma) constants diff --git a/HibernationFixup/kern_hbfx.cpp b/HibernationFixup/kern_hbfx.cpp index d2e3735..5fbc7a3 100644 --- a/HibernationFixup/kern_hbfx.cpp +++ b/HibernationFixup/kern_hbfx.cpp @@ -362,7 +362,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle uint32_t standby_delay = 0; bool pmset_default_mode = false; auto autoHibernateMode = ADDPR(hbfx_config).autoHibernateMode; - while (callbackHBFX->isStandbyEnabled(standby_delay, pmset_default_mode) && + while (callbackHBFX->isStandbyEnabled(standby_delay, pmset_default_mode) && pmset_default_mode && (params->sleepType == kIOPMSleepTypeDeepIdle || params->sleepType == kIOPMSleepTypeStandby || params->sleepType == kIOPMSleepTypeNormalSleep)) { IOPMPowerSource *power_source = callbackHBFX->getPowerSource(); @@ -378,7 +378,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle if (callbackHBFX->sleepPhase > kIOPMSleepPhase0) { callbackHBFX->sleepServiceWake = false; - if (pmset_default_mode && standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0) + if (standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0) callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar(); } break; @@ -389,7 +389,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle if (callbackHBFX->sleepPhase > kIOPMSleepPhase0) { callbackHBFX->sleepServiceWake = false; - if (pmset_default_mode && standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0) + if (standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0) callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar(); } break; @@ -425,7 +425,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle if (callbackHBFX->sleepPhase > kIOPMSleepPhase0) { callbackHBFX->sleepServiceWake = false; - if (pmset_default_mode && standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0) + if (standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0) callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar(); } break; @@ -433,7 +433,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle if (callbackHBFX->sleepPhase > kIOPMSleepPhase0) { - if (pmset_default_mode && standby_delay != 0 && !forceHibernate && !callbackHBFX->wakeCalendarSet && !callbackHBFX->sleepServiceWake) + if (standby_delay != 0 && !forceHibernate && !callbackHBFX->wakeCalendarSet && !callbackHBFX->sleepServiceWake) callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar(); } @@ -445,7 +445,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle #endif bool doNotOverrideWakeUpTime = (ADDPR(hbfx_config).autoHibernateMode & Configuration::DoNotOverrideWakeUpTime); - bool setupHibernate = (forceHibernate || !callbackHBFX->wakeCalendarSet || callbackHBFX->sleepServiceWake || (pmset_default_mode && standby_delay == 0)); + bool setupHibernate = (forceHibernate || !callbackHBFX->wakeCalendarSet || callbackHBFX->sleepServiceWake || standby_delay == 0); if (setupHibernate && doNotOverrideWakeUpTime && !forceHibernate) { if (vars->standbyTimer != 0)