Contribute
Register

[Guide] How to patch DSDT for working battery status

Yes, the latest one.

Download patchmatic: https://github.com/RehabMan/OS-X-MaciASL-patchmatic.
Extract the 'patchmatic' binary from the ZIP. Copy it to /usr/bin, such that you have the binary at /usr/bin/patchmatic.

In terminal,
Code:
rm -Rf ~/Downloads/RehabMan
mkdir ~/Downloads/RehabMan
cd ~/Downloads/RehabMan
patchmatic -extract

Post contents of Downloads/RehabMan directory (as ZIP).

Also, post ioreg: http://www.tonymacx86.com/audio/58368-guide-how-make-copy-ioreg.html. Please, use the IORegistryExplorer v2.1 attached to the post! DO NOT reply with an ioreg from any other version of IORegistryExplorer.app.

And output from:
Code:
kextstat|grep -y acpiplat
kextstat|grep -y appleintelcpu
 
Download patchmatic: https://github.com/RehabMan/OS-X-MaciASL-patchmatic.
Extract the 'patchmatic' binary from the ZIP. Copy it to /usr/bin, such that you have the binary at /usr/bin/patchmatic.

In terminal,
Code:
rm -Rf ~/Downloads/RehabMan
mkdir ~/Downloads/RehabMan
cd ~/Downloads/RehabMan
patchmatic -extract

Post contents of Downloads/RehabMan directory (as ZIP).

Also, post ioreg: http://www.tonymacx86.com/audio/58368-guide-how-make-copy-ioreg.html. Please, use the IORegistryExplorer v2.1 attached to the post! DO NOT reply with an ioreg from any other version of IORegistryExplorer.app.

And output from:
Code:
kextstat|grep -y acpiplat
kextstat|grep -y appleintelcpu

Here you go :)
 

Attachments

  • MacBook Air.ioreg
    2 MB · Views: 90
  • RehabMan.zip
    31.7 KB · Views: 60
Hi, I'm pretty sure I've messed up somewhere with regards to patching the DSDT file. The battery status only shows up as 1%, makes no difference if I charge it or not.

Once I had patched the file I kept on getting errors about "Object is not accessible from this scope"
for all the 16bit fields I had replaced except for just one which was defined earlier in the file with

Code:
Name (fieldName, 0x043)

So thinking a bit beyond myself, I added in all my 8 bit fields (e.g. FCC0, FCC1) below that declaration like so:

Code:
Name (FCC0, Zero)
Name (FCC1, Zero)

This made all the errors go away but obviously broke something.
Another thing that I wasn't sure about was how to approach comparisons, an example being:
Code:
                                If (LLessEqual (^^LPCB.EC0.MBRM, 0x96))
                                {
                                    Store (One, Local0)
                                }

Now MBRM, was substituted as BRM0 and BRM1, so I wasn't sure how I would go on replacing it within the LLessEqual() Method
I replaced it with B1B2() anyhow and I'm sure that might be screwing things up as well.

Anyway, I'm pretty sure if you look at the files I've attached you should be able to figure it out and point me in the right direction.


I'm posting the ioreg file, the zip folder with all the files that were output by running:
Code:
patchmatic -extract

I'm also attaching the txt file of the patch I had run in maciASL
Im also attaching the DSDT file that I was using from before applying the battery status patch

I used RW-Everything in Windows to extract the DSDT and SSDT files, put them all together in one folder and used your instructions in another thread on running the 'iasl' command.

The files were generated but DSDT has a notice at the start of the file saying something about it wasn't able to access all the properties and methods as they might be in some other external files that weren't included when iasl was run, and it advises me to run iasl again with the -fe argument, not sure how to proceed with that because I did have all the SSDT and DSDT files in the same folder when running the iasl command.

I was also able to successfully patch them up to enable backlight controls through SystemPref->Display and via the keyboard shortcuts
So a big thank you for that!

My PC specs are:
HP Envy 15t k000 cto Notebook
i7 4710HQ 2.5Ghz
12GB Ram
Intel HD4600 Graphics

Not sure if there is anything else you need to help me here RehabMan

Any help on this will be much appreciated as right now I'm just plugging in the charger arbitrarily.
Thank you!

