Contribute
Register

[solved] T450 DUAL Battery Status help

Status
Not open for further replies.
The path you have in SSDT-ACPIBATT is wrong.
Your BATC is at _SB.PCI0.LPCB.H_EC.BATC, not _SB.BATC.
I changed BATC reference again still no difference. I again attached clover files and IoRegistryExplorer file.
 

Attachments

  • Archive.zip
    3 MB · Views: 77
I changed BATC reference again still no difference. I again attached clover files and IoRegistryExplorer file.

Looks ok. You could try larger StartupDelay (but there is a limit to how long you can go).
Or you could start debugging your DSDT code (ACPIDebug.kext) to get at the root of the problem...
 
I tried different delay values but again it didn't make any difference. As you said If I put big values such as 3500 it failed to recognize the battery. 1500 worked but no difference.

I added some debugging code to DSDT and SSDT-BATC but couldn't found a difference between failed and successful startups. There is only one difference but it is not consistent. I again attached my CLOVER folder which has patched files. Could you help me to add some debugging code to files? Since the ones I added doesn't yield much differences. Only in success1 and fail1 there is a difference however between success2 and success3 files, there is no difference with failed one.
 

Attachments

  • Archive.zip
    3 MB · Views: 75
I tried different delay values but again it didn't make any difference. As you said If I put big values such as 3500 it failed to recognize the battery. 1500 worked but no difference.

I added some debugging code to DSDT and SSDT-BATC but couldn't found a difference between failed and successful startups. There is only one difference but it is not consistent. I again attached my CLOVER folder which has patched files. Could you help me to add some debugging code to files? Since the ones I added doesn't yield much differences. Only in success1 and fail1 there is a difference however between success2 and success3 files, there is no difference with failed one.

Previously you showed logs from ACPIBatteryManager that showed "unknown" (0xFFFF) values coming your _BIF method. You need to determine the conditions that cause that and fix it.
 
I am not sure but maybe I have found a workaround. In your code you have this
Code:
    fCapacityWarningRaw = GetValueFromArray (acpibat_bif, BIF_CAPACITY_WARNING);
In DebugLog you log it like below
Code:
    DebugLog("fCapacityWarningRaw = %d\n", (int)fCapacityWarning);
It looks like _BIF fCapacityWarning has a overflow which makes fCapacityWarning = -1 I really don't know why.
_BIF[5] gives this value. In my DSDT it is calculated like below

