Contribute
Register

[Guide] How to patch DSDT for working battery status

No EFI/Clover attached.

Please read post #1, "Problem Reporting". Carefully.
Not sure how I missed Clover folder. Attaching.
 

Attachments

  • Drebuls2.zip
    2.1 MB · Views: 212
Not sure how I missed Clover folder. Attaching.

ACPI is not patched correctly:
- There is no checking for _OSI("Darwin"). See "OS Check Fix" patches in ACPI patching guide.
- your DSDT in ACPI/patched is not patched for battery status (I looked for EmbeddedControl, found SMD0, and found accesses to it that are not patched... at that point I stopped loooking).

Read post #1.
 
ACPI is not patched correctly:
- There is no checking for _OSI("Darwin"). See "OS Check Fix" patches in ACPI patching guide.
- your DSDT in ACPI/patched is not patched for battery status (I looked for EmbeddedControl, found SMD0, and found accesses to it that are not patched... at that point I stopped loooking).

Read post #1.
Sorry, I misunderstood. Attaching files with Os Check, Fix Mutex and battery patch without buggy UPBS method thus always showing 20 hours left.
 

Attachments

  • Drebuls3.zip
    2.1 MB · Views: 214
Sorry, I misunderstood. Attaching files with Os Check, Fix Mutex and battery patch without buggy UPBS method thus always showing 20 hours left.

If you look at ioreg you see current draw on battery only 1 mA (Amperage is 0xffffffff, or -1). That's very low (and likely impossible).

You will need to use the debug ACPIBatteryManager.kext and ACPIDebug.kext to debug your DSDT logic for battery status.
 
If you look at ioreg you see current draw on battery only 1 mA (Amperage is 0xffffffff, or -1). That's very low (and likely impossible).

You will need to use the debug ACPIBatteryManager.kext and ACPIDebug.kext to debug your DSDT logic for battery status.
Ok, so if I understand correctly that battery status is defined in this conditional sentence and refers to that potentially buggy UPBS:

Code:
Method (_BST, 0, NotSerialized)  // _BST: Battery Status
            {
                If (LEqual (^^PCI0.LPCB.EC0.ECOK, One))
                {
                    If (^^PCI0.LPCB.EC0.MBTS)
                    {
                        UPBS ()
                    }
                    Else
                    {
                        IVBS ()
                    }
                }
                Else
                {
                    IVBS ()
                }

                Return (PBST)
            }

So I should trace Local5 or something else from UPBS?

Code:
Method (UPBS, 0, NotSerialized)
            {
                \RMDT.PUSH(Local5)
                Store (0xFFFFFFFF, Index (PBST, One))
                Store (B1B2(^^PCI0.LPCB.EC0.BRM0,^^PCI0.LPCB.EC0.BRM1), Local5)
                If (LNot (And (Local5, 0x8000)))
                {
                    ShiftRight (Local5, 0x05, Local5)
                    ShiftLeft (Local5, 0x05, Local5)
                    If (LNotEqual (Local5, DerefOf (Index (PBST, 0x02))))
                    {
                        Store (Local5, Index (PBST, 0x02))
                    }
                }

                If (LAnd (LNot (^^PCI0.LPCB.EC0.SW2S), LEqual (^^PCI0.LPCB.EC0.BACR, One)))
                {
                    Store (FABL, Index (PBST, 0x02))
                }

                Store (B1B2(^^PCI0.LPCB.EC0.BCV0,^^PCI0.LPCB.EC0.BCV1), Index (PBST, 0x03))
                Store (^^PCI0.LPCB.EC0.MBST, Index (PBST, Zero))
            }
 
Ok, so if I understand correctly that battery status is defined in this conditional sentence and refers to that potentially buggy UPBS:

Code:
Method (_BST, 0, NotSerialized)  // _BST: Battery Status
            {
                If (LEqual (^^PCI0.LPCB.EC0.ECOK, One))
                {
                    If (^^PCI0.LPCB.EC0.MBTS)
                    {
                        UPBS ()
                    }
                    Else
                    {
                        IVBS ()
                    }
                }
                Else
                {
                    IVBS ()
                }

                Return (PBST)
            }

So I should trace Local5 or something else from UPBS?

Code:
Method (UPBS, 0, NotSerialized)
            {
                \RMDT.PUSH(Local5)
                Store (0xFFFFFFFF, Index (PBST, One))
                Store (B1B2(^^PCI0.LPCB.EC0.BRM0,^^PCI0.LPCB.EC0.BRM1), Local5)
                If (LNot (And (Local5, 0x8000)))
                {
                    ShiftRight (Local5, 0x05, Local5)
                    ShiftLeft (Local5, 0x05, Local5)
                    If (LNotEqual (Local5, DerefOf (Index (PBST, 0x02))))
                    {
                        Store (Local5, Index (PBST, 0x02))
                    }
                }

                If (LAnd (LNot (^^PCI0.LPCB.EC0.SW2S), LEqual (^^PCI0.LPCB.EC0.BACR, One)))
                {
                    Store (FABL, Index (PBST, 0x02))
                }

                Store (B1B2(^^PCI0.LPCB.EC0.BCV0,^^PCI0.LPCB.EC0.BCV1), Index (PBST, 0x03))
                Store (^^PCI0.LPCB.EC0.MBST, Index (PBST, Zero))
            }

At the point of your trace for Local5, it is not initialized yet (likely 0).
 
At the point of your trace for Local5, it is not initialized yet (likely 0).
My deteriorating logic says that then it should e placed after store or not?

Code:
Method (UPBS, 0, NotSerialized)
            {
                Store (0xFFFFFFFF, Index (PBST, One))
                Store (B1B2(^^PCI0.LPCB.EC0.BRM0,^^PCI0.LPCB.EC0.BRM1), Local5)
                \RMDT.PUSH(Local5)
                If (LNot (And (Local5, 0x8000)))
                {.......
 
My deteriorating logic says that then it should e placed after store or not?

Code:
Method (UPBS, 0, NotSerialized)
            {
                Store (0xFFFFFFFF, Index (PBST, One))
                Store (B1B2(^^PCI0.LPCB.EC0.BRM0,^^PCI0.LPCB.EC0.BRM1), Local5)
                \RMDT.PUSH(Local5)
                If (LNot (And (Local5, 0x8000)))
                {.......

With that trace, you'll be able to determine what was in BRM0 and BRM1, since at that point the result is stored in Local5.
This is all really basic debugging/programming...
 
Back
Top