Contribute
Register

Battery Manager with Fix for Boot without Batteries

Status
Not open for further replies.
It actually make a lot of sense if you think about it, it allows you to evaluate approximate cycle count that the battery has gone through, anyhow it's better than seeing 0 for couple of years and realizing your battery is dead. I admit there's still wear level in %, but having cycles adjust some what is better than having them set to fixed dead 0.
You basically just calculate how much capacity your battery has lost and divide it by the amount of capacity lost from a single charge. Be it 7, 6 or some other value .. which can be inconsistent, but hey .. it's an approximation. So maybe having it configurable in a plist is a good idea.

About the max capacity greater than designed capacity - believe me this happens :D My step father had a Dell latitude D630 and a 9-cell non-OEM battery which showed greater max capacity then the original, which resulted in battery indicator displaying 32days of charge time remaining when at full charge...

P.S. Also for some reason your kext doesn't work with iStat Pro for me - shows 'Calculating' forever, whereas ACPIBatteryManager does (but doesn't with software like coconutBattery and alike)... see below:
Screen%20Shot%202013-01-20%20at%2012.47.43%20PM.png
 
It actually make a lot of sense if you think about it, it allows you to evaluate approximate cycle count that the battery has gone through, anyhow it's better than seeing 0 for couple of years and realizing your battery is dead. I admit there's still wear level in %, but having cycles adjust some what is better than having them set to fixed dead 0.
You basically just calculate how much capacity your battery has lost and divide it by the amount of capacity lost from a single charge. Be it 7, 6 or some other value .. which can be inconsistent, but hey .. it's an approximation. So maybe having it configurable in a plist is a good idea.

Yes. I guess fallout due to the fact that Apple decided not to show design capacity in the system info?

About the max capacity greater than designed capacity - believe me this happens :D My step father had a Dell latitude D630 and a 9-cell non-OEM battery which showed greater max capacity then the original, which resulted in battery indicator displaying 32days of charge time remaining when at full charge...

I believe it could happen (poorly written DSDT and or non-standard battery being used).
But in this case, it is not an indication of a "distressed" battery... it is indication of a "better than new" battery. Isn't it?
 
P.S. Also for some reason your kext doesn't work with iStat Pro for me - shows 'Calculating' forever, whereas ACPIBatteryManager does (but doesn't with software like coconutBattery and alike)... see below:
Screen%20Shot%202013-01-20%20at%2012.47.43%20PM.png

iStat Pro is probably looking at the wrong place in ioreg. They are probably detecting hackintosh, then looking at AppleACPIBattery in ioreg instead of AppleSmartBattery (where it is on standard Macs). Unfortunately, it is not open source (from what I can tell), so your only hope is to contact the authors of iStat.

Because we put the battery info in the "standard" place (same as real Macs), the driver works with most 3rd party battery utilities.
 
iStat Pro is probably looking at the wrong place in ioreg. They are probably detecting hackintosh, then looking at AppleACPIBattery in ioreg instead of AppleSmartBattery (where it is on standard Macs). Unfortunately, it is not open source (from what I can tell), so your only hope is to contact the authors of iStat.

Because we put the battery info in the "standard" place (same as real Macs), the driver works with most 3rd party battery utilities.

Why would that be the case? It was coded for real Macs, also I believe last time I used zpood‛s sources they worked with iStat. Actually it is open source, that's how I tweaked it to read all the keys from my acpi sensors setup. I guess I will have to look how it detects the battery.
 
Why would that be the case? It was coded for real Macs, also I believe last time I used zpood‛s sources they worked with iStat. Actually it is open source, that's how I tweaked it to read all the keys from my acpi sensors setup. I guess I will have to look how it detects the battery.

I don't know why that would be the case, but it certainly could be that they have put special stuff in for Hackintosh. That would certainly be true if it works with AppleACPIBatteryManager.kext, because that driver stores its data in a non-standard location that is not recognized by some third party apps. And my understanding is the the temp sensor data is coming from FakeSMC plugins (according to kozlek), so evidently support has been coded directly for hackintosh...

I hadn't ever heard of the app until just now. And I was going off your statement that it didn't work, but I just downloaded istat pro 4.92 from softtonic.com and it seemed to work fine for me, showing all the various battery stats. Keep in mind it is 120 seconds before you get time remaining after a transition from plugged in/not plugged in. Maybe I'm not using the same version as you are.

Apple has this link on their site: http://www.apple.com/downloads/dashboard/status/istatpro.html. And the company link (Bjanjo) links to islayer.com, which is a dead link. I googled a bit for istat pro source, but didn't find anything. Could be that the company website is dead.
 
Hmm, so that's what's it all about, then sorry for misleading information. I have been using a kind of old version due to the fact that I had the sources for it, newer sources are nowhere to be found. There is no intended support for hackintoses it just relies on smc keys, as fakesmc and its plugins utilize those proper keys this software is able to work natively, much like hw sensors, but better for me .. At least from my point of view. I will upload the sources for you to see when I'm by a computer.

