Contribute
Register

Yosemite on Dell M6600...a bit of help

Status
Not open for further replies.
Try suggestion in post #27.
Just did. Made the change, rebooted.

Icon still crashes. However, what's interesting is that the settings pane still shows the "Current Battery Charge" as 0.

Screen Shot 2015-04-25 at 6.32.05 PM.png
 
It looks mostly right except for "Amperage"?

View attachment 135355

Edit: And how do we fix that battery icon crashing? Is that because I'm using the Debug version vs Release?

I see a problem. MaxCapacity is 0x1bbd. CurrentCapacity is 0x2292.

It doesn't make sense. Relationship is CurrentCapacity <= MaxCapacity <= DesignCapacity.

You can probably correct for this DSDT bug in your DSDT (or see if you can simply see where the bad data is coming from). In this particular case, MaxCapacity is clearly wrong.

You might look at the logs to see what is happening... Could be watts/amps conversion. The kext always uses design voltage (from _BIF) to convert watts -> amps, as it was discovered that some DSDTs expect this. Yours could be opposite (expecting to use voltage in _BST to convert).

Use the debug ACPIBatteryManager.kext to get more information on what is going on.
 
The console shows...

4/25/15 6:35:08.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate is ACPI_UNKNOWN
 
The console shows...

Add some debug code (ACPIDebug) to _BST (actually in ECG6, which is where all the work is done) to see why...
 
Here's something interesting in HWMonitor... :) Notice the internal battery reading.

Screen Shot 2015-04-25 at 7.05.06 PM.png
 
Here's something interesting in HWMonitor... :) Notice the internal battery reading.

View attachment 135359

Yes, it is a simple calculation... CurrentCapacity/MaxCapacity.

Note that the code doesn't bother to convert CurrentCapacity from watts to amps when CurrentRate is unknown.

Code:
    if (fCurrentRate == ACPI_UNKNOWN)
    {
		DEBUG_LOG("AppleSmartBattery::setBatteryBST: fCurrentRate is ACPI_UNKNOWN\n");
    }
    [b]else if[/b] (WATTS == fPowerUnit && fDesignVoltage)
    {
        // Watts = Amps X Volts
        DEBUG_LOG("AppleSmartBattery::setBatteryBST: Calculating for WATTS\n");
        fCurrentRate = ((int)fCurrentRate * 1000) / fDesignVoltage;
        fCurrentCapacity = (fCurrentCapacity * 1000) / fDesignVoltage;
        DEBUG_LOG("AppleSmartBattery::setBatteryBST: fCurrentRate = %d\n", (int)fCurrentRate);
        DEBUG_LOG("AppleSmartBattery::setBatteryBST: fCurrentCapacity = %d\n",	(int)fCurrentCapacity);
    }
 
Looks like it. I'm trying to trace where that gets set, but as You can guess, not having much success. I can write C# code in sleep...and yet give me a DSDT and I'm like a bumbling fool. Go figure.
 
Looks like it. I'm trying to trace where that gets set, but as You can guess, not having much success. I can write C# code in sleep...and yet give me a DSDT and I'm like a bumbling fool. Go figure.

Related code in ECG6:
Code:
            Store (ECG2 (), Local2)
            ECWB (0x03, Arg0)
            Store (ECRB (0x10), Index (Arg1, Zero))
            Store (ECRW (0x12), Local0)
            If (LEqual (Local0, Zero))
            {
                Increment (Local0)
            }
            Else
            {
                If (LNotEqual (Local2, Zero))
                {
                    If (And (Local0, 0x8000))
                    {
                        [B]Store (Ones, Local0)[/B]
                    }
                }
                Else
                {
                    If (And (Local0, 0x8000))
                    {
                        Subtract (Zero, Local0, Local0)
                        And (Local0, 0xFFFF, Local0)
                    }
                    Else
                    {
                        [B]Store (Ones, Local0)[/B]
                    }
                }
            }

            Store (Local0, Index (Arg1, One))

Index(Arg1,One) corresponds to the entry for CurrentRate in the return package for _BST.
So... however Local0 comes out from previous logic is what you get.

As you can see there are a couple of places where Local0 gets assigned 'Ones' (which is APCI_UNKNOWN).
Code:
#define ACPI_UNKNOWN		0xFFFFFFFF

You'll want to determine which path is being taken...

Code:
            Store (ECG2 (), Local2)
\rmdt.p2("ECG2() returns", Local2)
            ECWB (0x03, Arg0)
            Store (ECRB (0x10), Index (Arg1, Zero))
            Store (ECRW (0x12), Local0)
\rmdt.p2("ECRW(0x12) returns", Local0)
            If (LEqual (Local0, Zero))
            {
                Increment (Local0)
            }
            Else
            {
                If (LNotEqual (Local2, Zero))
                {
                    If (And (Local0, 0x8000))
                    {
                        [B]Store (Ones, Local0)[/B]
                    }
                }
                Else
                {
                    If (And (Local0, 0x8000))
                    {
                        Subtract (Zero, Local0, Local0)
                        And (Local0, 0xFFFF, Local0)
                    }
                    Else
                    {
                        [B]Store (Ones, Local0)[/B]
                    }
                }
            }
\rmdt.p2("CurrentCapacity is", Local0)
            Store (Local0, Index (Arg1, One))
 
That gives me a start. Much appreciated.
 
Status
Not open for further replies.
Back
Top