Contribute
Register

Battery Manager with Fix for Boot without Batteries

Status
Not open for further replies.
I don't use my DVD player very much, in fact, I've never played a DVD with it (it is not installed most of the time), but I just tried using DVD Player on my Probook. It worked no problem. This seems more likely to do with the AMD/ATI graphics than the battery manager. It could be the loading of the battery manager just shifts some things around in memory to expose a problem/bug in the graphics driver.
Your explanation seems to be true.
The kext called ATI5000Controller assassinated my system.
My system ceased working. I had got to reinstall it.
The last lines were "com.apple.LanchDaemos stoping job", "com.apple.helpd stoping job" - "Stopping Job" etc.
So that. To say that "ceased working" is to realised the Atiсard stoped straring up.
Everything was work, but I'd seen merely the black screen with the lines.
I tryed to load with Chamelion(-x -f -v) and Clover. I put the native kext to Extra. And the kext from Lion(In Lion DVDPlayer worked) to clover (10.8 kext). And treted permission. I thought that system must have loaded.
But by mistical reasons, it didn't happen.
I've written you to have understood that it forbidden installing graphics-kexts to ML from previous version of OS.
-----------------
I think, perhaps the problem with DVDPlayer will be increasing like a snow ball.
Apple likely changed something for the driver of ATI-cards. For instance, In lion I had a problem with Lion. I had a stripe on HDMI-Display. More exactly, it was the dividing of frame in half.
So that, we should looking for any solution. The other question whether can we do it? Because we don't know what exactly Apple changed for ATI-driver.
DVD play can't play movies with any frame-buffer when the battery-kext is set up.
 
Code:
2/12/13 9:37:57.669 PM ReportCrash[401]: Saved crash report for DVD Player[399] version 5.6 (5500.38.2) to /Users/admin/Library/Logs/DiagnosticReports/DVD Player_2013-02-12-213757_admins-iMac.crash
2/12/13 9:37:58.359 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.359 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.000 PM kernel[0]: Found client, reallocating 15552000
2/12/13 9:37:58.359 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.360 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.360 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.363 PM com.apple.launchd.peruser.501[132]: ([0x0-0x54054].com.apple.DVDPlayer[399]) Job appears to have crashed: Bus error: 10
2/12/13 9:37:58.411 PM WindowServer[99]: MPAccessSurfaceForDisplayDevice: Set up page flip mode on display 0x434601c0 device: 0x10fae0320  isBackBuffered: 1 numComp: 3 numDisp: 3
RahabMan, I get it with Release-SmartBattery.
Maybe should I see it with Debag-SmartBattery to understand the problem more exactly.?
 
Code:
2/12/13 9:37:57.669 PM ReportCrash[401]: Saved crash report for DVD Player[399] version 5.6 (5500.38.2) to /Users/admin/Library/Logs/DiagnosticReports/DVD Player_2013-02-12-213757_admins-iMac.crash
2/12/13 9:37:58.359 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.359 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.000 PM kernel[0]: Found client, reallocating 15552000
2/12/13 9:37:58.359 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.360 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.360 PM WindowServer[99]: CGXGetConnectionProperty: Invalid connection 88871
2/12/13 9:37:58.363 PM com.apple.launchd.peruser.501[132]: ([0x0-0x54054].com.apple.DVDPlayer[399]) Job appears to have crashed: Bus error: 10
2/12/13 9:37:58.411 PM WindowServer[99]: MPAccessSurfaceForDisplayDevice: Set up page flip mode on display 0x434601c0 device: 0x10fae0320  isBackBuffered: 1 numComp: 3 numDisp: 3
RahabMan, I get it with Release-SmartBattery.
Maybe should I see it with Debag-SmartBattery to understand the problem more exactly.?

I don't know. You could try...
 
Hi RehabMan,

I hate to be that guy who begs for somebody to do something for them, but I really would like your help on my battery DSDT problem. I have converted the data to 2 8bit registers as opposed to leaving it at 16bit registers and downloaded and compiled the latest git repository.

