Contribute
Register

[Guide] How to patch DSDT for working battery status

Thanks for explanation, but if i unplug ac in sleep then i wake, it shows 0x0, but it's running on battery = discharning, so it shoud be 0x1. It looks that i need recheck after sleep like in _WAK or i don't know.
 

Attachments

  • after_sleep.txt
    2.9 KB · Views: 79
How to patch DSDT for working battery status

Thanks for explanation, but if i unplug ac in sleep then i wake, it shows 0x0, but it's running on battery = discharning, so it shoud be 0x1. It looks that i need recheck after sleep like in _WAK or i don't know.

You need to debug your DSDT. Use ACPIDebug.kext to figure out what is happening in the code.

It could be that your _PTS and _WAK methods are not executing completely. Use "Instrument _PTS/_WAK" patch to see. Common cause for that would be missing OEM SSDTs due to DropSSDT=Yes (or DropOem in Clover).
 
How to patch DSDT for working battery status

Problem solved...
The problem was that ACPS does not set value to ACPF after wake and ACAP copy value from ACPF. So correct value was only in ACPS after sleep, ACPF and ACAP have the value before sleep. Usualy it does QA0 (when system running), but after sleep this method need to be triggered. So i add \_SB.PCI0.SBRG.EC0._QA0 () to _WAK and now is QA0 is also triggered after sleep and everything works.

Your tool OS-X-ACPI-Debug is amazing, thanks for that.
 
How to patch DSDT for working battery status

Problem solved...
The problem was that ACPS does not set value to ACPF after wake and ACAP copy value from ACPF. So correct value was only in ACPS after sleep, ACPF and ACAP have the value before sleep. Usualy it does QA0 (when system running), but after sleep this method need to be triggered. So i add \_SB.PCI0.SBRG.EC0._QA0 () to _WAK and now is QA0 is also triggered after sleep and everything works.

Your tool OS-X-ACPI-Debug is amazing, thanks for that.

Glad you have it figured out... and nice to hear someone appreciate ACPIDebug.kext (it is quite useful...)
 
How to patch DSDT for working battery status

Hi, Mr Rehabman.

I have met a error when I try to compile ACPI Tools .

It shows "error: unknown warning option '-Woverride-init' [-Werror,-Wunknown-warning-option]" .

Like this screenshot:
Compile_ACPI_Tools_Error.png

I want to ask you if it can be resolved ?

