Contribute
Register

[Guide] How to patch DSDT for working battery status

...
The next step is to transfer them to 8Bit pieces, so i do:
into device label H_EC code_regex B1RA,\s+16 replace_matched begin 1RA0,8,1RA1,8 end;
into device label H_EC code_regex B1PR,\s+16 replace_matched begin 1PR0,8,1PR1,8 end;
into device label H_EC code_regex B1VO,\s+16 replace_matched begin 1VO0,8,1VO1,8 end;
into device label H_EC code_regex B1DA,\s+16 replace_matched begin 1DA0,8,1DA1,8 end;
into device label H_EC code_regex B1DF,\s+16 replace_matched begin 1DF0,8,1DF1,8 end;
into device label H_EC code_regex B1DV,\s+16 replace_matched begin 1DV0,8,1DV1,8 end;
into device label H_EC code_regex B1DL,\s+16 replace_matched begin 1DL0,8,1DL1,8 end;

Identifiers cannot begin with a numeric character.
 
Thanks!!!

This trick indeed works ;)
 
Well, the battery % is working now. The DSDT wasn't loading due to a Clover boot options I had. Someone told me that when running a patched DSDT that I shouldn't apply any clover acpi patches. Which worked. That patchmatic sure is a handy tool to see what DSDT and SSDTs you actually are loading, not just what you think you are. The battery time remaining is a little jumpy but I think I need to read the threads about power management now and use that SSDTGenPR script again. This overtime @ work has been killing me with no much free time, but I spent the last 2 night reading about Clover boot options. Learning quiet a bit. I tell ya, A hackintosh desktop is a breeze if you have patience and can replace parts but the Hac laptop world is brutal! LOL. Anyway thanks for the help and the pointers on this stuff.
 
That patchmatic sure is a handy tool to see what DSDT and SSDTs you actually are loading, not just what you think you are.

Yes :)

but the Hac laptop world is brutal! LOL.

Definitely a lot more to learn with laptops...
 
Rehabman ... have been trying to follow your guide for battery but not able to compile dsdt ,
not confident in the patching i've got can you give me some guidance
Just battery to fix and i'm over the line.

this is what i've got so far.....

# 16-bit registers
into device label EC0 code_regex BSRC,\s+16 replace_matched begin SRC0,8,SRC1,8 end;
into device label EC0 code_regex BSFC,\s+16 replace_matched begin SFC0,8,SFC1,8 end;
into device label EC0 code_regex BSAC,\s+16 replace_matched begin SAC0,8,SAC1,8 end;
into device label EC0 code_regex BSVO,\s+16 replace_matched begin SVO0,8,SVO1,8 end;
into device label EC0 code_regex BSDC,\s+16 replace_matched begin SDC0,8,SDC1,8 end;
into device label EC0 code_regex BSDV,\s+16 replace_matched begin SDV0,8,SDV1,8 end;
into device label EC0 code_regex BSSN,\s+16 replace_matched begin SSN0,8,SSN1,8 end;
into device label EC0 code_regex SDTA,\s+16 replace_matched begin DTA0,8,DTA1,8 end;




