Contribute
Register

[Guide] How to patch DSDT for working battery status

Hi apologies if my understanding of this is a little bit naive but after following your guide and a few of the examples I came up with the attached patch, which, when I try to apply it to my working dsdt.aml throws up all kind of errors so I'm thinking I've done something wrong which may or may not be glaringly obvious?

Can I please ask you to have a look to see what I have done wrong?

From what I could gather I only have 16bit entries to worry about which I have tried to address in the patch.His is from my second hacintosh a Sony Vaio that I have upgraded several components for including the 32 bit processor to a 64 bit to allow me to install Lion.

As it is my second hac I haven't got it's specs in my signature so here they are:

http://www.tonymacx86.com/lion-laptop-support/187143-sony-vaio-sz-1xp.html#post1216053

The battery patch is really the last necessary fix I need so I would greatly value your help on this.

Many thanks!

None of your patches apply as your EC is named EC0 not H_EC.

Patches to registers should be:
Code:
#Convert 16 bit to 8 bit registers
into device label EC0 code_regex B1AB,\s+16, replace_matched begin B1A0,8, B1A1,8, end;
into device label EC0 code_regex B1AC,\s+16, replace_matched begin B1B0,8, B1B1,8, end;
into device label EC0 code_regex BIVO,\s+16, replace_matched begin B1V0,8, B1V1,8, end;
into device label EC0 code_regex B1DC,\s+16, replace_matched begin B1D0,8, B1D1,8, end;
into device label EC0 code_regex B1LF,\s+16, replace_matched begin B1L0,8, B1L1,8, end;
into device label EC0 code_regex B1DV,\s+16, replace_matched begin B1Z0,8, B1Z1,8, end;    
into device label EC0 code_regex A1TP,\s+16, replace_matched begin A1T0,8, A1T1,8, end;
into device label EC0 code_regex A1PT,\s+16, replace_matched begin A1P0,8, A1P1,8, end;
into device label EC0 code_regex A1CT,\s+16, replace_matched begin A1C0,8, A1C1,8, end;

Note: You might want to change how you rename them...
For example, I would do
B1AB->BAB0,BAB1
B1AC->BAC0,BAC1
B1VO->BVO0,BVO1 (note error in your patch 'I' vs. '1' in B1VO)
etc.

Reason being you want unique names here that are different than the original, but derived from the original via a pattern. Since they all share 'B1' you can eliminate the '1' from the name and put the byte number at the end.

