Contribute
Register

[Guide] How to patch DSDT for working battery status

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...

I think you might have forgot to install the battery kext.
 
How to patch DSDT for working battery status

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.

I added your patches to the laptop DSDT patch repo...
 
How to patch DSDT for working battery status

I've been trying to create a battery DSDT patch for my Toshiba L850 laptop and I couldn't find any "EmbeddedControl" lines in my DSDT for battery, so I don't really know where to begin :S.

Have attached the original unpatched DSDT :)
 

Attachments

  • DSDT.aml.zip
    36.5 KB · Views: 170
How to patch DSDT for working battery status

I've been trying to create a battery DSDT patch for my Toshiba L850 laptop and I couldn't find any "EmbeddedControl" lines in my DSDT for battery, so I don't really know where to begin :S.

Have attached the original unpatched DSDT :)

If you have no "EmbeddedControl" "OperationRegions" in your DSDT, then you do not need to patch your DSDT, at least not for multi-byte EC access. ACPIBatteryManager.kext should work for your battery status without DSDT edits. If it doesn't it is for other reasons.
 
Mavericks only boots in Safe mode

Your DSDT needs battery patches. Your patches will be super easy as there are only six 16-bit registers to convert. .

Thanks for the link.

I created a patch for my laptop DSDT (Gigabyte U2442N Ultrabook) and it seems to work.

The patch is attached, if you want to add it to your list.

Thanks.
 

Attachments

  • battery patch for u2442N.txt
    1.6 KB · Views: 246
How to patch DSDT for working battery status

Thanks for the link.

I created a patch for my laptop DSDT (Gigabyte U2442N Ultrabook) and it seems to work.

The patch is attached, if you want to add it to your list.

Thanks.

Congratulations. I will add your patch to the laptop patch repo.
 
How to patch DSDT for working battery status

I'm working to patch my xps l502x. i seem to be have difficulty