( ps. The MaciASL's tree view problem with the new iasl version perplex me. So, I want to compile a modified version. But I have met the problem above. ) :eek:

(pps. I am using OS X 10.9 and Xcode Command Line Tool 5.1 )
 
How to patch DSDT for working battery status

Hi, Mr Rehabman.

I have met a error when I try to compile ACPI Tools .

It shows "error: unknown warning option '-Woverride-init' [-Werror,-Wunknown-warning-option]" .

Like this screenshot:
View attachment 104090

I want to ask you if it can be resolved ?

( ps. The MaciASL's tree view problem with the new iasl version perplex me. So, I want to compile a modified version. But I have met the problem above. ) :eek:

(pps. I am using OS X 10.9 and Xcode Command Line Tool 5.1 )

No problem building my version here: https://github.com/RehabMan/acpica

as in:
Code:
cd ~/Documents
mkdir iasl.git
git clone https://github.com/RehabMan/acpica.git iasl.git
cd iasl.git
make

This is my version of iasl, modified to build with xcode compiler and a few other tweaks (such as getting rid of those annoying comments that trip the MaciASL parser up)...
 
How to patch DSDT for working battery status

No problem building my version here: https://github.com/RehabMan/acpica

as in:
Code:
cd ~/Documents
mkdir iasl.git
git clone https://github.com/RehabMan/acpica.git iasl.git
cd iasl.git
make

This is my version of iasl, modified to build with xcode compiler and a few other tweaks (such as getting rid of those annoying comments that trip the MaciASL parser up)...

Thanks , I'll have a try . :thumbup:
 
How to patch DSDT for working battery status

Ok RehabMan : I am lost.

I am trying to patch / fix battery status on my Toshiba Laptop L655 series, Core i3-350M. Everything EXCEPT battery management works. Sleep/wake is just fine, graphics, bluetooth, audio Wifi.....

1. I cannot find ANY of the values you mention in the OP in my DSDT. NOT EVEN one.
2. I use the ACPIBatteryManager.kext in S/L/E.
3. I am using you repo of Laptop patches, and applied the Toshiba patch to try.
3. The battery icon shows, but it has an "X" on it.
4, I have a Device (BAT1 not (BAT0. I changed all BAT1 to BAT0.
4. In the kext debug mode I get this

9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::pollingTimeOut called
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::pollBatteryState: path = 0x1
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBatteryManager::getBatterySTA called
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::setBatterySTA: battery_status = 0xf
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery: !fBatteryPresent
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::clearBatteryState: do_update = true
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::rebuildLegacyIOBatteryInfo called

It looks like it is not detecting a battery present.

I tried the OSFix to make Windows 2006 emulation:

***** Method (_INI, 0, NotSerialized) // _INI: Initialize
{
Store (0x07D6, OSYS)****

No luck !!

I am attaching my DSDT and I hope you can help. Please !!

Thanks in advance.
 

Attachments

  • DSDT.aml
    52.3 KB · Views: 92
How to patch DSDT for working battery status

Ok RehabMan : I am lost.

I am trying to patch / fix battery status on my Toshiba Laptop L655 series, Core i3-350M. Everything EXCEPT battery management works. Sleep/wake is just fine, graphics, bluetooth, audio Wifi.....

1. I cannot find ANY of the values you mention in the OP in my DSDT. NOT EVEN one.
2. I use the ACPIBatteryManager.kext in S/L/E.
3. I am using you repo of Laptop patches, and applied the Toshiba patch to try.
3. The battery icon shows, but it has an "X" on it.
4, I have a Device (BAT1 not (BAT0. I changed all BAT1 to BAT0.
4. In the kext debug mode I get this

9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::pollingTimeOut called
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::pollBatteryState: path = 0x1
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBatteryManager::getBatterySTA called
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::setBatterySTA: battery_status = 0xf
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery: !fBatteryPresent
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::clearBatteryState: do_update = true
9/13/14 9:38:34.000 PM kernel[0]: AppleSmartBattery::rebuildLegacyIOBatteryInfo called

It looks like it is not detecting a battery present.

I tried the OSFix to make Windows 2006 emulation:

***** Method (_INI, 0, NotSerialized) // _INI: Initialize
{
Store (0x07D6, OSYS)****

No luck !!

I am attaching my DSDT and I hope you can help. Please !!

Thanks in advance.

Your _STA method is returning 0x0F, which indicates the system has battery capability, but no battery installed. It should reuturn 0x1F if a battery is present. The problem is the BAT0._STA method:
Code:
            Method (_STA, 0, NotSerialized)
            {
                If (BTIN)
                {
                    Return (0x1F)
                }
                Else
                {
                    Return (0x0F)
                }
            }

As you can see, it returns 0x1F only when BTIN is non-zero. BTIN is updated by method BSTA which is only called from some EC queries (maybe EC queries aren't running for some reason). First attempt would be to call BSTA from _STA:
Code:
            Method (_STA, 0, NotSerialized)
            {
                BSTA() // added to update BTIN status
                If (BTIN)
                {
                    Return (0x1F)
                }
                Else
                {
                    Return (0x0F)
                }
            }

You could also check the EC field directly, instead of BTIN:
Code:
            Method (_STA, 0, NotSerialized)
            {
                If (LEqual (^^PCI0.LPCB.EC0.MBTS, One))
                {
                    Return (0x1F)
                }
                Else
                {
                    Return (0x0F)
                }
            }

Or you could force 0x1F (this would break the ability to detect the battery being removed):
Code:
            Method (_STA, 0, NotSerialized)
            {
                 Return (0x1F)
            }
 
How to patch DSDT for working battery status

THANKS so much for your kind reply!!!


OK. I tried call BSTA from _STA by just adding BSTA () - space after "BSTA" ; now space between parentheses. Did not work.

* "shorting" the code by force 0x1F - this brings the battery icon to show % but it is always STUCK on 100%. I let the laptop sit without the AC adapter and after 2-3 hrs it was still at 100%. The output is

*************************
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::pollingTimeOut called
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::pollBatteryState: path = 0x1
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBatteryManager::getBatterySTA called
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatterySTA: battery_status = 0x1f
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBatteryManager::getBatteryBIX called
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBIX: acpibat_bix size = 20
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBatteryManager::getBatteryBST called
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: currentStatus = 0x0
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate = 0xffffffff
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0xffffffff
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0xffffffff
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: Calculating for WATTS
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate = 386933
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = 386933
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: adjusted fCurrentRate to -321398
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery::setBatteryBST: fAverageRate = 0x1b198a
9/14/14 7:40:38.000 PM kernel[0]: AppleSmartBattery: Battery is charged.
**********************

Of course, "Battery is charged" is wrong.... So it sees the battery but is not actively monitoring the charge.

2. There is a value "ECON" that is specified throughout all the power and brightness etc. What is this?

Any other ideas ??

Thanks again !!
 
Back
Top