Now, it appears the kext loads, but I always see 0% on the battery. If I unplug the cord, it picks that up. So looking at the debug log, I see that my _BIF method appears to be broken. Do you know how to debug where in the dsdt the call isn't returning the capacity? Anyway here is the console output:

Code:
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatterySTA called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatterySTA: battery_status = 0x1f
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatteryBIF called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatteryBIF: validateObject return 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBIF: acpibat_bif size = 13
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery: Error: Capacity Read Zero (0)
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatteryBST called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fPowerUnit       = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: currentStatus    = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate     = 0x7674d170
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x47ae13b8
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentVoltage  = 0xffffff7b
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: Calculating for WATTS
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate = 0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: adjusted fCurrentRate = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fAverageRate = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery: Battery is charged.
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::constructAppleSerialNumber called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::rebuildLegacyIOBatteryInfo called

Here is the output of
Code:
 ioreg -n AppleSmartBattery -r AppleSmartBattery

Code:
+-o AppleSmartBattery  <class AppleSmartBattery, id 0x1000001e4, registered, ma$
    {
      "ExternalConnected" = Yes
      "TimeRemaining" = 65535
      "InstantTimeToEmpty" = 65535
      "ExternalChargeCapable" = Yes
      "CellVoltage" = (1073741790,1073741790,1073741790,1073741793)
      "PermanentFailureStatus" = 0
      "BatteryInvalidWakeSeconds" = 30
      "Voltage" = 18446744073709551483
      "MaxCapacity" = 0
      "AtWarnLevel" = Yes
      "Manufacturer" = "ASUSTek"
      "LatestErrorType" = "Capacity Read Zero"
      "CurrentCapacity" = 0
      "LegacyBatteryInfo" = {"Amperage"=0,"Flags"=5,"Capacity"=0,"Current"=0,"V$
      "FirmwareSerialNumber" = 0
      "BatteryInstalled" = Yes
      "CycleCount" = 0
      "AvgTimeToFull" = 65535
      "DesignCapacity" = 0
      "ManufactureDate" = 0
      "AtCriticalLevel" = Yes
      "BatteryType" = "LIon"
      "InstantTimeToFull" = 65535
      "BatterySerialNumber" = "G75--52- "
      "PostDischargeWaitSeconds" = 120
      "Serial" = " "
      "Temperature" = 0
      "InstantAmperage" = 0
      "MaxErr" = 0
      "FullyCharged" = Yes
      "DeviceName" = "G75--52"
      "IOGeneralInterest" = "IOCommand is not serializable"
      "Amperage" = 0
      "IsCharging" = No
      "PostChargeWaitSeconds" = 120
      "AvgTimeToEmpty" = 65535
    }

One thing that pops out is the "Voltage" value! Look at that thing! And here is my current DSDT. If you have time to look at it, great! If not, I guess I'll keep looking it over.

Thanks!
 

Attachments

  • DSDT.aml.zip
    25.3 KB · Views: 83
Hi RehabMan,

I hate to be that guy who begs for somebody to do something for them, but I really would like your help on my battery DSDT problem. I have converted the data to 2 8bit registers as opposed to leaving it at 16bit registers and downloaded and compiled the latest git repository.

Now, it appears the kext loads, but I always see 0% on the battery. If I unplug the cord, it picks that up. So looking at the debug log, I see that my _BIF method appears to be broken. Do you know how to debug where in the dsdt the call isn't returning the capacity? Anyway here is the console output:

Code:
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatterySTA called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatterySTA: battery_status = 0x1f
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatteryBIF called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatteryBIF: validateObject return 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBIF: acpibat_bif size = 13
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery: Error: Capacity Read Zero (0)
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBatteryManager::getBatteryBST called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fPowerUnit       = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: currentStatus    = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate     = 0x7674d170
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0x47ae13b8
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentVoltage  = 0xffffff7b
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: Calculating for WATTS
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate = 0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: adjusted fCurrentRate = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::setBatteryBST: fAverageRate = 0x0
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery: Battery is charged.
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::constructAppleSerialNumber called
Mar 24 14:13:59 localhost kernel[0]: AppleSmartBattery::rebuildLegacyIOBatteryInfo called

Here is the output of
Code:
 ioreg -n AppleSmartBattery -r AppleSmartBattery

Code:
+-o AppleSmartBattery  <class AppleSmartBattery, id 0x1000001e4, registered, ma$
    {
      "ExternalConnected" = Yes
      "TimeRemaining" = 65535
      "InstantTimeToEmpty" = 65535
      "ExternalChargeCapable" = Yes
      "CellVoltage" = (1073741790,1073741790,1073741790,1073741793)
      "PermanentFailureStatus" = 0
      "BatteryInvalidWakeSeconds" = 30
      "Voltage" = 18446744073709551483
      "MaxCapacity" = 0
      "AtWarnLevel" = Yes
      "Manufacturer" = "ASUSTek"
      "LatestErrorType" = "Capacity Read Zero"
      "CurrentCapacity" = 0
      "LegacyBatteryInfo" = {"Amperage"=0,"Flags"=5,"Capacity"=0,"Current"=0,"V$
      "FirmwareSerialNumber" = 0
      "BatteryInstalled" = Yes
      "CycleCount" = 0
      "AvgTimeToFull" = 65535
      "DesignCapacity" = 0
      "ManufactureDate" = 0
      "AtCriticalLevel" = Yes
      "BatteryType" = "LIon"
      "InstantTimeToFull" = 65535
      "BatterySerialNumber" = "G75--52- "
      "PostDischargeWaitSeconds" = 120
      "Serial" = " "
      "Temperature" = 0
      "InstantAmperage" = 0
      "MaxErr" = 0
      "FullyCharged" = Yes
      "DeviceName" = "G75--52"
      "IOGeneralInterest" = "IOCommand is not serializable"
      "Amperage" = 0
      "IsCharging" = No
      "PostChargeWaitSeconds" = 120
      "AvgTimeToEmpty" = 65535
    }

One thing that pops out is the "Voltage" value! Look at that thing! And here is my current DSDT. If you have time to look at it, great! If not, I guess I'll keep looking it over.

Thanks!

There's definitely something funny about your DSDT..

And I can't tell you what happened with _BIF because there isn't any debug output for the raw data (the raw debug output of the values before watts -> amps conversion). Maybe you could add some.

The voltage is negative. The number you see in ioreg is that number (0xffffff7b) sign extended to 64-bit and viewed as an unsigned 64-bit number. Negative voltage is not supported by the spec. Actual value is -133 mV (or -13.3 V).

From ACPI 5.0 spec:
"Returns the voltage across the battery’s terminals.
Batteries that are rechargeable must report Battery Present Voltage.
• 0x000000000 – 0x7FFFFFFF in [mV]
• 0xFFFFFFFF – Unknown voltage
Note: Only a primary battery can report unknown voltage."

I'd say you have some work to do on your DSDT...
 
Yeah, that I do :p Thanks for the reply!
 
Yeah, that I do :p Thanks for the reply!

And it might be easier to change the code in AppleSmartBatteryManager than to fight fixing the DSDT. Depends on how busted the DSDT is... Certainly, the code could be changed for the possibility of negative voltages, even though they are anti-spec....
 
I've not changed the code yet to test the negative number, I'm more curious as to WHY it's returning out of spec data. There's something about being out of spec that bugs the hell out of me. Now I've always wanted to learn more about ACPI/DSDT so nows the perfect time. I did however add some debug printfs to the kext and I get:

Mar 26 19:43:14 error-pc kernel[0]: BIF fPowerUnit value: 0
Mar 26 19:43:14 error-pc kernel[0]: BIF fDesignCapacity value: e5628804
Mar 26 19:43:14 error-pc kernel[0]: BIF fMaxCapacity value: d0e7a73c
Mar 26 19:43:14 error-pc kernel[0]: BIF fBatteryTechnology value: 0
Mar 26 19:43:14 error-pc kernel[0]: BIF fDesignVoltage value: ffffffd0
Mar 26 19:43:14 error-pc kernel[0]: BIF fCapacityWarning value: a9fc21ac
Mar 26 19:43:14 error-pc kernel[0]: BIF fLowWarning value: ef9db800
Mar 26 19:43:14 error-pc kernel[0]: BIF fDeviceName value: 256e3800
Mar 26 19:43:14 error-pc kernel[0]: BIF fSerialNumber value: 255ad140
Mar 26 19:43:14 error-pc kernel[0]: BIF fType value: 255b0e40
Mar 26 19:43:14 error-pc kernel[0]: BIF fManufacturer value: 256e3140
Mar 26 19:43:14 error-pc kernel[0]: AppleSmartBattery: Error: Capacity Read Zero (0)

This thing is all busted, but I want to fix it. The only mod I've done to it is inject graphics. Nothing other than mindless copying and pasting, mind you. But look at the voltage AND the tech. It doesn't show it as rechargeable 0x01. Yeah yeah I know the last 3 values should have been %s but I didn't compie that in yet, so just ignore them. I've looked at the _BIF method that calls BIF0,BIF1,BIF2,BIF3,BIF4 respectively. They seem straight forward, but some do a >> 0x0f AND and XOR operation on the return value. I think this might be the issue. One of these is BIF3 which returns the tech value. Which you can see is wrong. Damn ASUS and their crap >< haha. Anyway I'm just venting in hopes I'm setting off a "duh dummy, do this" moment anywhere. Haha Anyway, back to it! Cheers!
 
I've not changed the code yet to test the negative number, I'm more curious as to WHY it's returning out of spec data. There's something about being out of spec that bugs the hell out of me. Now I've always wanted to learn more about ACPI/DSDT so nows the perfect time. I did however add some debug printfs to the kext and I get:

Mar 26 19:43:14 error-pc kernel[0]: BIF fPowerUnit value: 0
Mar 26 19:43:14 error-pc kernel[0]: BIF fDesignCapacity value: e5628804
Mar 26 19:43:14 error-pc kernel[0]: BIF fMaxCapacity value: d0e7a73c
Mar 26 19:43:14 error-pc kernel[0]: BIF fBatteryTechnology value: 0
Mar 26 19:43:14 error-pc kernel[0]: BIF fDesignVoltage value: ffffffd0
Mar 26 19:43:14 error-pc kernel[0]: BIF fCapacityWarning value: a9fc21ac
Mar 26 19:43:14 error-pc kernel[0]: BIF fLowWarning value: ef9db800
Mar 26 19:43:14 error-pc kernel[0]: BIF fDeviceName value: 256e3800
Mar 26 19:43:14 error-pc kernel[0]: BIF fSerialNumber value: 255ad140
Mar 26 19:43:14 error-pc kernel[0]: BIF fType value: 255b0e40
Mar 26 19:43:14 error-pc kernel[0]: BIF fManufacturer value: 256e3140
Mar 26 19:43:14 error-pc kernel[0]: AppleSmartBattery: Error: Capacity Read Zero (0)

This thing is all busted, but I want to fix it. The only mod I've done to it is inject graphics. Nothing other than mindless copying and pasting, mind you. But look at the voltage AND the tech. It doesn't show it as rechargeable 0x01. Yeah yeah I know the last 3 values should have been %s but I didn't compie that in yet, so just ignore them. I've looked at the _BIF method that calls BIF0,BIF1,BIF2,BIF3,BIF4 respectively. They seem straight forward, but some do a >> 0x0f AND and XOR operation on the return value. I think this might be the issue. One of these is BIF3 which returns the tech value. Which you can see is wrong. Damn ASUS and their crap >< haha. Anyway I'm just venting in hopes I'm setting off a "duh dummy, do this" moment anywhere. Haha Anyway, back to it! Cheers!

Good luck fixing your DSDT code. You're probably already doing this but what I do is as I read/review the code, I add comments, so I know what it is doing.

BTW, I checked in some extra debug stuff today (using %s and ->getCStringNoCopy() for the OSSymbol* ones...).
 
Status
Not open for further replies.
Back
Top