I think I only have 16 bit to worry about here is my patch
Code:
[FONT=Helvetica]# 16-bit registers[/FONT]
[FONT=Helvetica]into device label EC0 code_regex CAP0,\s+16 replace_matched begin AP00,8,AP01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex VOT0,\s+16 replace_matched begin OT00,8,OT01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex CRT0,\s+16 replace_matched begin RT00,8,RT01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex FCP0,\s+16 replace_matched begin CP00,8,CP01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex DCP0,\s+16 replace_matched begin DP00,8,DP01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex DVT0,\s+16 replace_matched begin VT00,8,VT01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BSN0,\s+16 replace_matched begin SN00,8,SN01,8 end;[/FONT]
[FONT=Helvetica]# fix 16-bit methods[/FONT]
[FONT=Helvetica]into method label _BST code_regex \CAP0, replaceall_matched begin (B1B2(AP00,AP01), end;[/FONT]
[FONT=Helvetica]into method label _BST code_regex \VOT0, replaceall_matched begin (B1B2(OT00,OT01), end;[/FONT]
[FONT=Helvetica]into method label _BST code_regex \CRT0, replaceall_matched begin (B1B2(RT00,RT01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \FCP0, replaceall_matched begin (B1B2(CP00,CP01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \DCP0, replaceall_matched begin (B1B2(DP00,DP01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \DVT0, replaceall_matched begin (B1B2(VT00,VT01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \BSN0, replaceall_matched begin (B1B2(SN00,SN01), end;[/FONT]

I can't compile it, what am I doing wrong?

Thank you for this post. I'm not a big poster, but i wanted to say this has been very helpful

attached dsdtView attachment dsdt.aml.zip
 
How to patch DSDT for working battery status

I'm working to patch my xps l502x. i seem to be have difficulty


I think I only have 16 bit to worry about here is my patch
Code:
[FONT=Helvetica]# 16-bit registers[/FONT]
[FONT=Helvetica]into device label EC0 code_regex CAP0,\s+16 replace_matched begin AP00,8,AP01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex VOT0,\s+16 replace_matched begin OT00,8,OT01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex CRT0,\s+16 replace_matched begin RT00,8,RT01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex FCP0,\s+16 replace_matched begin CP00,8,CP01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex DCP0,\s+16 replace_matched begin DP00,8,DP01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex DVT0,\s+16 replace_matched begin VT00,8,VT01,8 end;[/FONT]
[FONT=Helvetica]into device label EC0 code_regex BSN0,\s+16 replace_matched begin SN00,8,SN01,8 end;[/FONT]
[FONT=Helvetica]# fix 16-bit methods[/FONT]
[FONT=Helvetica]into method label _BST code_regex \CAP0, replaceall_matched begin (B1B2(AP00,AP01), end;[/FONT]
[FONT=Helvetica]into method label _BST code_regex \VOT0, replaceall_matched begin (B1B2(OT00,OT01), end;[/FONT]
[FONT=Helvetica]into method label _BST code_regex \CRT0, replaceall_matched begin (B1B2(RT00,RT01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \FCP0, replaceall_matched begin (B1B2(CP00,CP01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \DCP0, replaceall_matched begin (B1B2(DP00,DP01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \DVT0, replaceall_matched begin (B1B2(VT00,VT01), end;[/FONT]
[FONT=Helvetica]into method label _BIF code_regex \BSN0, replaceall_matched begin (B1B2(SN00,SN01), end;[/FONT]

I can't compile it, what am I doing wrong?

Thank you for this post. I'm not a big poster, but i wanted to say this has been very helpful

attached dsdtView attachment 75208


OK, first of all your DSDT has an error that you should correct even before you start:
Code:
// at line 8139 in native DSDT, remove these 4 lines
                            Arg0
                            Arg1
                            Arg2
                            Arg3

Then onto your patches.... Let's just look at this one:
Code:
into method label _BST code_regex \CAP0, replaceall_matched begin (B1B2(AP00,AP01), end;

What you should have is:
Code:
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.CAP0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.AP00,^^PCI0.LPCB.EC0.AP01), end;

With that hint, I'll let you fix the others...

And, of course, you need the B1B2 method:
Code:
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\n
end;
 
How to patch DSDT for working battery status

Honestly I didn't even look at the dsdt after i extracted it... I'm an idiot

I'm nowhere near where i thought.

Thank you
 
How to patch DSDT for working battery status

I have tried it on a few dsdt's no errors

Code:
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\n
end;# 16-bit registers
into device label EC0 code_regex CAP0,\s+16 replace_matched begin AP00,8,AP01,8 end;
into device label EC0 code_regex VOT0,\s+16 replace_matched begin OT00,8,OT01,8 end;
into device label EC0 code_regex CRT0,\s+16 replace_matched begin RT00,8,RT01,8 end;
into device label EC0 code_regex FCP0,\s+16 replace_matched begin CP00,8,CP01,8 end;
into device label EC0 code_regex DCP0,\s+16 replace_matched begin DP00,8,DP01,8 end;
into device label EC0 code_regex DVT0,\s+16 replace_matched begin VT00,8,VT01,8 end;
into device label EC0 code_regex BSN0,\s+16 replace_matched begin SN00,8,SN01,8 end;
# fix 16-bit methods
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.CAP0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.AP00,^^PCI0.LPCB.EC0.AP01), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.VOT0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.OT00,^^PCI0.LPCB.EC0.OT01), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.CRT0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.RT00,^^PCI0.LPCB.EC0.RT01), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.DCP0, replace_matched begin (B1B2(^^PCI0.LPCB.EC0.DP00,^^PCI0.LPCB.EC0.DP01), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.FCP0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.CP00,^^PCI0.LPCB.EC0.CP01), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.DVT0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.VT00,^^PCI0.LPCB.EC0.VT01), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.BSN0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.SN00,^^PCI0.LPCB.EC0.SN01), end;

You are indeed the man...
 
Back
Top