Contribute
Register

[solved] Hotpatch battery status does not show

Status
Not open for further replies.
I added FixMutex=true in config.plist the result are same too.."battery_status = 0xb"

Look at your _STA method:
Code:
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If (ECA2)
                {
                    If (And (BNUM, One))
                    {
                        Return (0x1F)
                    }
                }

                Return (0x0B)
            }

So, we can conclude that ECA2 is zero or BNUM is not set.

ECA2 is set in _REG:
Code:
            Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LAnd (LEqual (Arg0, 0x03), LEqual (Arg1, One)))
                {
                    Store (Zero, ECAV)
                    Store (One, ECA2)

So, we must conclude that _REG is not being called, or the related code with BNUM is not being called (I didn't look at it in detail).

I'm not sure why, but it could be EC corruption.

This is wrong:
Code:
        OperationRegion (XCF3, EmbeddedControl, Zero, 0xFF)
        Field (XCF3, ByteAcc, Lock, Preserve)
        {
            SMDX,   256,
            BC0H,   8,
            BC1H,   8,
            BC2H,   8,
            BC3H,   8,
            BDT0,   8,
            BDT1,   8,
            BCY0,   8,
            BCY1,   8,
            BXMA,   64,
            BYMA,   64,
            RTP0,   8,
            PTP1,   8,
            B0ET,   8,
            B1ET,   8,
            BTM0,   8,
            BTM1,   8,
            B0PV,   8,
            B1PV,   8,
            BAC0,   8,
            BAC1,   8,
            BDC0,   8,
            BDC1,   8,
            BDV0,   8,
            BDV1,   8,
            BFC0,   8,
            BFC1,   8,
            BCR0,   8,
            BCR1,   8
        }

The offsets are not correct.
For example, SMD0 (which SMDX is an overlay for) is at offset 0x1c, not 0:
Code:
            Offset (0x18),
            SMPR,   8,
            SMST,   8,
            SMAD,   8,
            SMCM,   8,
            SMD0,   256,

And B1CH is at offset 0x60 (replaced by BC0H/BC1H/BC2H/BC3H), not 0x20:
Code:
            Offset (0x60),
            B1CH,   32,

You will need to fix SSDT-BATT, then do EC reset. Then test again.

There may be other mistakes in here... you should check your work carefully.
 
Last edited:
Look at your _STA method:
Code:
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If (ECA2)
                {
                    If (And (BNUM, One))
                    {
                        Return (0x1F)
                    }
                }

                Return (0x0B)
            }

So, we can conclude that ECA2 is zero.

ECA2 is set in _REG:
Code:
            Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LAnd (LEqual (Arg0, 0x03), LEqual (Arg1, One)))
                {
                    Store (Zero, ECAV)
                    Store (One, ECA2)

So, we must conclude that _REG is not being called.

I'm not sure why, but it could be EC corruption.

This is wrong:
Code:
        OperationRegion (XCF3, EmbeddedControl, Zero, 0xFF)
        Field (XCF3, ByteAcc, Lock, Preserve)
        {
            SMDX,   256,
            BC0H,   8,
            BC1H,   8,
            BC2H,   8,
            BC3H,   8,
            BDT0,   8,
            BDT1,   8,
            BCY0,   8,
            BCY1,   8,
            BXMA,   64,
            BYMA,   64,
            RTP0,   8,
            PTP1,   8,
            B0ET,   8,
            B1ET,   8,
            BTM0,   8,
            BTM1,   8,
            B0PV,   8,
            B1PV,   8,
            BAC0,   8,
            BAC1,   8,
            BDC0,   8,
            BDC1,   8,
            BDV0,   8,
            BDV1,   8,
            BFC0,   8,
            BFC1,   8,
            BCR0,   8,
            BCR1,   8
        }

The offsets are not correct.
For example, SMD0 (which SMDX is an overlay for) is at offset 0x1c, not 0:
Code:
            Offset (0x18),
            SMPR,   8,
            SMST,   8,
            SMAD,   8,
            SMCM,   8,
            SMD0,   256,

And B1CH is at offset 0x60 (replaced by BC0H/BC1H/BC2H/BC3H), not 0x20:
Code:
            Offset (0x60),
            B1CH,   32,

You will need to fix SSDT-BATT, then do EC reset. Then test again.

There may be other mistakes in here... you should check your work carefully.

I have some problem about that, I don't know what number can set for offset, where can I learn about the offsets?
 
I have some problem about that, I don't know what number can set for offset, where can I learn about the offsets?

Offsets are covered in the main battery patching guide.

Simple rule: The offset of any register is the offset of the previous register plus the previous register's size (keep in mind size is specified in bits, but offsets are in bytes), or if an Offset directive immediately precedes the register, the offset is the offset specified in the Offset directive.

Refer to the guide:
https://www.tonymacx86.com/threads/guide-how-to-patch-dsdt-for-working-battery-status.116102/
 
Offsets are covered in the main battery patching guide.

Simple rule: The offset of any register is the offset of the previous register plus the previous register's size (keep in mind size is specified in bits, but offsets are in bytes), or if an Offset directive immediately precedes the register, the offset is the offset specified in the Offset directive.

Refer to the guide:
https://www.tonymacx86.com/threads/guide-how-to-patch-dsdt-for-working-battery-status.116102/

OMG!!! It working now! The battery status show normal when I fix the offset, the battery problem cost me almost a month,
Thank you very much for your help.٩(๑> ₃ <)۶
 
OMG!!! It working now! The battery status show normal when I fix the offset, the battery problem cost me almost a month,
Thank you very much for your help.٩(๑> ₃ <)۶

Marked solved.
 
Marked solved.

I find new problem now...First I put VoodooPS2Controller.kext in L/E, it doesn't work normal in my laptop, and it seems let the battery status does'n show. Then i try to put FakeSMC_xxxxSensor in kexts/other, and battery status doesn't show too. use debug ACPIBatteryManager.kext it shows "battery_status = 0xb" in the kernel logs. If I delete them to return the previous state, the battery can display normally.Why the kext can affect the battery?
 

Attachments

  • debug_20706.zip
    2.9 MB · Views: 79
“If I delete them to return the previous state”. I was wrong, when i delete them, battery doesn't work too_Only I restore the previous backup can let it be normally.
 
I find new problem now...First I put VoodooPS2Controller.kext in L/E, it doesn't work normal in my laptop, and it seems let the battery status does'n show. Then i try to put FakeSMC_xxxxSensor in kexts/other, and battery status doesn't show too. use debug ACPIBatteryManager.kext it shows "battery_status = 0xb" in the kernel logs. If I delete them to return the previous state, the battery can display normally.Why the kext can affect the battery?
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/
 
It still doesn't work..
 

Attachments

  • debug_21393.zip
    3 MB · Views: 75
It still doesn't work..

You will need to debug your battery patching. ACPIDebug.kext is useful for this.

No one said hotpatch is easy (must be very detail oriented).

You're using ApplePS2SmartTouchPad.kext. Because it is closed source, and violates the APSL, I cannot recommend it.
 
Status
Not open for further replies.
Back
Top