Contribute
Register

[Guide] How to patch DSDT for working battery status

How to patch DSDT for working battery status

There are errors, so give it a go and see how many you can fix...

are the errors in the first section by chance?
 
How to patch DSDT for working battery status

are the errors in the first section by chance?

There is one error in the first section. Several in the second section. And still more in the third section.

I should probably say, it is very close though!
 
How to patch DSDT for working battery status

There is one error in the first section. Several in the second section. And still more in the third section.

I should probably say, it is very close though!


Does the error in the first section have to do with spaces? I went back and looked at the original post and noticed a few differences in regards to the spaces.
 
How to patch DSDT for working battery status

Does the error in the first section have to do with spaces? I went back and looked at the original post and noticed a few differences in regards to the spaces.

Yes, it is 'definitionblock', not 'definition block'... Spaces are pretty important in computer languages because they are commonly used to separate tokens or keywords.
 
How to patch DSDT for working battery status

Yes, it is 'definitionblock', not 'definition block'... Spaces are pretty important in computer languages because they are commonly used to separate tokens or keywords.

All fixed now in section 1?

Code:
[FONT=Helvetica]into method label B1B2 remove_entry;[/FONT]
[FONT=Helvetica]into definitionblock 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]
 
How to patch DSDT for working battery status

All fixed now in section 1?

Code:
[FONT=Helvetica]into method label B1B2 remove_entry;[/FONT]
[FONT=Helvetica]into definitionblock 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]

Yes... it was just the definitionblock thing, which cause the patch parser to throw the whole patch away.

For the utility methods, it is best to just copy/paste mine from the OP.
 
How to patch DSDT for working battery status

So is one of the errors in the last section the "replace_Matched" needing to be "replace all_matched"?
 
How to patch DSDT for working battery status

So is one of the errors in the last section the "replace_Matched" needing to be "replace all_matched"?

That's one. And it is replace_matched -> replaceall_matched. replace_matched only replaces the first occurrence of the pattern, where replaceall_matched replaces all occurrences.

Just take each error that comes from the compiler and analyse why the code hasn't changed as you expected to, or why it has been changed incorrectly.
 
How to patch DSDT for working battery status

That's one. And it is replace_matched -> replaceall_matched. replace_matched only replaces the first occurrence of the pattern, where replaceall_matched replaces all occurrences.

Just take each error that comes from the compiler and analyse why the code hasn't changed as you expected to, or why it has been changed incorrectly.


OK. I applied the following patch. I went back through it with the original post on this thread and fixed what I noticed that stood out (mainly commas and spaces).

Code:
[FONT=Helvetica]into method label B1B2 remove_entry;[/FONT]
[FONT=Helvetica]into definitionblock 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,FCP1,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, replaceall_matched begin (B1B2(CC01,CC02), end;[/FONT]
[FONT=Helvetica]into method label BIF0 code_regex \(B0MD, replaceall_matched begin (B1B2(MD00,MD01), end;[/FONT]
[FONT=Helvetica]into method label BIF1 code_regex \(BDCP, replaceall_matched begin (B1B2(DCP0,DCP1), end;[/FONT]
[FONT=Helvetica]into method label BIF2 code_regex \(BFCP, replaceall_matched begin (B1B2(FCP0,FCP1), end;[/FONT]
[FONT=Helvetica]into method label BIF3 code_regex \(B0MD, replaceall_matched begin (B1B2(MD00,MD01), end;[/FONT]
[FONT=Helvetica]into method label BIF4 code_regex \(BDVL, replaceall_matched begin (B1B2(DVL0,DVL1), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(B0RC, replaceall_matched begin (B1B2(RC00,RC01), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(BFCP, replaceall_matched begin (B1B2(FCP0,FCP1), end;[/FONT]
[FONT=Helvetica]into method label BRCP code_regex \(B0ST, replaceall_matched begin (B1B2(ST00,ST01), end;[/FONT]
[FONT=Helvetica]into method label BSTS code_regex \(B0ST, replaceall_matched begin (B1B2(ST00,ST01), end;[/FONT]
[FONT=Helvetica]into method label BVOT code_regex \(B0VL, replaceall_matched begin (B1B2(VL00,VL01), end;[/FONT]

:thumbup: I received no red flags, so I believe everything checks out! The FCP0 and FCP1 were royally screwed up in what I had before. Also, I had some spaces and commas added that didn't need to be there. I guess I'm going to reboot to see if the battery status will work now. *Crosses Fingers*

This wasn't as hard as it looked when I began. I'm glad I jumped in and started tinkering with this. It was actually fun.
 
How to patch DSDT for working battery status

Ok. Rebooted just fine with no Kernel panics so that's good. However, When I go to check off "Show battery status in menu bar" it doesn't work, and unchecked itself, though I do notice a bit of movement in the status bar where it would go, but it disappears when it unchecked itself.

Somehow I feel as if I may be missing something still...
 
Back
Top