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
Joined
Dec 25, 2010
Messages
7
Mac
MacBook Pro
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

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,929
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Sorry, my fault.
Nothing wrong here regarding battery status. It is working. You're running Sierra. Sierra does not show the remaining time. It is a feature, courtesy of the folks in Cupertino.

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...
You did not implement power management.
 
Joined
Feb 15, 2016
Messages
82
Motherboard
Asus X550LB
CPU
i5 4200U
Graphics
HD 4400
Mobile Phone
iOS
My battery status is moving really slow down (100 to 99 in like 15 minutes, which I don't believe is fine). It also shows 0:25 minutes remaining. The battery icon is also red. I used the Asus N55SL which worked for me last time, I believe.

Terminal output:

Code:
Josips-MacBook-Pro:~ josip$ kextstat|grep -y acpiplat

   13    2 0xffffff7f82bb8000 0x66000    0x66000    com.apple.driver.AppleACPIPlatform (4.0) A29C7512-D3A8-3AED-9721-3A5FF1A32EB2 <12 11 7 6 5 4 3 1>

Josips-MacBook-Pro:~ josip$ kextstat|grep -y appleintelcpu

Josips-MacBook-Pro:~ josip$ kextstat|grep -y applelpc

  103    0 0xffffff7f825da000 0x3000     0x3000     com.apple.driver.AppleLPC (3.1) 32BDCF9F-0473-32D4-9DAE-F523EFB2D244 <92 12 5 4 3>

Josips-MacBook-Pro:~ josip$ sudo touch /System/Library/Extensions && sudo kextcache -u /

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext IntelBacklight.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Intel_HD_Graphics.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Broadcom_WiFi.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext CodecCommander.kext

kext-dev-mode allowing invalid signature -67030 0xFFFFFFFFFFFEFA2A for kext AppleHDAHardwareConfigDriver.kext

kext-dev-mode allowing invalid signature -67061 0xFFFFFFFFFFFEFA0B for kext AppleHDA.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBatteryManager.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBacklight.kext

Josips-MacBook-Pro:~ josip$
 

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
My battery status is moving really slow down (100 to 99 in like 15 minutes, which I don't believe is fine). It also shows 0:25 minutes remaining. The battery icon is also red. I used the Asus N55SL which worked for me last time, I believe.

Terminal output:

Code:
Josips-MacBook-Pro:~ josip$ kextstat|grep -y acpiplat

   13    2 0xffffff7f82bb8000 0x66000    0x66000    com.apple.driver.AppleACPIPlatform (4.0) A29C7512-D3A8-3AED-9721-3A5FF1A32EB2 <12 11 7 6 5 4 3 1>

Josips-MacBook-Pro:~ josip$ kextstat|grep -y appleintelcpu

Josips-MacBook-Pro:~ josip$ kextstat|grep -y applelpc

  103    0 0xffffff7f825da000 0x3000     0x3000     com.apple.driver.AppleLPC (3.1) 32BDCF9F-0473-32D4-9DAE-F523EFB2D244 <92 12 5 4 3>

Josips-MacBook-Pro:~ josip$ sudo touch /System/Library/Extensions && sudo kextcache -u /

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext IntelBacklight.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Intel_HD_Graphics.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Broadcom_WiFi.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext CodecCommander.kext

kext-dev-mode allowing invalid signature -67030 0xFFFFFFFFFFFEFA2A for kext AppleHDAHardwareConfigDriver.kext

kext-dev-mode allowing invalid signature -67061 0xFFFFFFFFFFFEFA0B for kext AppleHDA.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBatteryManager.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBacklight.kext

Josips-MacBook-Pro:~ josip$
There is evidence in your patched files that you used a buggy version of iasl (and you're affected by the bugs).
Build the "last known good" version of iasl as per ACPI patching guide and use that one instead (re-extract, re-patch).

(I will probably update the pre-built iasl soon)

Also, your previous mistakes probably put the EC into a bad state. Do an EC reset.
 
Joined
Feb 15, 2016
Messages
82
Motherboard
Asus X550LB
CPU
i5 4200U
Graphics
HD 4400
Mobile Phone
iOS
There is evidence in your patched files that you used a buggy version of iasl (and you're affected by the bugs).
Build the "last known good" version of iasl as per ACPI patching guide and use that one instead (re-extract, re-patch).

(I will probably update the pre-built iasl soon)

Also, your previous mistakes probably put the EC into a bad state. Do an EC reset.
I used the 6.1 version you provided on your Bitbucket, and I'm not sure what other version you mean and I read the #1 post from the APCI patching guide. Did you mean the 5.1 version, also from your Bitbucket?
 

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 used the 6.1 version you provided on your Bitbucket, and I'm not sure what other version you mean and I read the #1 post from the APCI patching guide. Did you mean the 5.1 version, also from your Bitbucket?
There is instructions in the guide for building a specific version of iasl from source.
 
Joined
Oct 15, 2015
Messages
137
Motherboard
X550JK
CPU
i5-4200H/HM86 Clover
Graphics
Intel HD Graphics 4600,1920*1080
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;
Thanks.You correct a new wrong.But in fact,I only correct the HWAK Read and Write.
 
Joined
Feb 15, 2016
Messages
82
Motherboard
Asus X550LB
CPU
i5 4200U
Graphics
HD 4400
Mobile Phone
iOS
There is instructions in the guide for building a specific version of iasl from source.
I built the source from "b9c6c2b" commit and extracted using that one. Also I did reset the EC, still nothing. Still screwed up. Shows 100% then randomly changes to 26% or something similar.

Also terminal output:
Code:
Josips-MacBook-Pro:~ josip$ kextstat|grep -y acpiplat

   13    2 0xffffff7f82bc5000 0x66000    0x66000    com.apple.driver.AppleACPIPlatform (4.0) A29C7512-D3A8-3AED-9721-3A5FF1A32EB2 <12 11 7 6 5 4 3 1>

Josips-MacBook-Pro:~ josip$ kextstat|grep -y appleintelcpu

Josips-MacBook-Pro:~ josip$ kextstat|grep -y applelpc

   82    0 0xffffff7f825da000 0x3000     0x3000     com.apple.driver.AppleLPC (3.1) 32BDCF9F-0473-32D4-9DAE-F523EFB2D244 <81 12 5 4 3>

Josips-MacBook-Pro:~ josip$ sudo touch /System/Library/Extensions && sudo kextcache -u /

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext IntelBacklight.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Intel_HD_Graphics.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Broadcom_WiFi.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext CodecCommander.kext

kext-dev-mode allowing invalid signature -67030 0xFFFFFFFFFFFEFA2A for kext AppleHDA.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBatteryManager.kext

kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBacklight.kext
 

Attachments

Top