Contribute
Register

Battery Manager with Fix for Boot without Batteries

Status
Not open for further replies.
hy RehabMan, I have problem like Elrom
AppleSmartBatteryManager:getBatteryBIF(0xE00002BC) failed
AppleSmartBatteryManager:getBatteryBST(0xE00002BC) failed

but my laptop is Lenovo

can you help me edit my 16-bit EC registers to 8-bit?
here my DSDT (http://www.slingfile.com/file/3orgJhV3Wk)

thanks

Here is an attempt. I have made it into a patch for DSDT Editor/Auto Patcher. Try it out and if it works, maybe let people on the main laptop forum know (this is for a Thinkpad, right?). Perhaps someone has a similar laptop and can also use the patch or something like it.

Doing these kind of DSDT patches is usually iterative... that is it might need more tweaks, but since I don't have this laptop, I can't test. But all the EC registers more than 8-bit accessed from the battery methods I have changed to 8-bit access.

If you look at the patches in Lenovo-Battery-Patch.txt and look at the diffs with 'diff -wB makhluk-dsdt_DTGP_HDEF.dsl patched.dsl' you can see the changes.
 

Attachments

  • makhluk-lenovo-battery-patch.zip
    88 KB · Views: 167
Here is an attempt. I have made it into a patch for DSDT Editor/Auto Patcher. Try it out and if it works, maybe let people on the main laptop forum know (this is for a Thinkpad, right?). Perhaps someone has a similar laptop and can also use the patch or something like it.

Doing these kind of DSDT patches is usually iterative... that is it might need more tweaks, but since I don't have this laptop, I can't test. But all the EC registers more than 8-bit accessed from the battery methods I have changed to 8-bit access.

If you look at the patches in Lenovo-Battery-Patch.txt and look at the diffs with 'diff -wB makhluk-dsdt_DTGP_HDEF.dsl patched.dsl' you can see the changes.

I have install DSDT you already patched but still have little problem
now I know remaining time of my battery but not percentage

I attach my screenshoot
 

Attachments

  • Screen Shot 2012-10-05 at 4.04.56 PM.jpg
    Screen Shot 2012-10-05 at 4.04.56 PM.jpg
    209.5 KB · Views: 325
I have install DSDT you already patched but still have little problem
now I know remaining time of my battery but not percentage

I attach my screenshoot

Install the debug version of AppleSmartBatteryManager.kext. Then reboot, and filter Console output with "Battery" The debug output may give some clues about what is wrong with DSDT code.

Also, run this command in Terminal:

ioreg -n AppleSmartBattery -r AppleSmartBattery
 
Install the debug version of AppleSmartBatteryManager.kext. Then reboot, and filter Console output with "Battery" The debug output may give some clues about what is wrong with DSDT code.

Also, run this command in Terminal:

ioreg -n AppleSmartBattery -r AppleSmartBattery

if I use AppleSmartBatteryManager.kext from first post, I got KP
 

Attachments

  • photo.jpg
    photo.jpg
    1.1 MB · Views: 355

Attachments

  • Screen Shot 2012-10-08 at 6.01.32 PM.jpg
    Screen Shot 2012-10-08 at 6.01.32 PM.jpg
    156.1 KB · Views: 291
Now you need to look at Console, filter for AppleSmartBattery, so you can see more of what's happening in DSDT methods...

is this right?

AppleSmartBatteryManager::init: Initializing
AppleSmartBatteryManager::probe: Probing
AppleSmartBatteryManager::start: called
AppleSmartBatteryManager: Version 2012.0922 starting
AppleSmartBatteryManager::setPowerState: which = 0x1
AppleSmartBatteryManager: Battery Supported Count(s) 1.
AppleSmartBattery: Using ACPI regular battery information method _BIF
AppleSmartBattery::clearBatteryState: do_update = false
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
AppleSmartBattery::pollBatteryState: path = 0x2
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
AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
AppleSmartBattery::setBatteryBST: currentStatus = 0x1
AppleSmartBattery::setBatteryBST: fCurrentRate = 0x3256
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x2382
AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0x2a68
AppleSmartBattery::setBatteryBST: Calculating for WATTS
AppleSmartBattery::setBatteryBST: fCurrentRate = 1186
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 837
AppleSmartBattery::setBatteryBST: fAverageRate = 0x4a2
AppleSmartBattery: Battery is discharging.
AppleSmartBattery::constructAppleSerialNumber called
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 0x2
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
AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
AppleSmartBattery::setBatteryBST: currentStatus = 0x1
AppleSmartBattery::setBatteryBST: fCurrentRate = 0x34da
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x2300
AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0x2a37
AppleSmartBattery::setBatteryBST: Calculating for WATTS
AppleSmartBattery::setBatteryBST: fCurrentRate = 1251
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 829
AppleSmartBattery::setBatteryBST: fAverageRate = 0x4e3
AppleSmartBattery: Battery is discharging.
AppleSmartBattery::constructAppleSerialNumber called
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 0x2
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
AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
AppleSmartBattery::setBatteryBST: currentStatus = 0x1
AppleSmartBattery::setBatteryBST: fCurrentRate = 0x39df
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x226a
AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0x2a36
AppleSmartBattery::setBatteryBST: Calculating for WATTS
AppleSmartBattery::setBatteryBST: fCurrentRate = 1370
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 815
AppleSmartBattery::setBatteryBST: fAverageRate = 0x51e
AppleSmartBattery: Battery is discharging.
AppleSmartBattery::constructAppleSerialNumber called
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 0x2
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
AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
AppleSmartBattery::setBatteryBST: currentStatus = 0x1
AppleSmartBattery::setBatteryBST: fCurrentRate = 0x3b57
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x21d4
AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0x2a2d
AppleSmartBattery::setBatteryBST: Calculating for WATTS
AppleSmartBattery::setBatteryBST: fCurrentRate = 1406
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 802
AppleSmartBattery::setBatteryBST: fAverageRate = 0x54e
AppleSmartBattery: Battery is discharging.
AppleSmartBattery::constructAppleSerialNumber called
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 0x2
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
AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
AppleSmartBattery::setBatteryBST: currentStatus = 0x1
AppleSmartBattery::setBatteryBST: fCurrentRate = 0x39df
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x2152
AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0x2a46
AppleSmartBattery::setBatteryBST: Calculating for WATTS
AppleSmartBattery::setBatteryBST: fCurrentRate = 1368
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 788
AppleSmartBattery::setBatteryBST: fAverageRate = 0x553
AppleSmartBattery: Battery is discharging.
AppleSmartBattery::constructAppleSerialNumber called
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
AppleSmartBattery::pollingTimeOut called
AppleSmartBattery::pollBatteryState: path = 0x2
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
AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
AppleSmartBattery::setBatteryBST: currentStatus = 0x1
AppleSmartBattery::setBatteryBST: fCurrentRate = 0x3909
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x20d0
AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0x2a50
AppleSmartBattery::setBatteryBST: Calculating for WATTS
AppleSmartBattery::setBatteryBST: fCurrentRate = 1347
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 775
AppleSmartBattery::setBatteryBST: fAverageRate = 0x54b
AppleSmartBattery: Battery is discharging.
AppleSmartBattery::constructAppleSerialNumber called
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
 
is this right?

AppleSmartBatteryManager::init: Initializing
AppleSmartBatteryManager::probe: Probing
AppleSmartBatteryManager::start: called
AppleSmartBatteryManager: Version 2012.0922 starting
AppleSmartBatteryManager::setPowerState: which = 0x1
AppleSmartBatteryManager: Battery Supported Count(s) 1.
AppleSmartBattery: Using ACPI regular battery information method _BIF
AppleSmartBattery::clearBatteryState: do_update = false
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
AppleSmartBattery::pollBatteryState: path = 0x2
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
AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
AppleSmartBattery::setBatteryBST: fPowerUnit = 0x0
AppleSmartBattery::setBatteryBST: currentStatus = 0x1
AppleSmartBattery::setBatteryBST: fCurrentRate = 0x3256
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x2382
AppleSmartBattery::setBatteryBST: fCurrentVoltage = 0x2a68
AppleSmartBattery::setBatteryBST: Calculating for WATTS
AppleSmartBattery::setBatteryBST: fCurrentRate = 1186
AppleSmartBattery::setBatteryBST: fCurrentCapacity = 837
AppleSmartBattery::setBatteryBST: fAverageRate = 0x4a2
AppleSmartBattery: Battery is discharging.
AppleSmartBattery::constructAppleSerialNumber called
AppleSmartBattery::rebuildLegacyIOBatteryInfo called
...

Well, as you can see from the debug output, the _STA and _BST methods are working (before DSDT changes, only _STA was working). But _BIF is still not working. So, now comes the tough part. You need to comment out parts of the DSDT code that are evaluated as part of that method. I've attached one that eliminates a big chunk of the code (the part relating to serial numbers, manufacturer, etc) to leave just the critical data in the _BIF return (power unit, design cap, last charge cap, design voltage, low warning, critical warning). I've added comments so you can see what I've left and you can see the big section commented out.

There is still some code that I don't quite understand in the actual _BIF method before reaching GBIF and maybe it is causing a problem, so try this and see what happens... This is an iterative process...
 

Attachments

  • makhluk-lenovo-test1.zip
    67.7 KB · Views: 131
Well, as you can see from the debug output, the _STA and _BST methods are working (before DSDT changes, only _STA was working). But _BIF is still not working. So, now comes the tough part. You need to comment out parts of the DSDT code that are evaluated as part of that method. I've attached one that eliminates a big chunk of the code (the part relating to serial numbers, manufacturer, etc) to leave just the critical data in the _BIF return (power unit, design cap, last charge cap, design voltage, low warning, critical warning). I've added comments so you can see what I've left and you can see the big section commented out.

There is still some code that I don't quite understand in the actual _BIF method before reaching GBIF and maybe it is causing a problem, so try this and see what happens... This is an iterative process...

it work, but not 100% work
I got fully charged battery at 86%
where I can put information of my battery? (Serial Number, Manufacturer, Device Name)
 

Attachments

  • Screen Shot 2012-10-10 at 1.35.31 PM.jpg
    Screen Shot 2012-10-10 at 1.35.31 PM.jpg
    153 KB · Views: 231
  • Screen Shot 2012-10-10 at 4.44.12 PM.png
    Screen Shot 2012-10-10 at 4.44.12 PM.png
    79.6 KB · Views: 226
Status
Not open for further replies.
Back
Top