# fix 16-bit methods
into method label GBST code_regex \(BSRC, replaceall_matched begin (B1B2(SRC0,SRC1), end;
into method label GBST code_regex \(BSFC, replaceall_matched begin (B1B2(SFC0,SFC1), end;
into method label GBIF code_regex \(BSFC, replaceall_matched begin (B1B2(SFC0,SFC1), end;
into method label GBST code_regex \(BSAC, replaceall_matched begin (B1B2(SAC0,SAC1), end;
into method label GBST code_regex \(BSVO, replaceall_matched begin (B1B2(SVO0,SVO1), end;
into method label GBIF code_regex \(BSDC, replaceall_matched begin (B1B2(SDC0,SDC1), end;
into method label GBIF code_regex \(BSDV, replaceall_matched begin (B1B2(SDV0,SDV1), end;
into method label GBIF code_regex \(BSSN, replaceall_matched begin (B1B2(SSN0,SSN1), end;
into method label WMCE code_regex \(SDTA, replaceall_matched begin (B1B2(DTA0,DTA1), end;



into device label EC0 code_regex (BSMN,)\s+(128) replace_matched begin BSMX,%2,//%1%2 end;
into device label EC0 code_regex (BSDN,)\s+(128) replace_matched begin BSDX,%2,//%1%2 end;
into device label EC0 code_regex (BSCH,)\s+(128) replace_matched begin BSCX,%2,//%1%2 end;


Field (RAM, ByteAcc, Lock, Preserve)
{
Offset (0xE0),
BSMN, 128, //!!0xE0
BSDN, 128, //!!0xE0
BSCH, 128, //!!0xE0



# utility methods to read/write buffers from/to EC
into method label RE1B parent_label EC0 remove_entry;
into method label RECB parent_label EC0 remove_entry;
into device label EC0 insert
begin
Method (RE1B, 1, NotSerialized)\n
{\n
OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n
Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n
Return(BYTE)\n
}\n
Method (RECB, 2, Serialized)\n
// Arg0 - offset in bytes from zero-based EC\n
// Arg1 - size of buffer in bits\n
{\n
ShiftRight(Arg1, 3, Arg1)\n
Name(TEMP, Buffer(Arg1) { })\n
Add(Arg0, Arg1, Arg1)\n
Store(0, Local0)\n
While (LLess(Arg0, Arg1))\n
{\n
Store(RE1B(Arg0), Index(TEMP, Local0))\n
Increment(Arg0)\n
Increment(Local0)\n
}\n
Return(TEMP)\n
}\n
end;

Device (EC0)
{
Name (_HID, EisaId ("PNP0C09"))


into method label GBIF code_regex \(BSMN, replaceall_matched begin (RECB(0xE0,128), end;
into method label GBIF code_regex \(BSDN, replaceall_matched begin (RECB(0xE0,128), end;
into method label GBIF code_regex \(BSCH, replaceall_matched begin (RECB(0xE0,128), end;
 
Rehabman ... have been trying to follow your guide for battery but not able to compile dsdt ,
not confident in the patching i've got can you give me some guidance
Just battery to fix and i'm over the line.

this is what i've got so far.....

# 16-bit registers
into device label EC0 code_regex BSRC,\s+16 replace_matched begin SRC0,8,SRC1,8 end;
into device label EC0 code_regex BSFC,\s+16 replace_matched begin SFC0,8,SFC1,8 end;
into device label EC0 code_regex BSAC,\s+16 replace_matched begin SAC0,8,SAC1,8 end;
into device label EC0 code_regex BSVO,\s+16 replace_matched begin SVO0,8,SVO1,8 end;
into device label EC0 code_regex BSDC,\s+16 replace_matched begin SDC0,8,SDC1,8 end;
into device label EC0 code_regex BSDV,\s+16 replace_matched begin SDV0,8,SDV1,8 end;
into device label EC0 code_regex BSSN,\s+16 replace_matched begin SSN0,8,SSN1,8 end;
into device label EC0 code_regex SDTA,\s+16 replace_matched begin DTA0,8,DTA1,8 end;




# fix 16-bit methods
into method label GBST code_regex \(BSRC, replaceall_matched begin (B1B2(SRC0,SRC1), end;
into method label GBST code_regex \(BSFC, replaceall_matched begin (B1B2(SFC0,SFC1), end;
into method label GBIF code_regex \(BSFC, replaceall_matched begin (B1B2(SFC0,SFC1), end;
into method label GBST code_regex \(BSAC, replaceall_matched begin (B1B2(SAC0,SAC1), end;
into method label GBST code_regex \(BSVO, replaceall_matched begin (B1B2(SVO0,SVO1), end;
into method label GBIF code_regex \(BSDC, replaceall_matched begin (B1B2(SDC0,SDC1), end;
into method label GBIF code_regex \(BSDV, replaceall_matched begin (B1B2(SDV0,SDV1), end;
into method label GBIF code_regex \(BSSN, replaceall_matched begin (B1B2(SSN0,SSN1), end;
into method label WMCE code_regex \(SDTA, replaceall_matched begin (B1B2(DTA0,DTA1), end;



into device label EC0 code_regex (BSMN,)\s+(128) replace_matched begin BSMX,%2,//%1%2 end;
into device label EC0 code_regex (BSDN,)\s+(128) replace_matched begin BSDX,%2,//%1%2 end;
into device label EC0 code_regex (BSCH,)\s+(128) replace_matched begin BSCX,%2,//%1%2 end;


Field (RAM, ByteAcc, Lock, Preserve)
{
Offset (0xE0),
BSMN, 128, //!!0xE0
BSDN, 128, //!!0xE0
BSCH, 128, //!!0xE0



# utility methods to read/write buffers from/to EC
into method label RE1B parent_label EC0 remove_entry;
into method label RECB parent_label EC0 remove_entry;
into device label EC0 insert
begin
Method (RE1B, 1, NotSerialized)\n
{\n
OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n
Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n
Return(BYTE)\n
}\n
Method (RECB, 2, Serialized)\n
// Arg0 - offset in bytes from zero-based EC\n
// Arg1 - size of buffer in bits\n
{\n
ShiftRight(Arg1, 3, Arg1)\n
Name(TEMP, Buffer(Arg1) { })\n
Add(Arg0, Arg1, Arg1)\n
Store(0, Local0)\n
While (LLess(Arg0, Arg1))\n
{\n
Store(RE1B(Arg0), Index(TEMP, Local0))\n
Increment(Arg0)\n
Increment(Local0)\n
}\n
Return(TEMP)\n
}\n
end;

Device (EC0)
{
Name (_HID, EisaId ("PNP0C09"))


into method label GBIF code_regex \(BSMN, replaceall_matched begin (RECB(0xE0,128), end;
into method label GBIF code_regex \(BSDN, replaceall_matched begin (RECB(0xE0,128), end;
into method label GBIF code_regex \(BSCH, replaceall_matched begin (RECB(0xE0,128), end;

One of the existing ASUS patches may work for your DSDT (ASUS battery DSDT methods seem to be very consistent).

Did you try them?
 
One of the existing ASUS patches may work for your DSDT (ASUS battery DSDT methods seem to be very consistent).

Did you try them?

No, I had assumed I needed to begin from scratch .
My machine is acer but you do mean asus ? ( looks to be 16bit and 256bit ) mine 16bit and 128
Do you mean to try existing asus patches as is ?
Or work from one with my layout ?
this one.... < battery_ASUS-G75vw.txt > ?
 
One of the existing ASUS patches may work for your DSDT (ASUS battery DSDT methods seem to be very consistent).

Did you try them?


Just looking thru your patches -and this Acer one seems very close < Acer 3820-tg >
I've changed
OperationRegion(ERAM, EmbeddedControl,.....
Field(ERAM, .....
to
OperationRegion(RAM, EmbeddedControl,.....
Field(RAM, .....

otherwise unchanged and I get 3 errors when compiled...
4064 Object does not exist (RSDN)
4064 Object does not exist (RSCH)
4064 Object does not exist (RSMN)

I also noticed the patch doesn't list ....
into device label EC0 code_regex SDTA,\s+16 replace_matched begin DTA0,8,DTA1,8 end;

but does include a fix for this
into method label WMCE code_regex \(SDTA, replaceall_matched begin (B1B2(DTA0,DTA1), end;

was that left out for any particular reason?
 
No, I had assumed I needed to begin from scratch .
My machine is acer but you do mean asus ? ( looks to be 16bit and 256bit ) mine 16bit and 128
Do you mean to try existing asus patches as is ?
Or work from one with my layout ?
this one.... < battery_ASUS-G75vw.txt > ?

I only looked at your profile, which says ASUS...

Acer is different. But there are also some patches for Acer laptops.

You should fill out your profile to reflect your laptop...
 
Just looking thru your patches -and this Acer one seems very close < Acer 3820-tg >
I've changed
OperationRegion(ERAM, EmbeddedControl,.....
Field(ERAM, .....
to
OperationRegion(RAM, EmbeddedControl,.....
Field(RAM, .....

otherwise unchanged and I get 3 errors when compiled...
4064 Object does not exist (RSDN)
4064 Object does not exist (RSCH)
4064 Object does not exist (RSMN)

I also noticed the patch doesn't list ....
into device label EC0 code_regex SDTA,\s+16 replace_matched begin DTA0,8,DTA1,8 end;

but does include a fix for this
into method label WMCE code_regex \(SDTA, replaceall_matched begin (B1B2(DTA0,DTA1), end;

was that left out for any particular reason?

Yours may be slightly different. Modify it as necessary according to post #1.
 
Back
Top