Contribute
Register

<< Solved >> OpenCore battery patch

Status
Not open for further replies.
Apologies but I posted my battery issues in a separate thread:

Don't suppose anyone would have a couple of minutes to point me in the right direction would they please? All the info should be in there...

Either that or I can repeat it all here if that's better?
 
Hello, guys!

// Comment:

If you need any help, just post your native DSDT along with an existing rehabman patch, if it exists. Otherwise, I'll try to patch it from scratch. If you want me to implement it properly, post your EFI folder aswell.

I will help as many people as possible!

My solution was: https://www.tonymacx86.com/threads/opencore-battery-patch.295289/post-2101803

I am working on getting my laptop up and running with OpenCore, switching from clover right now... What works: Audio, USB, USBC (Data + External Monitors), Trackpad, Touchscreen, WiFi & BT. What doesn't: My DAMN battery indicator...

// Note: DO NOT follow this immense amount of GARBAGE I did below, it will only screw your system up. Scroll down further, I have this solved, use the other approach instead. (https://www.tonymacx86.com/threads/opencore-battery-patch.295289/post-2101803)

This patch works 100% for my laptop (with clover, patching DSDT): https://github.com/RehabMan/Laptop-DSDT-Patch/blob/master/battery/battery_Razer-Blade-2014.txt