And the other patches:
Code:
#Fix 16 bit registers
into method label B1AB code_regex \(B1AY, replaceall_matched begin (B1B2(B1A0,B1A1), end;
into method label B1AC code_regex \(B1AZ, replaceall_matched begin (B1B2(B1B0,B1B1), end;
into method label B1VO code_regex \(B1VZ, replaceall_matched begin (B1B2(B1V0,B1V1), end;
into method label B1DC code_regex \(B1DY, replaceall_matched begin (B1B2(B1D0,B1D1), end;
into method label B1LF code_regex \(B1LZ, replaceall_matched begin (B1B2(B1L0,B1L1), end;
into method label B1DV code_regex \(B1DZ, replaceall_matched begin (B1B2(B1Z0,B1Z1), end;
into method label A1TP code_regex \(A1TZ, replaceall_matched begin (B1B2(A1T0,A1T1), end;
into method label A1PT code_regex \(A1PZ, replaceall_matched begin (B1B2(A1P0,A1P1), end;
into method label A1CT code_regex \(A1CZ, replaceall_matched begin (B1B2(A1C0,A1C1), end;

...Are clearly wrong...

B1AB, B1AC/etc are not methods. You need to find the methods that the code appears in. The compiler will point them out after success with changing the register names.
 
Very many thanks for your lightening quick response on this!
I will try to make the changes you suggested tomorrow.
Cheers!


None of your patches apply as your EC is named EC0 not H_EC.

Patches to registers should be:
Code:
#Convert 16 bit to 8 bit registers
into device label EC0 code_regex B1AB,\s+16, replace_matched begin B1A0,8, B1A1,8, end;
into device label EC0 code_regex B1AC,\s+16, replace_matched begin B1B0,8, B1B1,8, end;
into device label EC0 code_regex BIVO,\s+16, replace_matched begin B1V0,8, B1V1,8, end;
into device label EC0 code_regex B1DC,\s+16, replace_matched begin B1D0,8, B1D1,8, end;
into device label EC0 code_regex B1LF,\s+16, replace_matched begin B1L0,8, B1L1,8, end;
into device label EC0 code_regex B1DV,\s+16, replace_matched begin B1Z0,8, B1Z1,8, end;    
into device label EC0 code_regex A1TP,\s+16, replace_matched begin A1T0,8, A1T1,8, end;
into device label EC0 code_regex A1PT,\s+16, replace_matched begin A1P0,8, A1P1,8, end;
into device label EC0 code_regex A1CT,\s+16, replace_matched begin A1C0,8, A1C1,8, end;

Note: You might want to change how you rename them...
For example, I would do
B1AB->BAB0,BAB1
B1AC->BAC0,BAC1
B1VO->BVO0,BVO1 (note error in your patch 'I' vs. '1' in B1VO)
etc.

Reason being you want unique names here that are different than the original, but derived from the original via a pattern. Since they all share 'B1' you can eliminate the '1' from the name and put the byte number at the end.

And the other patches:
Code:
#Fix 16 bit registers
into method label B1AB code_regex \(B1AY, replaceall_matched begin (B1B2(B1A0,B1A1), end;
into method label B1AC code_regex \(B1AZ, replaceall_matched begin (B1B2(B1B0,B1B1), end;
into method label B1VO code_regex \(B1VZ, replaceall_matched begin (B1B2(B1V0,B1V1), end;
into method label B1DC code_regex \(B1DY, replaceall_matched begin (B1B2(B1D0,B1D1), end;
into method label B1LF code_regex \(B1LZ, replaceall_matched begin (B1B2(B1L0,B1L1), end;
into method label B1DV code_regex \(B1DZ, replaceall_matched begin (B1B2(B1Z0,B1Z1), end;
into method label A1TP code_regex \(A1TZ, replaceall_matched begin (B1B2(A1T0,A1T1), end;
into method label A1PT code_regex \(A1PZ, replaceall_matched begin (B1B2(A1P0,A1P1), end;
into method label A1CT code_regex \(A1CZ, replaceall_matched begin (B1B2(A1C0,A1C1), end;

...Are clearly wrong...

B1AB, B1AC/etc are not methods. You need to find the methods that the code appears in. The compiler will point them out after success with changing the register names.
 
Your DSDT is not patched correctly (in ACPI/patched). It appears to have come from a different computer, or the same computer with a different BIOS/hardware configuration. The SystemMemory addresses don't match.

Re-patch based on fresh extract.

Also, it is not clear you used the correct patch. Follow the guide in post #1. Make sure you fill out your profile correctly.

The "HP G6 2221ss" patch may be a match.

Dank, after fresh extract everything works. Thanks man.
I use "HP-DV6-3165sf" instead and it works for cq42-263tu. Cheers!
 
Dank, after fresh extract everything works. Thanks man.
I use "HP-DV6-3165sf" instead and it works for cq42-263tu. Cheers!

Test "HP G6 2221ss" and report back.
 
Hi Rehabman

Successfully applied your battery_asus-n55sl patch to the dsdt of my Asus N550JK and I have a working battery level meter.

Many thanks!:headbang:
 
Apologies once again for my ignorance on this (I am trying to learn!) but I tried the changes you suggested so now my initial patch looks like this:

Code:
# 16-bit registersinto device label ECO code_regex B1AB,\s+16, replace_matched begin BAB0,8, BAB1,8, end;
into device label ECO code_regex B1AC,\s+16, replace_matched begin BAC0,8, BAC1,8, end;
into device label ECO code_regex B1VO,\s+16, replace_matched begin BVO0,8, BVO1,8, end;
into device label ECO code_regex B1DC,\s+16, replace_matched begin BDC0,8, BDC1,8, end;
into device label ECO code_regex B1LF,\s+16, replace_matched begin BLF0,8, BLF1,8, end;
into device label ECO code_regex B1DV,\s+16, replace_matched begin BDV0,8, BDV1,8, end;    
into device label ECO code_regex A1TP,\s+16, replace_matched begin ATP0,8, ATP1,8, end;
into device label ECO code_regex A1PT,\s+16, replace_matched begin APT0,8, APT1,8, end;
into device label ECO code_regex A1CT,\s+16, replace_matched begin ACT0,8, ACT1,8, end;

I went ahead and installed your version of maciasl to avoid the auto save problem and then loaded my DSDT, clicked on patch and pasted in the code above in the top section.

I was not given any apply option though (the button remained greyed out) and the only feedback I got was at the bottom:

"9 patches, 0 changes, 0 rejects"

I presume I am doing something wrong here?

I've been trying to follow along with some of the earlier examples in this thread but feel I'm making a dumb mistake here - should I be pasting my patch directly into the code or into the patch window like I am doing. If it is the latter, why am I not able to apply?

Many thanks for all advice.

Cheers!

None of your patches apply as your EC is named EC0 not H_EC.

Patches to registers should be:
Code:
#Convert 16 bit to 8 bit registers
into device label EC0 code_regex B1AB,\s+16, replace_matched begin B1A0,8, B1A1,8, end;
into device label EC0 code_regex B1AC,\s+16, replace_matched begin B1B0,8, B1B1,8, end;
into device label EC0 code_regex BIVO,\s+16, replace_matched begin B1V0,8, B1V1,8, end;
into device label EC0 code_regex B1DC,\s+16, replace_matched begin B1D0,8, B1D1,8, end;
into device label EC0 code_regex B1LF,\s+16, replace_matched begin B1L0,8, B1L1,8, end;
into device label EC0 code_regex B1DV,\s+16, replace_matched begin B1Z0,8, B1Z1,8, end;    
into device label EC0 code_regex A1TP,\s+16, replace_matched begin A1T0,8, A1T1,8, end;
into device label EC0 code_regex A1PT,\s+16, replace_matched begin A1P0,8, A1P1,8, end;
into device label EC0 code_regex A1CT,\s+16, replace_matched begin A1C0,8, A1C1,8, end;

Note: You might want to change how you rename them...
For example, I would do
B1AB->BAB0,BAB1
B1AC->BAC0,BAC1
B1VO->BVO0,BVO1 (note error in your patch 'I' vs. '1' in B1VO)
etc.

Reason being you want unique names here that are different than the original, but derived from the original via a pattern. Since they all share 'B1' you can eliminate the '1' from the name and put the byte number at the end.

And the other patches:
Code:
#Fix 16 bit registers
into method label B1AB code_regex \(B1AY, replaceall_matched begin (B1B2(B1A0,B1A1), end;
into method label B1AC code_regex \(B1AZ, replaceall_matched begin (B1B2(B1B0,B1B1), end;
into method label B1VO code_regex \(B1VZ, replaceall_matched begin (B1B2(B1V0,B1V1), end;
into method label B1DC code_regex \(B1DY, replaceall_matched begin (B1B2(B1D0,B1D1), end;
into method label B1LF code_regex \(B1LZ, replaceall_matched begin (B1B2(B1L0,B1L1), end;
into method label B1DV code_regex \(B1DZ, replaceall_matched begin (B1B2(B1Z0,B1Z1), end;
into method label A1TP code_regex \(A1TZ, replaceall_matched begin (B1B2(A1T0,A1T1), end;
into method label A1PT code_regex \(A1PZ, replaceall_matched begin (B1B2(A1P0,A1P1), end;
into method label A1CT code_regex \(A1CZ, replaceall_matched begin (B1B2(A1C0,A1C1), end;

...Are clearly wrong...

B1AB, B1AC/etc are not methods. You need to find the methods that the code appears in. The compiler will point them out after success with changing the register names.
 
I presume I am doing something wrong here?

ECO is not the same thing as EC0.

Pay attention to zero vs. the letter O.

You must be very detail oriented to do this...
 
Hi Rehabman

Successfully applied your battery_asus-n55sl patch to the dsdt of my Asus N550JK and I have a working battery level meter.

Many thanks!:headbang:

I will add a comment to that effect... Thanks.
 
Following on, I ran my first patch and it worked, then tried a compile and got these errors:

1119, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1TP)
1132, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1TP)
1149, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1PT)
1181, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1CT)
4519, 4064, Object does not exist (B1DC)
4520, 4064, Object does not exist (B1LF)
4521, 4064, Object does not exist (B1DV)
4543, 4064, Object does not exist (B1VO)
4544, 4064, Object does not exist (B1AC)
4545, 4064, Object does not exist (B1AB)

Now if I'm right, are the method labels these:
(with the underscores after the errors?)


1119, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1TP) _TMP
1132, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1TP) _TMP
1149, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1PT) _PSV
1181, 4064, Object does not exist (\_SB.PCI0.LPCB.EC0.A1CT) _CRT
4519, 4064, Object does not exist (B1DC) _BIF
4520, 4064, Object does not exist (B1LF) _BIF
4521, 4064, Object does not exist (B1DV) _BIF
4543, 4064, Object does not exist (B1VO) _BST
4544, 4064, Object does not exist (B1AC) _BST
4545, 4064, Object does not exist (B1AB) _BST

If so then are my next patches along the lines of:


into method label _TMP code_regex \(A1TP, replaceall_matched begin (B1B2(ATP0,ATP1), end;

?

Thanks again.
 
Back
Top