Code:
//BAT1_BIF
                            Store (Multiply (B1B2 (XDC0, XDC1), 0x0A), Index (BPKG, One))
                            Store (Multiply (B1B2 (XFC0, XFC1), 0x0A), Index (BPKG, 0x02))
                            Store (B1B2 (XDV0, XDV1), Index (BPKG, 0x04))
                            If (B1B2 (XFC0, XFC1))
                            {
                                Store (B1B2 (XFC0, XFC1), Index (BPKG, 0x05))

//BAT2_BIF
                            Store (Multiply (B1B2 (YDC0, YDC1), 0x0A), Index (BPK2, One))
                            Store (Multiply (B1B2 (YFC0, YFC1), 0x0A), Index (BPK2, 0x02))
                            Store (B1B2 (YDV0, YDV1), Index (BPK2, 0x04))
                            If (B1B2 (YFC0, YFC1))
                            {
                                Store (B1B2 (YFC0, YFC1), Index (BPK2, 0x05))

//Methods
    Method (B1B2, 2, NotSerialized)
    {
        Return (Or (Arg0, ShiftLeft (Arg1, 0x08)))
    }

I really can't find a code that makes _BIF -1 unless there is an overflow that makes it -1 either in DSDT code or SSDT-BATC code. My current workaround is like below

Code:
//AppleSmartBattery.cpp Line 1202
    if ((int)fCapacityWarning < 1) {
        DebugLog("fCapacityWarning Error!! = %d\n", (int)fCapacityWarning);
        fCapacityWarningRaw = 751; //raw value extracted from successful calls
    }
I will report back if this error comes again.

EDIT: False alarm :( Error came back again.
 
Last edited:
I am trying again and I found a scenario in which I don't get this error during cold boot. If I remove the attached second battery, I never get the error. This makes me believe that there maybe a logic error which causes BATC to read BAT2 which returns invalid data. Since BATC combines those data, overall data becomes corrupted. In my DSDT I have following code for _STA of batteries

Code:
//BAT1 STA
                        Method (_STA, 0, NotSerialized)  // _STA: Status
                        {
                            \RMDT.P2 ("BAT1 STA BNUM", BNUM)
                            If (And (BNUM, One))
                            {
                                \RMDT.PUSH ("Return Enabled BAT1_STA")
                                Return (0x1F)
                            }

                            \RMDT.PUSH ("Return Disabled BAT1_STA")
                            Return (0x0B)
                        }

//BAT2 STA
                        Method (_STA, 0, NotSerialized)  // _STA: Status
                        {
                            \RMDT.PUSH ("Entering BAT2_STA")
                            \RMDT.P2 ("BAT2 STA BNUM", BNUM)
                            If (And (BNUM, 0x02))
                            {
                                \RMDT.PUSH ("Return Enabled BAT2_STA")
                                Return (0x1F)
                            }

                            \RMDT.PUSH ("Return Disabled BAT2_STA")
                            Return (0x0B)
                        }

BNUM is used to check the status of Batteries if none=0 BAT1= 1, for BAT2=2, COMBINED =3 When I boot with single battery I get following log
Code:
2017-02-20 14:55:38.497817+0300 0xaf       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: starting ACPIACAdapter.
2017-02-20 14:55:38.498197+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::init: Initializing
2017-02-20 14:55:38.498207+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::probe: Probing
2017-02-20 14:55:38.498218+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::start: called
2017-02-20 14:55:38.498239+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: Version 1.70.2 starting on OS X Darwin 16.4.
2017-02-20 14:55:38.498340+0300 0x82       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::setPowerState: which = 0x1
2017-02-20 14:55:38.498346+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: Using ACPI regular battery information method _BIF
2017-02-20 14:55:38.498381+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: clearBatteryState: do_update = false
2017-02-20 14:55:38.498396+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: rebuildLegacyIOBatteryInfo called
2017-02-20 14:55:38.498414+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: pollBatteryState: path = 2
2017-02-20 14:55:38.498419+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatterySTA called
2017-02-20 14:55:38.498693+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: Version 0.1.4 starting on OS X Darwin 16.4.
2017-02-20 14:55:38.499704+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatterySTA: battery_status = 0x1f
2017-02-20 14:55:38.499712+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatteryBIF called
2017-02-20 14:55:38.499721+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: validateObject return 0x0
2017-02-20 14:55:38.499996+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.500248+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" //BAT1 (1)
2017-02-20 14:55:38.500473+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.500710+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.501043+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" //BAT2 (1)
2017-02-20 14:55:38.501201+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.501388+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1 (2)
2017-02-20 14:55:38.501632+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.501812+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1 (3)
2017-02-20 14:55:38.502090+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.502310+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.502531+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2 (2)
2017-02-20 14:55:38.502748+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.503173+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.503443+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2 (3)
2017-02-20 14:55:38.503725+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.503977+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1(4)
2017-02-20 14:55:38.504194+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.504472+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.504691+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2 (4
2017-02-20 14:55:38.504908+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.505049+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1(5)
2017-02-20 14:55:38.505189+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.505366+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.505531+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2(5)
2017-02-20 14:55:38.505784+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x1, }
2017-02-20 14:55:38.505983+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Enabled BAT1_STA" BAT1 (6)
2017-02-20 14:55:38.506208+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.506350+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x1, }
2017-02-20 14:55:38.506487+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2(6)
2017-02-20 14:55:38.507526+0300 0xd0       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x1, } BAT1(7)
2017-02-20 14:55:38.507668+0300 0xd0       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Enabled BAT1_STA"
2017-02-20 14:55:38.508599+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatteryBIF: acpibat_bif size = 13
2017-02-20 14:55:38.508610+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fPowerUnit       = 0x0
2017-02-20 14:55:38.508616+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDesignCapacityRaw  = 52170
2017-02-20 14:55:38.508622+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fMaxCapacityRaw     = 45270
2017-02-20 14:55:38.508628+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fBatteryTech     = 0x1
2017-02-20 14:55:38.508633+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDesignVoltage   = 11100
2017-02-20 14:55:38.508639+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fCapacityWarningRaw = 0
2017-02-20 14:55:38.508644+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fLowWarningRaw      = 0
2017-02-20 14:55:38.508649+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDeviceName      = ''
2017-02-20 14:55:38.508654+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fSerialNumber    = ''
2017-02-20 14:55:38.508659+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fType            = 'Lion'
2017-02-20 14:55:38.508666+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fManufacturer    = 'Sony Corporation'
2017-02-20 14:55:38.508672+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: Calculating for WATTS
2017-02-20 14:55:38.508678+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDesignCapacity(mAh)  = 4700
2017-02-20 14:55:38.508684+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fMaxCapacity(mAh)     = 4078
2017-02-20 14:55:38.508695+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatterySerialNumber called
2017-02-20 14:55:38.508708+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatteryBST called

Battery Manager tries couple of times to get the status and after successful operation, Battery information is returned. However when I attach second battery, I guess BAT2 doesn't initialize at the same time and returns invalid data somewhere along the road. So, is it possible to add a check in SSDT-BATC.aml so that it will ignore BAT2 if it is reporting invalid state or has invalid values. I want to emulate single battery if BAT2 is failing. I attached two logs one with single battery and other with failed double battery. I will really appreciate if you can take a look at the logs maybe there is some kind of logic error in SSDT-BATC.aml file.
 

Attachments

  • Logs.zip
    7.6 KB · Views: 70
Last edited:
I am trying again and I found a scenario in which I don't get this error during cold boot. If I remove the attached second battery, I never get the error. This makes me believe that there maybe a logic error which causes BATC to read BAT2 which returns invalid data. Since BATC combines those data, overall data becomes corrupted. In my DSDT I have following code for _STA of batteries

Code:
//BAT1 STA
                        Method (_STA, 0, NotSerialized)  // _STA: Status
                        {
                            \RMDT.P2 ("BAT1 STA BNUM", BNUM)
                            If (And (BNUM, One))
                            {
                                \RMDT.PUSH ("Return Enabled BAT1_STA")
                                Return (0x1F)
                            }

                            \RMDT.PUSH ("Return Disabled BAT1_STA")
                            Return (0x0B)
                        }

//BAT2 STA
                        Method (_STA, 0, NotSerialized)  // _STA: Status
                        {
                            \RMDT.PUSH ("Entering BAT2_STA")
                            \RMDT.P2 ("BAT2 STA BNUM", BNUM)
                            If (And (BNUM, 0x02))
                            {
                                \RMDT.PUSH ("Return Enabled BAT2_STA")
                                Return (0x1F)
                            }

                            \RMDT.PUSH ("Return Disabled BAT2_STA")
                            Return (0x0B)
                        }

BNUM is used to check the status of Batteries if none=0 BAT1= 1, for BAT2=2, COMBINED =3 When I boot with single battery I get following log
Code:
2017-02-20 14:55:38.497817+0300 0xaf       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: starting ACPIACAdapter.
2017-02-20 14:55:38.498197+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::init: Initializing
2017-02-20 14:55:38.498207+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::probe: Probing
2017-02-20 14:55:38.498218+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::start: called
2017-02-20 14:55:38.498239+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: Version 1.70.2 starting on OS X Darwin 16.4.
2017-02-20 14:55:38.498340+0300 0x82       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: AppleSmartBatteryManager::setPowerState: which = 0x1
2017-02-20 14:55:38.498346+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: Using ACPI regular battery information method _BIF
2017-02-20 14:55:38.498381+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: clearBatteryState: do_update = false
2017-02-20 14:55:38.498396+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: rebuildLegacyIOBatteryInfo called
2017-02-20 14:55:38.498414+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: pollBatteryState: path = 2
2017-02-20 14:55:38.498419+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatterySTA called
2017-02-20 14:55:38.498693+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: Version 0.1.4 starting on OS X Darwin 16.4.
2017-02-20 14:55:38.499704+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatterySTA: battery_status = 0x1f
2017-02-20 14:55:38.499712+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatteryBIF called
2017-02-20 14:55:38.499721+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: validateObject return 0x0
2017-02-20 14:55:38.499996+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.500248+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" //BAT1 (1)
2017-02-20 14:55:38.500473+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.500710+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.501043+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" //BAT2 (1)
2017-02-20 14:55:38.501201+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.501388+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1 (2)
2017-02-20 14:55:38.501632+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.501812+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1 (3)
2017-02-20 14:55:38.502090+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.502310+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.502531+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2 (2)
2017-02-20 14:55:38.502748+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.503173+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.503443+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2 (3)
2017-02-20 14:55:38.503725+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.503977+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1(4)
2017-02-20 14:55:38.504194+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.504472+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.504691+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2 (4
2017-02-20 14:55:38.504908+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 14:55:38.505049+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA" BAT1(5)
2017-02-20 14:55:38.505189+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.505366+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 14:55:38.505531+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2(5)
2017-02-20 14:55:38.505784+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x1, }
2017-02-20 14:55:38.505983+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Enabled BAT1_STA" BAT1 (6)
2017-02-20 14:55:38.506208+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 14:55:38.506350+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x1, }
2017-02-20 14:55:38.506487+0300 0xb3       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA" BAT2(6)
2017-02-20 14:55:38.507526+0300 0xd0       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x1, } BAT1(7)
2017-02-20 14:55:38.507668+0300 0xd0       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Enabled BAT1_STA"
2017-02-20 14:55:38.508599+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatteryBIF: acpibat_bif size = 13
2017-02-20 14:55:38.508610+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fPowerUnit       = 0x0
2017-02-20 14:55:38.508616+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDesignCapacityRaw  = 52170
2017-02-20 14:55:38.508622+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fMaxCapacityRaw     = 45270
2017-02-20 14:55:38.508628+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fBatteryTech     = 0x1
2017-02-20 14:55:38.508633+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDesignVoltage   = 11100
2017-02-20 14:55:38.508639+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fCapacityWarningRaw = 0
2017-02-20 14:55:38.508644+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fLowWarningRaw      = 0
2017-02-20 14:55:38.508649+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDeviceName      = ''
2017-02-20 14:55:38.508654+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fSerialNumber    = ''
2017-02-20 14:55:38.508659+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fType            = 'Lion'
2017-02-20 14:55:38.508666+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fManufacturer    = 'Sony Corporation'
2017-02-20 14:55:38.508672+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: Calculating for WATTS
2017-02-20 14:55:38.508678+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fDesignCapacity(mAh)  = 4700
2017-02-20 14:55:38.508684+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: fMaxCapacity(mAh)     = 4078
2017-02-20 14:55:38.508695+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatterySerialNumber called
2017-02-20 14:55:38.508708+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatteryBST called

