Contribute
Register

Battery Manager with Fix for Boot without Batteries

Status
Not open for further replies.
Both these ioreg show ACPIBatteryManager 1.70.0. Need to see ioreg with old ACPIBatteryManager...
They do, but they are compiled with different code having one subtle difference. The 'sw' dump is taken with original 1.70.0 installed, whereas the 'hw' has the following applied:
Code:
diff --git a/AppleSmartBatteryManager/AppleSmartBattery.cpp b/AppleSmartBatteryManager/AppleSmartBattery.cpp
index 7d78daf..a6bad62 100644
--- a/AppleSmartBatteryManager/AppleSmartBattery.cpp
+++ b/AppleSmartBatteryManager/AppleSmartBattery.cpp
@@ -1108,7 +1108,7 @@ void AppleSmartBattery::setSerialNumber(const OSSymbol *sym)

 OSSymbol *AppleSmartBattery::serialNumber(void)
 {
-    return OSDynamicCast(OSSymbol, properties->getObject(_SerialNumberSym));
+    return OSDynamicCast(OSSymbol, properties->getObject(_HardwareSerialSym));
 }

 void AppleSmartBattery::setManufacturerData(uint8_t *buffer, uint32_t bufferSize)

And this line alone addresses both of the issues - the correct presentation of the serial number (as seen from BatterySerialNumber in IOReg) as well as the indication to service the battery. The reason for having done that is because with 1.55 codebase, the the method to set the number was being called as setSerialNumber(fSerialNumber), and also
constructAppleSerialNumber() utilized OSSymbol *serial_string = fSerialNumber; within the method. Whereas with 1.70.0 code it was trying to call the construct method using _SerialNumberSym (as set by setSerialNumber), which I have a suspicion fails ... could be because the property is set from a OSNumber var, while the property itself is OSSymbol ?
 
They do, but they are compiled with different code having one subtle difference. The 'sw' dump is taken with original 1.70.0 installed, whereas the 'hw' has the following applied:
Code:
diff --git a/AppleSmartBatteryManager/AppleSmartBattery.cpp b/AppleSmartBatteryManager/AppleSmartBattery.cpp
index 7d78daf..a6bad62 100644
--- a/AppleSmartBatteryManager/AppleSmartBattery.cpp
+++ b/AppleSmartBatteryManager/AppleSmartBattery.cpp
@@ -1108,7 +1108,7 @@ void AppleSmartBattery::setSerialNumber(const OSSymbol *sym)

OSSymbol *AppleSmartBattery::serialNumber(void)
{
-    return OSDynamicCast(OSSymbol, properties->getObject(_SerialNumberSym));
+    return OSDynamicCast(OSSymbol, properties->getObject(_HardwareSerialSym));
}

void AppleSmartBattery::setManufacturerData(uint8_t *buffer, uint32_t bufferSize)

Yes, I know. But I want ioreg from before the commit that seems to be causing a problem.

Thanks in advance.
 
Yes, I know. But I want ioreg from before the commit that seems to be causing a problem.
Thanks in advance.
Ah, no problem. Find it attached.
 

Attachments

  • ioreg_vostro_acpi_battery_155.zip
    381.1 KB · Views: 134
Ah, no problem. Find it attached.

I'm not clear on what you're saying in post #1 regarding ioreg. All three of the ioreg files you have attached have the same data for FirmwareSerialNumber and Serial (Serial=String="1950", HardwareSerialNumber=Number=0x1950) .

Am I supposed to be looking at something else?

Edit: I finally see the difference in "BatterySerialNumber"...

Edit2: Will clean up this code so it is understandable.
 
Last edited:
Edit: I finally see the difference in "BatterySerialNumber"...

Edit2: Will clean up this code so it is understandable.

Fixed in 1.70.1.
 
Fixed in 1.70.1.
Thanks, I can confirm everything is back to the roots here. Also, no 0xffff temperature reported.
93d8cc2b64.png


Cheers
 
Thanks, I can confirm everything is back to the roots here. Also, no 0xffff temperature reported.
93d8cc2b64.png


Cheers

Thanks for reporting the problem and testing the fixes.
 
The install worked for me, but the battery is always recording at 0% even when I know that it's fully charged. It is also not recognizing when I plug in my laptop for charging
 
Hello @RehabMan
With ACPIBatteryManager.kext 1.70.2 my Lenovo Thinkpad shows battery as charching when AC adapter still is plugged in. Fine!
But now the integratet microphone does not work! I think, this is a bug in 1.70.2.
With ACPIBatteryManager.kext 1.70.1 the integratet microphone still works.

My system: 10.12.3, soundcard works with AppleALC.kext 1.1.0 and Lili.kext 1.0.0 in Clover with Layout 3 in DSDT.
The soundcard ist an Conexant CX20753/4.
 
Status
Not open for further replies.
Back
Top