Contribute
Register

[Guide] How to patch DSDT for working battery status

Thanks a lot! I will try that soon.
Thanks a lot for the help, Rehabman! Just as I thought and you suggested, I changed the logic of the _STA method so that it would always return 1 (since my battery isn't easily removable anyway) and voila - the correct battery status shows up like a second or two after I get to the login screen and everything is reported correctly. Thanks for all of the kexts that you've made and the assistance in getting this problem fixed - I now have a fully functional hackintosh :)
 
Hi Rehabman it's me again I got problem looking for EmbeddedControl in my DSDT. I couldn't find any of them. What could've gone wrong?

Not all ACPI sets have EmbeddedControl.
And some have it in SSDT instead of DSDT.
 
Just wanted to report that battery manufacture date is not reported correctly. It is however correct with VirtualSMC battery plugin. Cosmetic but since I like this kext, thought I'd report the issue.

Another thing is battery charge cycles. They seem to be an arbitrary number that moves in an inversely proportional manner to battery capacity. I'd imagine the reason being that battery firmware doesn't report correct (if any) data!!
 
Just wanted to report that battery manufacture date is not reported correctly. It is however correct with VirtualSMC battery plugin. Cosmetic but since I like this kext, thought I'd report the issue.

Another thing is battery charge cycles. They seem to be an arbitrary number that moves in an inversely proportional manner to battery capacity. I'd imagine the reason being that battery firmware doesn't report correct (if any) data!!

No "Problem Reporting" files attached.
Read FAQ, "Problem Reporting" again. Carefully. Attach all requested files/output.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/
Use the gen_debug.sh tool mentioned in the FAQ, that way it is less likely you'll omit something.
 
Hi RehabMan,
Thank you for the guide.
So, I tried to follow your guide. First, I found the "EmbeddedControl" section:
Code:
OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
            Field (ERAM, ByteAcc, Lock, Preserve)
            {
                // Found few 16 bits variables and one 256 in here.
                SMD0,   256,
}
P.S: I fixed all the 16 bits variables in this one.
When I looked for "Field (ERAM", I found 7 including the one in the above code. However, the other 6 have a different method definition (3rd arg: "NoLock"):

Code:
Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                SMW0,   16
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                SMB0,   8
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD0,   64
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD1,   128
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD2,   192
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD3,   256
            }
So, I am not sure if I have to fix these 6 too or not. Would you please tell me if I should?
Now, my other problem is with variable "SMD0, 256". When I looked up its usage in the DSDT file, I found a few:

Code:
If (LEqual (Arg0, 0x0A))
                    {
                        Store (Arg3, SMD0)
                    }

OperationRegion (PNVA, SystemMemory, PNVB, PNVL)
    Field (PNVA, AnyAcc, Lock, Preserve)
    {
    ...
    SMD0,   8,
    ...
    }

ConcatenateResTemplate (Local0, ADDB (SMD0, SB00, SB10), Local1) ...

If (LNotEqual (SMD0, 0x02)) ...

Return (LCRS (SMD0, SB00, SIR0)) ...

Return (LSTA (SMD0)) ...

If (LEqual (SMD0, 0x02)) ...

Store (SMD0, SMDX) ...
Here I can simply fix the SMD0 problem following the guide. However, what's confusing me is that it is defined again in the same fill and given a value of 8. I can change it only in the first "Field (ERAM", but then there is no way for me to determine which SMD0 is being referred to in each usage in the file!
Can you please tell me what should I do in this case?
I am attaching my DSDT file.
Thank you very much.
 

Attachments

  • DSDT.aml
    211.1 KB · Views: 99
Last edited:
Hi RehabMan,
Thank you for the guide.
So, I tried to follow your guide. First, I found the "EmbeddedControl" section:
Code:
OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
            Field (ERAM, ByteAcc, Lock, Preserve)
            {
                // Found few 16 bits variables and one 256 in here.
                SMD0,   256,
}
P.S: I fixed all the 16 bits variables in this one.
When I looked for "Field (ERAM", I found 7 including the one in the above code. However, the other 6 have a different method definition (3rd arg: "NoLock"):

Code:
Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                SMW0,   16
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                SMB0,   8
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD0,   64
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD1,   128
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD2,   192
            }

Field (ERAM, ByteAcc, NoLock, Preserve)
            {
                Offset (0x04),
                FLD3,   256
            }
So, I am not sure if I have to fix these 6 too or not. Would you please tell me if I should?
Now, my other problem is with variable "SMD0, 256". When I looked up its usage in the DSDT file, I found a few:

Code:
If (LEqual (Arg0, 0x0A))
                    {
                        Store (Arg3, SMD0)
                    }

OperationRegion (PNVA, SystemMemory, PNVB, PNVL)
    Field (PNVA, AnyAcc, Lock, Preserve)
    {
    ...
    SMD0,   8,
    ...
    }

ConcatenateResTemplate (Local0, ADDB (SMD0, SB00, SB10), Local1) ...

If (LNotEqual (SMD0, 0x02)) ...

Return (LCRS (SMD0, SB00, SIR0)) ...

Return (LSTA (SMD0)) ...

If (LEqual (SMD0, 0x02)) ...

Store (SMD0, SMDX) ...
Here I can simply fix the SMD0 problem following the guide. However, what's confusing me is that it is defined again in the same fill and given a value of 8. I can change it only in the first "Field (ERAM", but then there is no way for me to determine which SMD0 is being referred to in each usage in the file!
Can you please tell me what should I do in this case?
I am attaching my DSDT file.
Thank you very much.

Always search for existing patches first.

Your DSDT.aml matches existing patch "HP G6 2221ss".
 
Ow! Thank you very much. I didn't see that one.
Now it is working fine.
 
Hi, I'm trying to fix the battery status in the Thinkpad S540.
I applied a patch from the repository called "Thinkpad Yoga S1", but the patch description says it works with S540 too.
I patched my DSDT and fixed bug 3 and put Clover/ACPI/Patched.
After starting the laptop, the battery status is not displayed in the tray, after disconnecting the power supply, a red battery with 0% appears and the icon does not show the charging process.
Thanks in advance
 

Attachments

  • Problem Reporting files.zip
    3.4 MB · Views: 50
Hi, I'm trying to fix the battery status in the Thinkpad S540.
I applied a patch from the repository called "Thinkpad Yoga S1", but the patch description says it works with S540 too.
I patched my DSDT and fixed bug 3 and put Clover/ACPI/Patched.
After starting the laptop, the battery status is not displayed in the tray, after disconnecting the power supply, a red battery with 0% appears and the icon does not show the charging process.
Thanks in advance
Your kextcache output proves kexts are not installed correctly.
All kexts you need must be installed to the system volume.
Read post #2 of the Clover guide for details:
https://www.tonymacx86.com/threads/guide-booting-the-os-x-installer-on-laptops-with-clover.148093/

One or more of the battery methods are failing. Use gen_debug.sh (as per FAQ) next time for problem reporting, such that the kernel logs are included.

ACPI is not patched correctly. No sign of any "OS Check Fix" for example. Read here:
https://www.tonymacx86.com/threads/guide-patching-laptop-dsdt-ssdts.152573/
 
Back
Top