Battery Manager tries couple of times to get the status and after successful operation, Battery information is returned. However when I attach second battery, I guess BAT2 doesn't initialize at the same time and returns invalid data somewhere along the road. So, is it possible to add a check in SSDT-BATC.aml so that it will ignore BAT2 if it is reporting invalid state or has invalid values. I want to emulate single battery if BAT2 is failing. I attached two logs one with single battery and other with failed double battery. I will really appreciate if you can take a look at the logs maybe there is some kind of logic error in SSDT-BATC.aml file.

Check what is going on in BATC code. If your second battery returns invalid data, it will transfer into the "combined" battery stats.
 
Check what is going on in BATC code. If your second battery returns invalid data, it will transfer into the "combined" battery stats.

I checked BATC code, I logged everything. Still no progress. Battery manager calls _BIF even though _STA of BAT1 and BAT2 reports 0xB and when _BIF is called, of course invalid status is returned. Once a invalid status is returned, there is no way to change that red color except connecting to power source. Connecting power source resets something and battery status returns back to white bar.

I have observed very strange things as well. Even though _STA of BAT1 and BAT2 is reporting 0xB, Battery kext is reporting 0x1F

Code:
2017-02-20 19:30:52.496359+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: pollBatteryState: path = 2
2017-02-20 19:30:52.496364+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatterySTA called
2017-02-20 19:30:52.496367+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA"
2017-02-20 19:30:52.497941+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 19:30:52.498178+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 19:30:52.498411+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA"
2017-02-20 19:30:52.498622+0300 0xaf       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: starting ACPIACAdapter.
2017-02-20 19:30:52.498685+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 19:30:52.498908+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA"
2017-02-20 19:30:52.499138+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 19:30:52.499369+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA"
2017-02-20 19:30:52.499391+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatterySTA: battery_status = 0x1f

