Contribute
Register

x220 Lenovo AppleSmartBatteryManager DSDT

Joined
Oct 30, 2011
Messages
118
Motherboard
Lenovo x270
CPU
i5-6300U
Graphics
HD 520, 1920x1080
Mobile Phone
iOS
Hi Everyone,

Working on battery with AppleSmartBatteryManager.

I have compiled the current git version, extract DSDT from linux and partially patched it.
But regarding the patches related to ACPI Battery purpose, I don't know what I have to do ?

Current I get the following error messages:
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 0x1
AppleSmartBatteryManager::getBatterySTA called
AppleSmartBattery::setBatterySTA: battery_status = 0x1f
AppleSmartBatteryManager::getBatteryBIF called
AppleSmartBatteryManager::getBatteryBIF: validateObject return 0x0
AppleSmartBatteryManager::getBatteryBIF: evaluateObject error 0xe00002bc
AppleSmartBatteryManager::getBatteryBST called
AppleSmartBatteryManager::getBatteryBST: evaluateObject error 0xe00002bc

The DSDT I currently use:
http://www.mediafire.com/?pp1w7ol0us3w9p5

I tried to follow this recommendations:
To support ACPI 3.x _BIF method: Configure key "**UseExtendedBatteryInformationMethod**" to false in Info.plist and install kext, Modify DSDT methods UPBS, UPBI and ITOS.
But I get many erros when compiling the DSDT.

Thanks for your support.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
190,973
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Hi Everyone,

Working on battery with AppleSmartBatteryManager.

I have compiled the current git version, extract DSDT from linux and partially patched it.
But regarding the patches related to ACPI Battery purpose, I don't know what I have to do ?

Current I get the following error messages:
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 0x1
AppleSmartBatteryManager::getBatterySTA called
AppleSmartBattery::setBatterySTA: battery_status = 0x1f
AppleSmartBatteryManager::getBatteryBIF called
AppleSmartBatteryManager::getBatteryBIF: validateObject return 0x0
AppleSmartBatteryManager::getBatteryBIF: evaluateObject error 0xe00002bc
AppleSmartBatteryManager::getBatteryBST called
AppleSmartBatteryManager::getBatteryBST: evaluateObject error 0xe00002bc

The DSDT I currently use:
http://www.mediafire.com/?pp1w7ol0us3w9p5

I tried to follow this recommendations:
To support ACPI 3.x _BIF method: Configure key "**UseExtendedBatteryInformationMethod**" to false in Info.plist and install kext, Modify DSDT methods UPBS, UPBI and ITOS.
But I get many erros when compiling the DSDT.

Thanks for your support.
I took a quick look at your DSDT. The methods you're interested in fixing are _BST, and _BIF and the methods they call, GBST and GBIF. In those methods you'll see they access 16-bit EC registers, and OS X doesn't like this. They have to be converted to 8-bit registers.

In the attached Archive.zip, you'll find battery-patch.txt which contains DSDT patches (use MaciASL to apply) that convert these registers from 16-bit to 8-bit. Also in the archive is patched-for-battery.dsl, which is an uncompiled DSDT (compile it/save as AML in MacIASL) which has some sections commented out and changed by me manually (patches could be developed for these things too, but it would take a fair bit of time -- maybe you can take that on yourself). The critical live data is still coming from the EC, but for the static data, I just made up some dummy values. Try it and see if it works, and then if you want to do the work, you can do more. You can see what I changed by looking for //rehabman

And you should look at my Projects link in my signature for a good AppleSmartBatteryManager.kext...

Edit: It is probably best to use the X220 patch in my patch repo, which has been updated since this original post: http://www.tonymacx86.com/mountain-...plesmartbatterymanager-dsdt-2.html#post681446
 

Attachments