UPDATE:
I actually managed to fix the errors after using some common sense.
I was obviously getting those errors because I had not been using the proper scopes on my field variables and broken regexp
I'm still not sure if calling the B1B2() function from within LLessEqual() method is the right thing to do or if it works or not, going to see if I can gather enough energy right now to google it

I can see my battery charge percentage now and it changes state when i unplug it or plug the charger back in again. So far so good!
I'm attaching my fixed and working patch file in a new post below and you can perhaps test it and put it on the repository

Huge thanks still, I wouldn't have done it without your help.
View attachment patch.txt
View attachment DSDT-backup.aml
View attachment ioRegFile.ioreg
View attachment RehabMan.zip
 
As mentioned in the post above, here is the patch file I created.
Please let me know if there is anything to be fixed in it, or perhaps if you'll be kind enough to fix it yourself and let me know. As I said earlier, I'm not sure B1B2() should be called from within LLessEqual() but then again what do I know, my first time doing anything in this ACPI mumbojumbo

This patch is for HP Envy 15t K000 CT0 Notebook
i7 4710HQ Haswell with HD4600 Graphics

Thank you!
 

Attachments

  • HP_Envy_15t.txt
    5.3 KB · Views: 242
ACPIBatteryManager.kext is not installed.

Really? I did install it on S/L/E and repair the permission.

EDIT:
This so weird, I try to repair permission using Kext Wizard and rebooted but still no battery, then I used Kext Utility then suddenly my laptop automatically restarted and BAM! My battery indicator is now working! Many thanks to Rehabman! You're a great man! Thank you for all the help! Salute men! :headbang:
 
As mentioned in the post above, here is the patch file I created.
Please let me know if there is anything to be fixed in it, or perhaps if you'll be kind enough to fix it yourself and let me know. As I said earlier, I'm not sure B1B2() should be called from within LLessEqual() but then again what do I know, my first time doing anything in this ACPI mumbojumbo

This patch is for HP Envy 15t K000 CT0 Notebook
i7 4710HQ Haswell with HD4600 Graphics

Thank you!

Please post your native DSDT as well. I'm not adding any patches to the repo unless they can be verified against the native DSDT.
 
Hi people,

I am stacked in a place and I need some help to move on.

I patched my dsdt.aml with my home made patch. I attach both of them here. I do have an HP Envy 4 1102es.

Debug version of last AppleSmartBattery says

Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::pollingTimeOut called
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::pollBatteryState: path = 1
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatterySTA called
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatterySTA: battery_status = 0x1f
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatteryBIF called
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatteryBIF: validateObject return 0x0
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: acpibat_bif size = 13
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fPowerUnit = 0x1
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fDesignCapacity = 6000
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fMaxCapacity = 6000
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fBatteryTech = 0x1
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fDesignVoltage = 10800
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fCapacityWarning = 600
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fLowWarning = 180
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fDeviceName = ''
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fSerialNumber = '00000 00/00/ '
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fType = ''
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIF: fManufacturer = ''
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatteryBST called
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fPowerUnit = 0x1
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: currentStatus = 0x0
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate = -1
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = -1
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentVoltage = 6000
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate is ACPI_UNKNOWN
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: adjusted fCurrentRate to 0
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fAverageRate = 0
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery: Battery is charged.
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::constructAppleSerialNumber called
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::rebuildLegacyIOBatteryInfo called

And ACPIBatteryManager is not loaded and when I try to force it load it says:

Feb 16 21:29:18 Eduards-MacBook-Pro.local sudo[588]: eduardp : TTY=ttys000 ; PWD=/System/Library/Extensions ; USER=root ; COMMAND=/sbin/kextload ACPIBatteryManager.kext/
Feb 16 21:29:18 Eduards-MacBook-Pro.local com.apple.kextd[19]: Memory allocation failure.
Feb 16 21:29:18 Eduards-MacBook-Pro.local com.apple.kextd[19]: kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext "/System/Library/Extensions/ACPIBatteryManager.kext"

I attach my original, patch and patched dsdt. If you give me a clue of what is going on I would greatly appreciate.

Regards.
 

Attachments

  • dsdt_nomesbat.aml
    63.7 KB · Views: 64
  • PatchENVY4-1102esDSDT.txt
    6.1 KB · Views: 134
  • dsdt.aml
    63.1 KB · Views: 108
It is easy to see that _BST is not working correctly...

Code:
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate = -1
Feb 16 21:29:03 Eduards-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = -1
 
Back
Top