Contribute
Register

<< Solved >> OpenCore battery patch

Status
Not open for further replies.
@BlvckBytes @rufus8472

So in our DSDT, this is apparently the method that needs to be patched to stop the DGPU from waking up upon sleep.


Code:
Method (RTEC, 0, NotSerialized)
{
    Store (YEAR, Local0)
    Store (FBC (Local0), RTYR)
    Store (MON, Local0)
    Store (FBC (Local0), RTMH)
    Store (DAY, Local0)
    Store (FBC (Local0), RTDY)
    Store (HOR, Local0)
    Store (FBC (Local0), RTHR)
    Store (MIN, Local0)
    Store (FBC (Local0), RTME)
}

What has been used with Clover and patching the DSDT directly is the following:

Code:
into method label RTEC replace_content begin
\n
end;

Super simple that keeps the DGPU off.

But this is where I'm still learning with making custom SSDT's for OpenCore. Where do we start with making that patch an SSDT that calls on that method to patch it? Maybe one of you can give me more insight than just me reading for the next few hours lol
 
@vettz500

Looks interesting, I'll check it out in approximately 2 hours, will post my results then. Nice that you started on it already! :)
 
@vettz500

Could you tell me, where you've found that method? I dug out my clover origin/ folder and performed the following command on it:

Code:
grep -i "RTEC" *.dsl

No results. But to answer your question on how to do it:
As far as I can tell, that patch just sets the method body to \n, which is an empty body. Thus, the result would be:

Code:
Method (RTEC, 0, NotSerialized)
{

}

If it would be in the DSDT, a simple RTEC to XTEC replace in combination with SSDT-RTEC, which contains just the empty method would do. But since I can't find this, it's hard to tell...
 
@vettz500

Could you tell me, where you've found that method? I dug out my clover origin/ folder and performed the following command on it:

Code:
grep -i "RTEC" *.dsl

No results. But to answer your question on how to do it:
As far as I can tell, that patch just sets the method body to \n, which is an empty body. Thus, the result would be:

Code:
Method (RTEC, 0, NotSerialized)
{

}

If it would be in the DSDT, a simple RTEC to XTEC replace in combination with SSDT-RTEC, which contains just the empty method would do. But since I can't find this, it's hard to tell...

That patch is for the early 2019 model of the Blade 15 and it's only purpose is to disable the dgpu after waking up from sleep. If I understand correctly yours will not turn off at all? If so then this won't do anything for you unfortunately :/

If your problem starts after waking from sleep and you don't have the RTEC method in your DSDT.dsl, then you could use Rehabmans ACPI debug to try and find the problem. I wrote about it over here.
 
@takki

I am able to turn it off, but it seems like it comes back after wake (getting hot and drawing power). Thank you for the provided link, I'll read up on that! :)
 
@takki

I am able to turn it off, but it seems like it comes back after wake (getting hot and drawing power). Thank you for the provided link, I'll read up on that! :)

Okay then you should be able to find out where things go wrong. Let me know if you have any questions. Don't liquid metal that thing too soon haha

I'm still on clover but I want to get into OC as well. There are still a couple of issues to fix on the clover side, but since I'll switch to OC eventually it probably doesn't make sense to perfect things. I fear that the trackpad of the early 2019 model will need more elaborate patching and I still need to read up on hot patching :shifty:
 
@yoannez

I worked on the SSDT, and I really gotta say... Implementing that RehabMan patch was a lot of work and confronted me with new topics. I don't believe I've implemented everything correctly... We need to find out together, I did my best.

You need to implement those renames in OC's config.plist:

Code:
STA to XSTA of BAT1
5F535441 00A040 to 58535441 00A040

_L17 to XL17 (generic, only appears once)
5F4C3137 to 584C3137

_WAK to XWAK (generic, only appears once)
5F57414B to 5857414B

GBST to XGBS (generic, only appears once)
47425354 to 58474253

GBIF to XGBF
47424946 to 58474246

The comments are just for better understanding, you can alter them, of course. Don't add any funny attributes like masks or count, just leave it vanilla and set: comment, search, replace.

I've attached the SSDT-BATT compiled and uncompiled, the uncompiled contains some comments that help me remember what I did.

Now, to the questions:
* You are able to have a proper battery with the patched DSDT, right? Using what kext, VirtualSMC + SMCBatteryManager or FakeSMC + ACPIBatteryManager?
* Are you able to boot with the new SSDT-BATT.aml loaded and the renames applied?
* Is any battery icon showing up? If so, any errors on it's behavior?

Also, when trying my SSDT, remove the patched DSDT.

If you have troubles adding SSDTs or search-replace renames to OC, please tell me. You need to implement this correctly for it to have any chance of working correctly. Also: CREATE A BACKUP, since this probably wont work, without debugging.
 

Attachments

  • SSDT-BATT.aml
    4.3 KB · Views: 88
  • SSDT-BATT.dsl
    19.5 KB · Views: 90
Okay then you should be able to find out where things go wrong. Let me know if you have any questions. Don't liquid metal that thing too soon haha

I'm still on clover but I want to get into OC as well. There are still a couple of issues to fix on the clover side, but since I'll switch to OC eventually it probably doesn't make sense to perfect things. I fear that the trackpad of the early 2019 model will need more elaborate patching and I still need to read up on hot patching :shifty:

I can help you with hotpatching the best I can, I've invested a few hours by now (more like days, lol). I know the basics and understand a bit of ASL. Why do you think the trackpad needs patching? Do you have a patch active right now? If so, could you post that?
 
@takki

That tool looks very promising, I think I might be able to find the issue that way. Also had a little look around the _WAK region, but it's like 3:40am here, I need to go to bed now.
 
@yoannez

I worked on the SSDT, and I really gotta say... Implementing that RehabMan patch was a lot of work and confronted me with new topics. I don't believe I've implemented everything correctly... We need to find out together, I did my best.

You need to implement those renames in OC's config.plist:

Code:
STA to XSTA of BAT1
5F535441 00A040 to 58535441 00A040

_L17 to XL17 (generic, only appears once)
5F4C3137 to 584C3137

_WAK to XWAK (generic, only appears once)
5F57414B to 5857414B

GBST to XGBS (generic, only appears once)
47425354 to 58474253

GBIF to XGBF
47424946 to 58474246

The comments are just for better understanding, you can alter them, of course. Don't add any funny attributes like masks or count, just leave it vanilla and set: comment, search, replace.

I've attached the SSDT-BATT compiled and uncompiled, the uncompiled contains some comments that help me remember what I did.

Now, to the questions:
* You are able to have a proper battery with the patched DSDT, right? Using what kext, VirtualSMC + SMCBatteryManager or FakeSMC + ACPIBatteryManager?
* Are you able to boot with the new SSDT-BATT.aml loaded and the renames applied?
* Is any battery icon showing up? If so, any errors on it's behavior?

Also, when trying my SSDT, remove the patched DSDT.

If you have troubles adding SSDTs or search-replace renames to OC, please tell me. You need to implement this correctly for it to have any chance of working correctly. Also: CREATE A BACKUP, since this probably wont work, without debugging.

AND!!! @BlvckBytes you are a genius! From what I can tell it worked like a charm! I followed your instructions, used the pre-compiled SSDT and made the OC edits. Battery working!
I'm using VirtualSMC + SMCBatteryManager.

Screen Shot 2020-04-29 at 6.03.17 pm.pngScreen Shot 2020-04-29 at 6.03.33 pm.png

Thank you soo much!!!
 
Status
Not open for further replies.
Back
Top