Contribute
Register

[Guide] How to patch DSDT for working battery status

YEEEEEEAH i did it, it works:headbang::headbang::headbang:

RehabMan you're an upsolute hero m8, thanks a lot:thumbup::thumbup::thumbup:

You will want to be careful with that patch.

It has a few problems:
- some of the lines are terminated with CRLF instead of just LF, as if it was edited in Windows
- as a result, some of the patches are not applying
- and it deals with SMD0 incorrectly...it is trying to write to a method SMDX(), which is not valid
 
I have somehow patched the DSDT to get working Battery Status. But i have to put AppleBatterymanager kext in clover kext folder then only get the battery status. Moreover there are few lines i think which need to patch.



#SMW0 16 (NO IDEA WHAT TO DO WITH IT)


#DSDT>_SB>PCI0>LPCB>EC0>SMRD>>Method (SMRD, 4, NotSerialized)>> Store (SMW0, Arg3)
#DSDT>_SB>PCI0>LPCB>EC0>SMWR>>Method (SMWR, 4, NotSerialized)>> Store (Arg3, SMW0)

Other sections i have patched and hopefully were correct


Attached are my patch and DSDT file can you check and revert back.
 

Attachments

  • BATTERY PATCH.txt
    9.9 KB · Views: 146
  • DSDT.aml
    42 KB · Views: 81
You will want to be careful with that patch.

It has a few problems:
- some of the lines are terminated with CRLF instead of just LF, as if it was edited in Windows
- as a result, some of the patches are not applying
- and it deals with SMD0 incorrectly...it is trying to write to a method SMDX(), which is not valid


Well, all the patches were done in maciasl and dsdt extraction was done during boot time with clover if that's of any importance.
What would you suggest i do about those?
 
I have somehow patched the DSDT to get working Battery Status. But i have to put AppleBatterymanager kext in clover kext folder then only get the battery status. Moreover there are few lines i think which need to patch.



#SMW0 16 (NO IDEA WHAT TO DO WITH IT)


#DSDT>_SB>PCI0>LPCB>EC0>SMRD>>Method (SMRD, 4, NotSerialized)>> Store (SMW0, Arg3)
#DSDT>_SB>PCI0>LPCB>EC0>SMWR>>Method (SMWR, 4, NotSerialized)>> Store (Arg3, SMW0)

Other sections i have patched and hopefully were correct


Attached are my patch and DSDT file can you check and revert back.

Refer to the examples in the repo. There are plenty of patches that deal with 16-bit SMW0.
 
Well, all the patches were done in maciasl and dsdt extraction was done during boot time with clover if that's of any importance.
What would you suggest i do about those?

If you look carefully, you'll see that several patches are having no effect (because of the CRLF line terminator).

And this patch:
Code:
# yavsh5 
into method label SMWR code_regex SMD0  replaceall_matched 
begin 
SMDX()  end;

Is wrong.

It translates:
Code:
Store(Arg3,SMD0)

To:
Code:
Store(Arg3,SMDX())

Which will not work. If the code is executed, it will either be ignored or cause an abort.

Read post #1 for how to deal with writes to buffer fields (fields larger than 32-bit). You can also refer to the existing patches in the repo for correct examples (grep 264 *.txt).

You can fix the files CRLF problem with tr:
Code:
# translate CR to space
tr <battery_patch_Fujitsu_AH532_G21.txt >battery_patch_fixed.txt '\r' ' '
 
You can use ACPIDebug to debug it. But you should check that your DSDT was patched according to the main ACPI patching guide.

I think i will give up and stay with chameleon because I Don't know what to patch.
But many thanks anyway.
 
Hi!
I would like to contribute my patch for Dell Inspiron 5548 with Broadwell CPU (i5-5200u), Intel HD5500 and AMD radeon R7-M270
I couldn't find any working patch with this configuration co I've decided to write it on my own!

It should work with this machine.
Let me know if everything's okay :)

Cheers!
 

Attachments

  • battery-dell-inspiron-5548.zip
    79.4 KB · Views: 66
Hi!
I would like to contribute my patch for Dell Inspiron 5548 with Broadwell CPU (i5-5200u), Intel HD5500 and AMD radeon R7-M270
I couldn't find any working patch with this configuration co I've decided to write it on my own!

It should work with this machine.
Let me know if everything's okay :)

Cheers!

The patch is not correct. You cannot use B1B2 as an l-value (C/C++ terminology, sorry).

Where you are translating:
Store(Arg0, ERIB)

to:
Store(Arg0, B1B2(ERI0,ERI1))

It is wrong. Refer to other patches for how to deal with it properly (requires two Store ops).

New versions of the iasl compiler will flag this code with an error...

You're also missing patches for SMD0 (256-bit).
 
The patch is not correct. You cannot use B1B2 as an l-value (C/C++ terminology, sorry).

Where you are translating:
Store(Arg0, ERIB)

to:
Store(Arg0, B1B2(ERI0,ERI1))

It is wrong. Refer to other patches for how to deal with it properly (requires two Store ops).

New versions of the iasl compiler will flag this code with an error...

You're also missing patches for SMD0 (256-bit).

Well... first time always needs to be a failure :)
Reffering to other patches I have found my mistake in ERIB
so the patch should be sth like this, am I right?
Code:
into method label FANG code_regex Store\s+\(Arg0,\s+ERIB\) replace_matched begin Store(Arg0, ERI0) Store(ShiftRight(Arg0, 8), ERI1) end;
into method label FANW code_regex Store\s+\(Arg0,\s+ERIB\) replace_matched begin Store(Arg0, ERI0) Store(ShiftRight(Arg0, 8), ERI1) end;

I've left two additional values that I didn't know what to do
SMD0
BCV4
these two values are also accessed but only SDM0 is used in EC if I can see properly. Does that mean SMD0 also needs attention (firstly I couldn't figure it out because iasl doesn't return any errors regarding to SMD0 after renaming it to SMDX for ex.)?

Also I can't still figure out how to access to that value by offset. Still searching about it.
 
Well... first time always needs to be a failure :)
Reffering to other patches I have found my mistake in ERIB
so the patch should be sth like this, am I right?
Code:
into method label FANG code_regex Store\s+\(Arg0,\s+ERIB\) replace_matched begin Store(Arg0, ERI0) Store(ShiftRight(Arg0, 8), ERI1) end;
into method label FANW code_regex Store\s+\(Arg0,\s+ERIB\) replace_matched begin Store(Arg0, ERI0) Store(ShiftRight(Arg0, 8), ERI1) end;

Looks good.

I've left two additional values that I didn't know what to do
SMD0
BCV4
these two values are also accessed but only SDM0 is used in EC if I can see properly. Does that mean SMD0 also needs attention (firstly I couldn't figure it out because aisl doesn't return any errors regarding to SMD0 after renaming it to SMDX for ex.)?

Also I can't still figure out how to access to that value by offset. Still searching about it.

Keep in mind you have two BCV4 and two SMD0 in different scopes. Rename the ones in EC so you can tell which code refers to them (you'll get errors from the compiler, which will tell you which code you need to worry about).

If you rename them, and there are no errors... then they are not referenced (I think you'll find they are not referenced, so false alarm by me...)
 
Back
Top