Contribute
Register

[Guide] How to patch DSDT for working battery status

Joined
Dec 29, 2012
Messages
354
Motherboard
Dell XPS 18
CPU
Intel Core i3-3227U CPU @ 1.90GHz
Graphics
Intel HD Graphics 4000
Mac
Classic Mac
Mobile Phone
Dell XPS 18 - Is it possible?

I couldn't figure out how to get it to work. So I did a google search and downloaded the other version. I'll just have to remember to save a backup every time.

I did a search for method labels on each line I have to fix. Three of them appear under two different method labels. For instance, BFCP appears under BRCP and BIF2. B0ST appears under BSTS and BRCP, and B0MD appears under BIF0 and BIF3. do I need to do two separate "Into Method Label" lines for those?

I did one line for the first item in my list to patch:
Code:
into device label EC0 code_regex B0VL,\s+16, replace_matched begin VL00,8,VL01,8, end;
[\CODE]

so would the second part to that one be:
[CODE]
into method label BV0T code_regex \(\^^\PCI0\.LPCB\EC0\.B0VL, replace_matched begin (B1B2(^^PCI0.LPCB.EC0.VL00, ^^PCI0.LPCB.EC0.VL01), end;
[\CODE]

I looked at the patch you have loaded for the Dell XPS 13 to see how it's written. What I don't understand is where the ^^PCI0.LPCB.EC0.VL00 came from... I interchanged it from the one written... is this what comes from the Compile window?
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,123
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Dell XPS 18 - Is it possible?

I couldn't figure out how to get it to work. So I did a google search and downloaded the other version. I'll just have to remember to save a backup every time.
Couldn't get what to work?

I did a search for method labels on each line I have to fix. Three of them appear under two different method labels. For instance, BFCP appears under BRCP and BIF2. B0ST appears under BSTS and BRCP, and B0MD appears under BIF0 and BIF3. do I need to do two separate "Into Method Label" lines for those?
Yes.

I did one line for the first item in my list to patch:
Code:
into device label EC0 code_regex B0VL,\s+16, replace_matched begin VL00,8,VL01,8, end;
so would the second part to that one be:
Code:
into method label BV0T code_regex \(\^^\PCI0\.LPCB\EC0\.B0VL, replace_matched begin (B1B2(^^PCI0.LPCB.EC0.VL00, ^^PCI0.LPCB.EC0.VL01), end;
The code at BVOT (note it is BVOT, not BV0T) that needs changing is:
Code:
                    Store (B0VL, Local0)
So the patch would be:
Code:
into method label BVOT code_regex \(B0VL, replace_matched begin (B1B2(VL00,VL01), end;
BTW, if you do run into some code that uses the parent-scope-specifier '^' you have to escape both of them. This is because ^ has special meaning in a regex (it means roughly NOT) and we do not want that special meaning, so we have to escape both (\^\^\). Where you wrote '\(\^^\PCI0\.LPCB\EC0\.B0VL' you probably meant '\(\^\^PCI0\.LPCB\.EC0\.B0VL', so pay attention to what you're escaping.

I looked at the patch you have loaded for the Dell XPS 13 to see how it's written. What I don't understand is where the ^^PCI0.LPCB.EC0.VL00 came from... I interchanged it from the one written... is this what comes from the Compile window?
It depends on how the original code was written. If the EC field was referred to by ^^PCI0.LPCB.EC0.B0VL, then you need to include the "path" to the new variables just like the path was included to the old variables.
 
Joined
Dec 29, 2012
Messages
354
Motherboard
Dell XPS 18
CPU
Intel Core i3-3227U CPU @ 1.90GHz
Graphics
Intel HD Graphics 4000
Mac
Classic Mac
Mobile Phone
Dell XPS 18 - Is it possible?

Couldn't get what to work?
I couldn't figure out how to get your version of MaciASL to work.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,123
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Dell XPS 18 - Is it possible?

I couldn't figure out how to get your version of MaciASL to work.
It is the same as any other app. You extract it from the ZIP and double click on MaciASL.app.
 
Joined
Dec 29, 2012
Messages
354
Motherboard
Dell XPS 18
CPU
Intel Core i3-3227U CPU @ 1.90GHz
Graphics
Intel HD Graphics 4000
Mac
Classic Mac
Mobile Phone
Dell XPS 18 - Is it possible?

It is the same as any other app. You extract it from the ZIP and double click on MaciASL.app.
Did you have to install the original MaciASL.app first? I extracted everything, but It didn't give me a MaciASL.app file.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,123
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Dell XPS 18 - Is it possible?

Did you have to install the original MaciASL.app first? I extracted everything, but It didn't give me a MaciASL.app file.
You probably downloaded the wrong thing (source code?).

Always be sure to read the README (which identifies the download location for builds). We write READMEs so people will read them.

BTW, I will probably move some of these battery patching messages to the actual battery patch guide/thread, as the discussion may be useful for others.
 
Joined
Dec 29, 2012
Messages
354
Motherboard
Dell XPS 18
CPU
Intel Core i3-3227U CPU @ 1.90GHz
Graphics
Intel HD Graphics 4000
Mac
Classic Mac
Mobile Phone
Dell XPS 18 - Is it possible?

BTW, I will probably move some of these battery patching messages to the actual battery patch guide/thread, as the discussion may be useful for others.
Noted. I've got a patch written. Haven't tested it out yet. Want to see if anything sticks out to you before I pull the trigger on adding it to my DSDT file. I think I'll wait until you move threads before I post it.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,123
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
How to patch DSDT for working battery status

Noted. I've got a patch written. Haven't tested it out yet. Want to see if anything sticks out to you before I pull the trigger on adding it to my DSDT file. I think I'll wait until you move threads before I post it.
I think I've got all the appropriate messages moved...
 
Joined
Dec 29, 2012
Messages
354
Motherboard
Dell XPS 18
CPU
Intel Core i3-3227U CPU @ 1.90GHz
Graphics
Intel HD Graphics 4000
Mac
Classic Mac
Mobile Phone
How to patch DSDT for working battery status

I think I've got all the appropriate messages moved...
OK. With that done, i'm posting the patch that i've got written out from my Dell XPS 18. If you don't see anything that strikes you as odd, I will run the patch through MaciASL and see if I get any resulting errors. Luckily, I've got a backup of the DSDT.aml saved so that if something goes horribly wrong, I can overwrite with the beginning. Once I'm where I can spend a little more time on it, I'll figure out how to install your version of MaciASL. It's still a little confusing...


Code:
[FONT=Helvetica]into method label B1B2 remove_entry;[/FONT]
[FONT=Helvetica]into definition block code_regex . insert[/FONT]
[FONT=Helvetica]begin[/FONT]
[FONT=Helvetica]Method (B1B2, 2, NotSerialized) { Return (Or (Arg0, ShiftLeft (Arg1, 8))) }\n[/FONT]
[FONT=Helvetica]end;[/FONT]
[FONT=Helvetica]
[/FONT]
[FONT=Helvetica]# 16-bit registers[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0VL,\s+16, replace_matched begin VL00,8,VL01,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0CC,\s+16, replace_matched begin CC01,8,CC02,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0RC,\s+16, replace_matched begin RC00,8,RC01,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BFCP,\s+16, replace_matched begin FCP0,8,FPC1,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0ST,\s+16, replace_matched begin ST00,8,ST01,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BDCP,\s+16, replace_matched begin DCP0,8,DCP1,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BDVL,\s+16, replace_matched begin DVL0,8,DVL1,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0MD,\s+16, replace_matched begin MD00,8,MD01,8, end;[/FONT]
[FONT=Helvetica]
[/FONT]
[FONT=Helvetica]
[/FONT]
[FONT=Helvetica]# fix 16-bit methods[/FONT]
[FONT=Helvetica]into method label BCRT code_regex \(B0CC, replace_matched begin (B1B2(CC01,CC022), end;[/FONT]
[FONT=Helvetica]into method label BIF0 code_regex \(B0MD, replace_matched begin (B1B2(MD00, MD01), end;[/FONT]
[FONT=Helvetica]into method label BIF1 code_regex \(BDCP, replace_matched begin (B1B2(DCP0, DCP1), end;[/FONT]
[FONT=Helvetica]into method label BIF2 code_regex \(BFCP, replace_matched begin (B1B2(FCP1, FCP2), end;[/FONT]
[FONT=Helvetica]into method label BIF3 code_regex \(B0MD, replace_matched begin (B1B2(MD00, MD01), end;[/FONT]
[FONT=Helvetica]into method label BIF4 code_regex \(BDVL, replace_matched begin (B1B2(DVL0, DVL1), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(B0RC, replace_matched begin (B1B2(RC00, RC01), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(BFCP, replace_matched begin (B1B2(FCP1, FCP2), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(B0ST, replace_matched begin (B1B2(ST00, ST01), end;[/FONT]
[FONT=Helvetica]into method label BSTS code_regex \(B0ST, replace_matched begin (B1B2(ST00, ST01), end;[/FONT]
[FONT=Helvetica]into method label BV0T code_regex \(B0VL, replace_matched begin (B1B2(VL00,VL01), end;[/FONT]
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,123
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
How to patch DSDT for working battery status

OK. With that done, i'm posting the patch that i've got written out from my Dell XPS 18. If you don't see anything that strikes you as odd, I will run the patch through MaciASL and see if I get any resulting errors. Luckily, I've got a backup of the DSDT.aml saved so that if something goes horribly wrong, I can overwrite with the beginning. Once I'm where I can spend a little more time on it, I'll figure out how to install your version of MaciASL. It's still a little confusing...


Code:
[FONT=Helvetica]into method label B1B2 remove_entry;[/FONT]
[FONT=Helvetica]into definition block code_regex . insert[/FONT]
[FONT=Helvetica]begin[/FONT]
[FONT=Helvetica]Method (B1B2, 2, NotSerialized) { Return (Or (Arg0, ShiftLeft (Arg1, 8))) }\n[/FONT]
[FONT=Helvetica]end;[/FONT]
[FONT=Helvetica]
[/FONT]
[FONT=Helvetica]# 16-bit registers[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0VL,\s+16, replace_matched begin VL00,8,VL01,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0CC,\s+16, replace_matched begin CC01,8,CC02,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0RC,\s+16, replace_matched begin RC00,8,RC01,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BFCP,\s+16, replace_matched begin FCP0,8,FPC1,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0ST,\s+16, replace_matched begin ST00,8,ST01,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BDCP,\s+16, replace_matched begin DCP0,8,DCP1,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BDVL,\s+16, replace_matched begin DVL0,8,DVL1,8, end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex B0MD,\s+16, replace_matched begin MD00,8,MD01,8, end;[/FONT]
[FONT=Helvetica]
[/FONT]
[FONT=Helvetica]
[/FONT]
[FONT=Helvetica]# fix 16-bit methods[/FONT]
[FONT=Helvetica]into method label BCRT code_regex \(B0CC, replace_matched begin (B1B2(CC01,CC022), end;[/FONT]
[FONT=Helvetica]into method label BIF0 code_regex \(B0MD, replace_matched begin (B1B2(MD00, MD01), end;[/FONT]
[FONT=Helvetica]into method label BIF1 code_regex \(BDCP, replace_matched begin (B1B2(DCP0, DCP1), end;[/FONT]
[FONT=Helvetica]into method label BIF2 code_regex \(BFCP, replace_matched begin (B1B2(FCP1, FCP2), end;[/FONT]
[FONT=Helvetica]into method label BIF3 code_regex \(B0MD, replace_matched begin (B1B2(MD00, MD01), end;[/FONT]
[FONT=Helvetica]into method label BIF4 code_regex \(BDVL, replace_matched begin (B1B2(DVL0, DVL1), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(B0RC, replace_matched begin (B1B2(RC00, RC01), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(BFCP, replace_matched begin (B1B2(FCP1, FCP2), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(B0ST, replace_matched begin (B1B2(ST00, ST01), end;[/FONT]
[FONT=Helvetica]into method label BSTS code_regex \(B0ST, replace_matched begin (B1B2(ST00, ST01), end;[/FONT]
[FONT=Helvetica]into method label BV0T code_regex \(B0VL, replace_matched begin (B1B2(VL00,VL01), end;[/FONT]
There are errors, so give it a go and see how many you can fix...
 
Top