I tried my BEST to get this working in OpenCore. What I came up with (step by step, so you get my train of thought right now):
* Renamed eisaID PNP0C0A to PNP0C99 (to disable DSDT BAT0 hooking from SMCBattery)
* Renamed Device BAT0 to BATX (to don't have overlapping names in same scope)
* Renamed eisaID PNP0C0D to PNP0C98 (to disable DSDT LID0 hooking from SMCBattery)
* Renamed Device LID0 to LIDX (to don't have overlapping names in same scope)
* Renamed eisaID PNP0C09 to PNP0C00 (to disable DSDT EC0 hooking from AppleACPIEC)

Then, I re-defined those devices in SSDTs. The SSDT-EC contains EC, LID0 and BAT0, copied from the Clover DSDT which got patched with the above patch from RehabMan. I added the External lines, which should point to the correct resources in main DSDT, at least I hope I did it correctly.

Now - what's the outcome? I actually got a battery indicator! And it goes down! But - it just does not go up or show the charging bolt symbol, so it's partially corruped. I have no further ideas, since my knowledge is very limited in the ASL language.

Attached: My OC EFI, my IOREG and my origin from clover - already run through iasl decompile.

Please - if someone has any ideas - help me out here, I would be so happy if open core would finally be complete - I'm pretty close! :)
Thank you lots!
Hi @BlvckBytes!

I've got an Elitebook 1040 G3, running Catalina with Opencore. First time using opencore, and have found the guides pretty helpful for most things, but this battery patching hurts my brain, alot. I'd be so grateful if you could help me out.

There appear to be Rehabman patches in a plist for my machine, Idk which ones apply to the battery... you get the idea, I'm lost. I'll attach what I have, hopefully it's enough. Let me know if you need more.

Thanks in advance!
 

Attachments

  • EFI.zip
    11.7 MB · Views: 106
  • config_1040_G3_Skylake.plist
    13.1 KB · Views: 86
  • DSDT.aml
    152.4 KB · Views: 46
Patch looks good except for one mistake (scope should be _SB.PCI0.LPCB.H_EC, and you should delete Device (H_EC)

your big problem is with renaming patches which you apparently have none, in order for your patch to load you need to rename the methods you modified in the dsdt (RDN0, RMN0,BTIF etc) otherwise your patch will fail to load

check [Guide] Using Clover to "hotpatch" ACPI , second post (Renaming existing methods)
Please Help in Renaming methods.I am bit confused about renaming
 
Hello, couple of notes to your patch

1- your dsdt got multiple Fields with the name ERAM so if you searched for "Field (ERAM," you will find more than one result, and you have to patch registers that are found in the rest ERAM Fields

2- Read the guide again, you missed some stuff such as you can't use Device (EC0), instead use Scope (EC0), your patch won't load if you use Device (EC0) or Device (BAT0) etc

3- you have to include only patched registers in embedded Controller with their offset, also you have to change the name of it (ERAM -> ERAX or any name)

4- you probably missed renaming patches as they are needed for the patch to load, check the guide, second post Renaming existing methods

5- upload your vanilla dsdt.aml
Hi @moh.96 thank you very much for your help! So, after checking your points and rereading the guide, here's my current state:

1. Indeed, I had more than one ERAM fields which I completely forgot about, now should be fixed.

2. I originally had Scope (EC0) instead of Device (EC0) (same for BAT0 and WMID) but on an attempt to get this working I modified this and forgot to put it back to Scope, so thanks for pointing me this issue.

3. I have updated this following your indications, the guide and the compiler results, adding the necessary field objects as externals to prevent the compiler from throwing me errors, let me know if this is the right approach.
I don't understand what you are telling me about renaming it: should I rename the DSDT Eram fields with a patch on my config.plist or should I rename the ones found on my SSDT?

4. Indeed, I wasn't renaming the methods at all --> I have already added the patches to my config.plist

5. Uploaded!

Thank you very much for your time and help, I really appreciate it!
 

Attachments

  • DSDT.aml
    205.9 KB · Views: 43
  • SSDT-HP-Spectre-Battery.dsl
    43.5 KB · Views: 44
  • DSDT original.aml
    203.2 KB · Views: 31
Hi @moh.96 thank you very much for your help! So, after checking your points and rereading the guide, here's my current state:

1. Indeed, I had more than one ERAM fields which I completely forgot about, now should be fixed.

2. I originally had Scope (EC0) instead of Device (EC0) (same for BAT0 and WMID) but on an attempt to get this working I modified this and forgot to put it back to Scope, so thanks for pointing me this issue.

3. I have updated this following your indications, the guide and the compiler results, adding the necessary field objects as externals to prevent the compiler from throwing me errors, let me know if this is the right approach.
I don't understand what you are telling me about renaming it: should I rename the DSDT Eram fields with a patch on my config.plist or should I rename the ones found on my SSDT?

4. Indeed, I wasn't renaming the methods at all --> I have already added the patches to my config.plist

5. Uploaded!

Thank you very much for your time and help, I really appreciate it!
Offsets are wrongly done

OperationRegion and Fields names should not be the same as the one in DSDT

I fixed both those errors
 

Attachments

  • SSDT-HP-Spectre-Battery.dsl.zip
    5.5 KB · Views: 44
Hi @BlvckBytes!

I've got an Elitebook 1040 G3, running Catalina with Opencore. First time using opencore, and have found the guides pretty helpful for most things, but this battery patching hurts my brain, alot. I'd be so grateful if you could help me out.

There appear to be Rehabman patches in a plist for my machine, Idk which ones apply to the battery... you get the idea, I'm lost. I'll attach what I have, hopefully it's enough. Let me know if you need more.

Thanks in advance!
your patch is similar to Hp Probook 450 g5 patch, I verified it and made slight changes and applied the patch to your dsdt (dsdt-patched.dsl)

Read those two guides
[Guide] How to patch DSDT for working battery status
[Guide] Using Clover to "hotpatch" ACPI

and use the files below it will help you do the patch (the first guide is how to patch dsdt which I already did for you, second one is how to convert patched dsdt to ssdt "Second post in the guide")
 

Attachments

  • HP-Elitebook 1040 G3-Battery-Patch.zip
    654.5 KB · Views: 78
Offsets are wrongly done

OperationRegion and Fields names should not be the same as the one in DSDT

I fixed both those errors
Thank you very much! I see what you did there, I’ve learnt mymistakes ;)
Anyway, after creating the .aml file and rebootong my hackintosh, the Battery Status still won’t show.
Here are the renamings I’ve done...
1603989200025.png

What am I missing? Thank you again!!!
 
Hello
finally I got Catalina on my laptop hp 450 g4.
but I can't get my battery status to work. could you please help me.
attached my EFI
 

Attachments

  • EFI.zip
    4.7 MB · Views: 62
Thank you very much! I see what you did there, I’ve learnt mymistakes ;)
Anyway, after creating the .aml file and rebootong my hackintosh, the Battery Status still won’t show.
Here are the renamings I’ve done...
View attachment 493559
What am I missing? Thank you again!!!
1- Do NOT use configurator, use ProperTree

2- Renames should be for the methods that already exists in DSDT (SMRD, SMWR, UPBI, UPBS, GBIF, GBCO) others you added by yourself should not be renamed

3- your renaming patches are wrong Read the guide again,
for example SMWR to SMWX, 534D5752 to 534D5758, this will rename every SMWR to SMWX which is wrong
you need to rename the method which you modified only by adding some Hex values before the method name (check screenshot)

So the patch should be
Find: 10534D5752
Replace: 10534D5758

Note that 10 is not constant you need to search for other methods and add some hexs before or after the method hex

Note 2: if you wanna get dsdt with hex use
iasl -l dsdt.aml
 

Attachments

  • Screen Shot 2020-10-29 at 7.52.55 PM.png
    Screen Shot 2020-10-29 at 7.52.55 PM.png
    735.7 KB · Views: 61
Last edited:
Status
Not open for further replies.
Back
Top