simprecicchiani / ThinkPad-T460s-macOS-OpenCore

Bootloader configuration for macOS on T460s and possibly other 6th gen ThinkPads
BSD 3-Clause "New" or "Revised" License
338 stars 60 forks source link

Laptop issue that fall asleep at low percantage but its still just turn off(possible solution) #88

Closed mhl221135 closed 3 years ago

mhl221135 commented 3 years ago

I noticed that the laptop issues a warning that it will fall asleep, but it does not fall asleep and turns off at a low capacity I think I found a solution, but I don't understand the code, maybe you can implement these fixes https://applelife.ru/threads/hibernate-pri-razrjade-batarei.2874421/ If you cannot translate something on this forum, I can help because this is my native language

mhl221135 commented 3 years ago

I think this is solution testing now with hbfx-ahbm=39 (is sum of values below)

hbfx-ahbm=abhm_value controls auto-hibernation feature, where abhm_value is an arithmetic sum of respective values below:

EnableAutoHibernation = 1: If this flag is set, system will hibernate instead of regular sleep (flags below can be used to limit this behavior)

WhenLidIsClosed = 2: Auto hibernation can happen when lid is closed (if bit is not set - no matter which status lid has)

WhenExternalPowerIsDisconnected = 4: Auto hibernation can happen when external power is disconnected (if bit is not set - no matter whether it is connected)

WhenBatteryIsNotCharging = 8: Auto hibernation can happen when battery is not charging (if bit is not set - no matter whether it is charging)

WhenBatteryIsAtWarnLevel = 16: Auto hibernation can happen when battery is at warning level (osx and battery kext are responsible for this level)

WhenBatteryAtCriticalLevel = 32: Auto hibernation can happen when battery is at critical level (osx and battery kext are responsible for this level)

DisableStimulusDarkWakeActivityTickle = 128: Disable power event kStimulusDarkWakeActivityTickle in kernel, so this event cannot trigger a switching from dark wake to full wake

Next 4 bits are used to specify minimal capacity percent remaining value when hibernation will be forced. Can be used together with WhenBatteryIsAtWarnLevel or WhenBatteryAtCriticalLevel, when IOPMPowerSource cannot detect warning or critical battery level

RemainCapacityBit1 = 256

RemainCapacityBit2 = 512

RemainCapacityBit3 = 1024

RemainCapacityBit4 = 2048

source https://github.com/midi1996/P50-opencore-hackintosh#hibernation https://github.com/acidanthera/HibernationFixup#boot-args

Unfortunately, this thing not working(( But i find some helpful script you can enjoy(also testing now) https://www.tonymacx86.com/threads/release-sleeponlowbattery-solb.264785/