Joined
Feb 22, 2013
Messages
21
Motherboard
lenovo x220
CPU
i5
Graphics
hd3000
Mac
Classic Mac
Mobile Phone
Hello and thank you for the help :) (sorry if i'm getting in the way) i can confirm that these dsdt patches works for me if i use fraisdos125 dsdt, but don't work when i apply them to this dsdt created from a newer bios version from the same machine (the battery shows 0%)
am i doing something wrong?

DSDT with battery fixes : http://www.sendspace.com/file/yewxpv
DSDT without fixes : http://www.sendspace.com/file/sjvxaq

thanks for all the work on smartbattery and Voodoops2controller which i use too
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
190,973
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Hello and thank you for the help :) i can confirm that these dsdt patches works for me if i use fraisdos125 dsdt, but don't work when i apply them to this dsdt created from a newer bios version from the same machine (the battery shows 0%)
am i doing something wrong?

DSDT with battery fixes : http://www.sendspace.com/file/yewxpv
DSDT without fixes : http://www.sendspace.com/file/sjvxaq

thanks for all the work on smartbattery and Voodoops2controller which i use too
Yours has an extra 16-bit field (SBBM) that needs to be converted:

Code:
                    Method (GBIF, 3, NotSerialized)
                    {
                        Acquire (BATM, 0xFFFF)
                        If (Arg2)
                        {
                            Or (Arg0, One, HIID)
                            Store (SBBM, Local7)
                            ShiftRight (Local7, 0x0F, Local7)
Compared with:
Code:
                    Method (GBIF, 3, NotSerialized)
                    {
                        Acquire (BATM, 0xFFFF)
                        If (Arg2)
                        {
                            Or (Arg0, One, HIID)
                            Store (SBCM, Local7)
                            XOr (Local7, One, Index (Arg1, Zero))
SBCM is 1-bit in fraisdos125, but yours is accessing SBBM which is 16-bits.

So, you need to apply these two patches in addition:

Code:
into device label EC code_regex SBBM,\s+16 replace_matched begin BBM0,8,BBM1,8 end;
into_all method label GBIF code_regex \(SBBM, replaceall_matched begin (B1B2 (BBM0, BBM1), end;
 
Joined
Feb 22, 2013
Messages
21
Motherboard
lenovo x220
CPU
i5
Graphics
hd3000
Mac
Classic Mac
Mobile Phone
Thanks a lot! its working! now we can have proper battery with new acpiplatform versions and not stuck with the old ones and Voodoobattery :thumbup:
 
Joined
Oct 30, 2011
Messages
118
Motherboard
Lenovo x270
CPU
i5-6300U
Graphics
HD 520, 1920x1080
Mobile Phone
iOS
Thanks a lot RehabMan, after patching that works.
Maybe some datas to be adjusted as the battery status is blocked at 88% after full fueling.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
190,973
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Thanks a lot RehabMan, after patching that works.
Maybe some datas to be adjusted as the battery status is blocked at 88% after full fueling.
Or it could be your battery is significantly degraded and can only reach 88% of its design capacity.
 
Joined
Oct 30, 2011
Messages
118
Motherboard
Lenovo x270
CPU
i5-6300U
Graphics
HD 520, 1920x1080
Mobile Phone
iOS
It couldn't be. Under windows or linux, the battery status reaches 100%.
 
Joined
Feb 22, 2013
Messages
21
Motherboard
lenovo x220
CPU
i5
Graphics
hd3000
Mac
Classic Mac
Mobile Phone
i can confirm it too , the battery shows -10% than it actually is
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
190,973
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
It couldn't be. Under windows or linux, the battery status reaches 100%.
Well, it *displays* 100%, but are you sure the battery charge is reaching its design capacity?
(it depends on whether the percentage is shown as current_capacity/max_capacity or current_capacity/design_capacity)

Run this in Terminal to see what is going on:
Code:
# probably this trimmed list will tell us what we need...
ioreg -n AppleSmartBattery -r AppleSmartBattery | grep -y capacity

# or for the full output of all battery data
ioreg -n AppleSmartBattery -r AppleSmartBattery
I'm assuming you're using my battery manager... (see Projects link in signature).
 
Top