In case you want to revise dual batteries in the future, I added all the logs I collected with my patched DSDT and SSDT-BATC file. I think there is no point trying any more. Because I can't have any progress. I have been trying more than a week and I tried every option I can think of. I guess I have to live with that. Thanks for your help.
 

Attachments

  • Archive.zip
    54.9 KB · Views: 76
I checked BATC code, I logged everything. Still no progress. Battery manager calls _BIF even though _STA of BAT1 and BAT2 reports 0xB and when _BIF is called, of course invalid status is returned. Once a invalid status is returned, there is no way to change that red color except connecting to power source. Connecting power source resets something and battery status returns back to white bar.

I have observed very strange things as well. Even though _STA of BAT1 and BAT2 is reporting 0xB, Battery kext is reporting 0x1F

Code:
2017-02-20 19:30:52.496359+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: pollBatteryState: path = 2
2017-02-20 19:30:52.496364+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: getBatterySTA called
2017-02-20 19:30:52.496367+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA"
2017-02-20 19:30:52.497941+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Entering BAT2_STA"
2017-02-20 19:30:52.498178+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT2 STA BNUM", 0x0, }
2017-02-20 19:30:52.498411+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT2_STA"
2017-02-20 19:30:52.498622+0300 0xaf       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: starting ACPIACAdapter.
2017-02-20 19:30:52.498685+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 19:30:52.498908+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA"
2017-02-20 19:30:52.499138+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: { "BAT1 STA BNUM", 0x0, }
2017-02-20 19:30:52.499369+0300 0xb4       Default     0x0                  0      kernel: (ACPIDebug) ACPIDebug: "Return Disabled BAT1_STA"
2017-02-20 19:30:52.499391+0300 0xa0       Default     0x0                  0      kernel: (ACPIBatteryManager) ACPIBatteryManager: setBatterySTA: battery_status = 0x1f

In case you want to revise dual batteries in the future, I added all the logs I collected with my patched DSDT and SSDT-BATC file. I think there is no point trying any more. Because I can't have any progress. I have been trying more than a week and I tried every option I can think of. I guess I have to live with that. Thanks for your help.

You should determine why _STA of BAT1 and BAT2 are returning an incorrect value.
 
The problem is I don't know where to look. STA of BAT1 always returns 0xB for couple of times and then returns 0x1f whether it is single or double battery. However with double battery some cold boots results in premature BIF calls which causes this error. As I said I have tried everything I can think of from DSDT and SSDT editing to different delay values, I even compiled kext by changing delay, retry count, I tried to return always 0x1f for BAT1, return 0x1f for BAT2 and all other combinations I can think of and still no difference at all. I believe no matter what I try it won't change because I don't know the reason of it or have the knowledge of ACPI. It is like cold boot takes more time and reboot skips some initializing code related to battery. Since battery is initialized correctly in previous boot, it works correctly. I read ACPI specification and read battery section but as I said I couldn't found any solution. I don't want to sound whining. Once again I sincerely thank you for trying to help me out. Best regards.
 
Status
Not open for further replies.
Back
Top