Actually IRRC both drivers are same thing, the Smart Battery version has just the main class renamed to reflect what Apple is using and only due to that some third party software can monitor data from this kext, because the class and what it ends up being called in ioreg allow for data to be collected. But both kexts have derived vastly over time.
 
Here are the sources (provided by slice back in the day): http://www.mediafire.com/?qmf9m71wlkhdr6m
I have included both original sources I have been given as well my modification, I haven't done much but removed unnecessary keys (to avoid spam in console that some keys are missing) as well as renamed a bunch of sensor readin names.
Basically you compile the core bundle for the widget, then just replace the actual widget's contents:
1. Show package files http://grab.by/jbqC
2. Swap the bundle out http://grab.by/jbqE
3. Install the widget as you would normally do.

P.S. and you are in fact correct:
Code:
kern_return_t ioStatus = IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceNameMatching("AppleACPIBatteryDevice"), &sensorsIterator);

P.S.S.
I messed up on uploading the modified source .. it turned out to be an original as well.
Basically the only modification I did to it was change stuff in ISPIntelSensorController.m to include only those keys that I need and use from my ACPISensors configuration.

Code:
- (void)setKeys {
	availableKeys = [[NSMutableArray alloc] init];
    [availableKeys addObject:@"Tm0P"];//Mem Controller
	[availableKeys addObject:@"TC0D"];//CPU A
	[availableKeys addObject:@"TC1D"];//CPU B
	[availableKeys addObject:@"TA0P"];//Ambient
	[availableKeys addObject:@"Th0H"];//Heatsink A
	//[availableKeys addObject:@"TG0D"];//GPU Diode
	[availableKeys addObject:@"TB0T"];//Enclosure Base
	//[availableKeys addObject:@"TN0H"];//Northbridge
    [availableKeys addObject:@"TS0C"];//Expansion Slots


	keyDisplayNames = [[NSMutableDictionary alloc] init];
	[keyDisplayNames setValue:@"CPU A" forKey:@"TC0D"];
	[keyDisplayNames setValue:@"CPU B" forKey:@"TC1D"];
	[keyDisplayNames setValue:@"CPU Package" forKey:@"Th0H"];
    [keyDisplayNames setValue:@"Southbridge" forKey:@"TB0T"];
	[keyDisplayNames setValue:@"Logic Board" forKey:@"Tm0P"];
    [keyDisplayNames setValue:@"Northbridge" forKey:@"TS0C"];
    [keyDisplayNames setValue:@"Auxiliary" forKey:@"TA0P"];
 
Recompiled iStat Pro to include both cases for battery class names (ACPIBatteryDevice and SmartBattery) and pulled your latest commits from git.
(Now to fix the issues of external IP updating constantly lol)
Screen%20Shot%202013-01-21%20at%2011.03.07%20AM.png

And third party software also works:
Screen%20Shot%202013-01-21%20at%2011.04.03%20AM.png


Huge props for the included fix, mate! Your work has progressively made my OSX experience with this laptop a ton better.

P.S. I've posted a piece of code referring to the iStat Pro code as well as the link to source, but the post has vanished.. not sure if it was wiped right away or is just being proposed to mods to monitor it's contents.
 
RehabMan
Hello. Do you know that in Mountain Lion the DVDPlayer doesn't work with any battery kext. It only happens with ATI cards and only in ML, not Lion.
I've known three people with this problem. Two with Acers, one with Toshiba. But everybody of us has ATI card.
DVDPLayer starts up at that time everything is OK. But when I put in any DVD disk or try to do it straight with hard disk, I get the error as this http://www.insanelym...batterymanager/
But if I delete battery-kext, DVDPlayer is playing well and excelent
Let's think together how to fix it.
At first, we have to find a connection between DVDPlayer and SmartBattery, VoodooBattery, ACPIBatery.
Year, Year All of these drivers break my DVDPlayer. Without them everything(DVDPlayer) works well and good.
Wait your Answer!
 
RehabMan
Hello. Do you know that in Mountain Lion the DVDPlayer doesn't work with any battery kext. It only happens with ATI cards and only in ML, not Lion.
I've known three people with this problem. Two with Acers, one with Toshiba. But everybody of us has ATI card.
DVDPLayer starts up at that time everything is OK. But when I put in any DVD disk or try to do it straight with hard disk, I get the error as this http://www.insanelym...batterymanager/
But if I delete battery-kext, DVDPlayer is playing well and excelent
Let's think together how to fix it.
At first, we have to find a connection between DVDPlayer and SmartBattery, VoodooBattery, ACPIBatery.
Year, Year All of these drivers break my DVDPlayer. Without them everything(DVDPlayer) works well and good.
Wait your Answer!

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.
 
Status
Not open for further replies.
Back
Top