Contribute
Register

[Guide] How to patch DSDT for working battery status

I was indeed following the guide. But failed in the iasl step.

Read it carefully. Sounds to me like you are doing one of two things wrong:
- failing to eliminate duplicate SSDTs
- disassembling files that do not start with DSDT or SSDT

Also, you cannot reliably use patchmatic to extract native ACPI files as they may have been modified by Clover. Use Clover F4 to extract. Eliminate all files not DSDT or SSDT. Eliminate duplicate SSDTs. Then disassemble all the remaining files with refs.txt as per guide.

FYI: I had no issue disassembling your files in CLOVER.ZIP (ACPI/origin) that you provided in post #3518.
I used: iasl -da -dl -fe refs.txt DSDT.aml SSDT*.aml
 
Read it carefully. Sounds to me like you are doing one of two things wrong:
- failing to eliminate duplicate SSDTs
- disassembling files that do not start with DSDT or SSDT

Also, you cannot reliably use patchmatic to extract native ACPI files as they may have been modified by Clover. Use Clover F4 to extract. Eliminate all files not DSDT or SSDT. Eliminate duplicate SSDTs. Then disassemble all the remaining files with refs.txt as per guide.

FYI: I had no issue disassembling your files in CLOVER.ZIP (ACPI/origin) that you provided in post #3518.
I used: iasl -da -dl -fe refs.txt DSDT.aml SSDT*.aml

Yeah... I don't have the code snippet you pasted (_REG method) in DSDT.dsl extracted from the ACPI/origin...
 
Yeah... I don't have the code snippet you pasted (_REG method) in DSDT.dsl extracted from the ACPI/origin...

Of course not.
It is something you moved from _OFF and/or SGOF from one of the SSDTs as part of the guide for disabling the discrete GPU.
But you did it incorrectly.
 
The patch battery_Lenovo-Yoga-S1 causes some typos for Lenovo S1 Yoga. So I modify it.
 

Attachments

  • battery_Lenovo-Yoga-S1.txt
    4.3 KB · Views: 154
  • DSDT-origin.dsl
    480.3 KB · Views: 147
  • DSDT-patched.dsl
    482 KB · Views: 115
The patch battery_Lenovo-Yoga-S1 causes some typos for Lenovo S1 Yoga. So I modify it.

I don't see any errors after applying the existing "Lenovo Yoga S1" patch to the DSDT-origin.dsl you attached here.

Note: I don't know why those two patches were created in the section marked "# Commenting out string data"
 
I don't see any errors after applying the existing "Lenovo Yoga S1" patch to the DSDT-origin.dsl you attached here.

Note: I don't know why those two patches were created in the section marked "# Commenting out string data"

after applying patch
B193848E-AEB9-42B8-9C5A-FEBAAB2A92BF.jpg



before applying patch

.jpg


So I change patch.

Code:
# Fix HWAK Read
into device label EC0 code_regex HWAK,\s+16 replace_matched begin WAK0,8,WAK1,8 end;
into method label _WAK code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
into method label _L0F code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
into method label BL0F code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;

#Fix HWAK Write

into method label _WAK code_regex Store\s\(Local0,\s\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin Store (ShiftRight(Local0,8),\\_SB.PCI0.LPCB.EC0.WAK0)\nStore (Local0,\\_SB.PCI0.LPCB.EC0.WAK1 end;
 
after applying patch
View attachment 229923


before applying patch

View attachment 229924

So I change patch.

Code:
# Fix HWAK Read
into device label EC0 code_regex HWAK,\s+16 replace_matched begin WAK0,8,WAK1,8 end;
into method label _WAK code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
into method label _L0F code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
into method label BL0F code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;

#Fix HWAK Write

into method label _WAK code_regex Store\s\(Local0,\s\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin Store (ShiftRight(Local0,8),\\_SB.PCI0.LPCB.EC0.WAK0)\nStore (Local0,\\_SB.PCI0.LPCB.EC0.WAK1 end;

My iasl does not show an error there (that particular error has come and gone with iasl changes).
But the original patching of that code was indeed wrong.
But your proposal is also wrong. It is storing the MSB/LSB reversed.

Here is the correct diff:
Code:
diff --git a/battery/battery_Lenovo-Yoga-S1.txt b/battery/battery_Lenovo-Yoga-S1.txt
index 13a6465..a49c7f4 100644
--- a/battery/battery_Lenovo-Yoga-S1.txt
+++ b/battery/battery_Lenovo-Yoga-S1.txt
@@ -3,6 +3,7 @@

 # Created by stkov 2014-04-12
 # Modifications by akebono 2015-04-03
+# Fix for HWAK write by nayeweiyang 2017-01-12 (after corrections by RehabMan)

 # works for:
 #  Lenovo Yoga S1
@@ -87,9 +88,14 @@ into method label GBIF code_regex \(SBMN, replaceall_matched begin (RECB(0xA0, 1
 into method label GBIF code_regex Store\s\(B1B2\(BSN0 replace_matched begin /* Store (B1B2(BSN0 end;
 into method label GBIF code_regex Index\s\(Arg1,\s0x0C\)\) replace_matched begin Index (Arg1, 0x0C)) */ end;

-# Fix HWAK
+# Fix HWAK Read
 into device label EC0 code_regex HWAK,\s+16 replace_matched begin WAK0,8,WAK1,8 end;
-into method label _WAK code_regex \\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
-into method label _L0F code_regex \\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
-into method label BL0F code_regex \\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
+into method label _WAK code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
+into method label _L0F code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;
+into method label BL0F code_regex \(\\\_SB.PCI0.LPCB.EC0.HWAK replaceall_matched begin (B1B2(\\_SB.PCI0.LPCB.EC0.WAK0,\\_SB.PCI0.LPCB.EC0.WAK1) end;

+# Fix HWAK Write
+into method label _WAK code_regex Store\s\(Local0,\s\\\_SB.PCI0.LPCB.EC0.HWAK\) replaceall_matched
+begin
+Store (Local0,\\_SB.PCI0.LPCB.EC0.WAK0) Store (ShiftRight(Local0,8),\\_SB.PCI0.LPCB.EC0.WAK1)
+end;
 
Sorry, my fault.

P.S. This is not a correct topic for this but as all dumps are here maybe it's easier to ask here. Initially after booting sleep works well, but after some amount of time (maybe an hour or more) notebook doesn't power off completely entering sleep mode...
 

Attachments

  • MacBook Pro.ioreg.zip
    643.1 KB · Views: 91
  • RehabMan.zip
    50.3 KB · Views: 102
  • kextstat.txt
    455 bytes · Views: 181
  • kextcache.txt
    428 bytes · Views: 185
  • Clover.zip
    2.5 MB · Views: 98
Back
Top