Contribute
Register

[Guide] How to patch DSDT for working battery status

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,929
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
You are a life saver! I’ve got a NVME as well and that’s where OSX is installed, I’ve followed rehabmans instructions for every one of my machines including this one, however this whole SSDT and DSDT patching thing is litererally the most confusing portion I’ve ever had to go through. Thank you so much for your help!
Keep in mind you cannot use patched ACPI files from a different computer.
You must patch your own.
 
Joined
Dec 11, 2010
Messages
22
Motherboard
NUC8i5BEK
CPU
I5-8259U
Graphics
Iris Pro 655
Mac
iMac, Mac mini
Mobile Phone
iOS
Keep in mind you cannot use patched ACPI files from a different computer.
You must patch your own.
Even with an identical machine and configuration? Please forgive my ignorance this topic is one that I have struggled with and I’ve spent hours reading your guides. I completed your NUC build as well and absolutely love that machine.
 
Joined
Jan 28, 2013
Messages
316
Motherboard
Lenovo IdeaPad 330S-15IKB-81F500NSUS
CPU
i5-8250U
Graphics
Intel® UHD Graphics 620
Mac
Mac mini
Classic Mac
eMac, Power Mac
Mobile Phone
iOS
Super obvious...

Example code not patched:
If (FCC0)

Your patch is looking for: (FCC0,
Code:
into method label _BIF code_regex \(FCC0, replaceall_matched begin (B1B2(CC01,CC02), end;
But '(FCC0)' is not the same as '(FCC0,'
Thanks for the assistance.
 
Joined
Feb 8, 2012
Messages
76
Motherboard
ASUS Z97-Pro Gamer
CPU
i7-4790K
Graphics
GTX1080 / HD4600
Mobile Phone
Android
Hi @RehabMan and everyone else. I have an issue with my laptop hackintosh where if my charger is connected to the laptop and I try to sleep it, the kernel would throw a 'System Wake Failure' on wakeup. When I try to shut it down, the laptop would go into a 'darkwake'-like mode where it doesn't shut down, but remains turned on with the screen off and doesn't respond to key or mouse presses. The same thing happens with when waking up (and the system crashes). Occasionally, macOS would reach the login screen but would freeze after about 5 seconds after waking (needing a hard reset. These issues happen about 80% of the time, so they are quite predictable but not 100%. I also get a similar issue when I've put the laptop to sleep and I plug in or unplug the AC Adapter.

Back when I implemented the battery support for my laptop, I changed the DSDT so that the battery would always be reported as connected/plugged in (since my laptop doesn't have a removable battery anyway and was the reason why I couldn't see my battery status - it would disappear after login). By that I don't mean that it always reports the charger as plugged in but that the battery itself is connected to the motherboard.

The reason why I think this is AC Adapter and Battery Status related is because these problems only occur when the charger is plugged in (or is being plugged in or plugged out). The laptop works perfectly on battery power. I have attached both the crash log that appears when the system throws a 'System Wake Failure' error, as well as all problem reporting files. Please help me fix this because it is really annoying.

Thank you in advance!
 

Attachments

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,929
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
I have an issue with my laptop hackintosh where if my charger is connected to the laptop and I try to sleep it, the kernel would throw a 'System Wake Failure' on wakeup.
Off-topic. Please post a separate thread. This thread is for battery status only.
Your issue sounds more like it is USB related.
 
Joined
Mar 12, 2019
Messages
3
Motherboard
Dell Studio 1747 laptop
CPU
i7-720QM
Graphics
HD 4650
hello @RehabMan and all others,
thank you for all the work you have put into this project

I installed high sierra to my dell studio 1747 laptop,
I have everything working : sound video QE/CI
I am trying to get the battery readings, but it alway shows 0%
I have followed the page 1 posts and it looks like everything is working appart the fMaxCapacity is always 0
dmesg shows:

ACPIBatteryManager: fDeviceName = 'DELL N853P9BN'
ACPIBatteryManager: fSerialNumber = '9CCC'
ACPIBatteryManager: fType = 'Lion'
ACPIBatteryManager: fManufacturer = 'SDI'
ACPIBatteryManager: Calculating for WATTS
ACPIBatteryManager: fDesignCapacity(mAh) = 7800
ACPIBatteryManager: fMaxCapacity(mAh) = 0
ACPIBatteryManager: Error: Capacity Read Zero (0)
ACPIBatteryManager: setBatterySerialNumber called
ACPIBatteryManager: getBatteryBST called
ACPIBatteryManager: setBatteryBST: acpibat_bst size = 4
ACPIBatteryManager: fPowerUnit = 0x0
ACPIBatteryManager: currentStatus = 0x2
ACPIBatteryManager: fCurrentRate = 12111
ACPIBatteryManager: fCurrentCapacity = 646080
ACPIBatteryManager: fCurrentVoltage = 12111
ACPIBatteryManager: Calculating for WATTS
ACPIBatteryManager: fCurrentRate(mA) = 1091
ACPIBatteryManager: fCurrentCapacity(mAh) = 58205
ACPIBatteryManager: fAverageRate = 1091
ACPIBatteryManager: Battery is charging.
ACPIBatteryManager: rebuildLegacyIOBatteryInfo called

where does acpibatterymanager read fMaxCapacity ?
is it hardcoded in the dsdt?

I have attached the files for debugging , along with my patch, and the original dsdt dumped with clover and extracted with refs.txt

if someone could have a look at it , it would help me

thanks

eric
 

Attachments

Last edited:
Joined
Mar 12, 2019
Messages
3
Motherboard
Dell Studio 1747 laptop
CPU
i7-720QM
Graphics
HD 4650
I tried to continue debugging this , the fMaxCapacity comes from acpibat_bif (batterymanager) which itself comes from
STAT

Name (STAT, Package (0x0D)
{
Zero,
0x0FA0,
0x0FA0,
One,
0x2B5C,
0x01A4,
0x9C,
0x0108,
0x0EC4,
"DELL",
" ",
"Lion",
"Dell"
})

putting some debug
\RMDT.PUSH ("STAT5")
\RMDT.PUSH (Index (STAT, 0x05))
\RMDT.PUSH ("STAT6")
\RMDT.PUSH (Index (STAT, 0x06))

they always return 0x0

so i put some debug before the creation of (Index (STAT, 0x06)

Store (B1B2 (^^EC0.BF00, ^^EC0.BF01), Local4)
\RMDT.PUSH ("local4")
\RMDT.PUSH (Local4)
Sleep (0x14)
Divide (Multiply (Local4, 0x0A, Local4), 0x64, , Local4)
Store (Local4, Index (STAT, 0x06))

local4 is 0, so it gets multiplied and returns 0,
or maybe I am reading this the wrong way around??

but then, i am running out of ideas

thanks

eric
 
Joined
May 6, 2014
Messages
219
Motherboard
Lenovo Ideapad 320-14ikb
CPU
i5-7200U
Graphics
HD 620 (1920x1080)
Mac
MacBook Pro
Mobile Phone
Other
hi Rehabman I added 64bit register patches for my ideapad 320 into battery_Lenovo-Ideapad-Y700.txt
this worked perfectly and I double checked when I patch through MaciASL 60 patches 61 changes this is perfect worked
I already added into battery_Lenovo-Ideapad-Y700.txt please upload in your Laptop-DSDT-Patch-master under battery section
your sincerely
 

Attachments

Top