Jump to content
Slice

VoodooBatterySMC for online laptop power monitoring

19 posts in this topic

Recommended Posts

Laptop battery monitoring

Screen Shot 2017-09-16 at 08.45.08.png

 

 

 

Using this driver you have to exclude other battery drivers: ACPIBatteryManager, AppleSmartBattery and so on.

This driver assumes to using HWSensors3 with FakeSMC 3.5 as being part of it.

 

19.01.2018

Updated version of VoodooBatterySMC will get extended battery information and so it will be more exact.

VoodooBatterySMC.kext.zip

 

Updated HWMonitorSMC by vector-sigma

HWMonitorSMC.app.zip

 

HWMonitor2 by vector-sigma

https://sourceforge.net/projects/hwsensors3.hwsensors.p/files/latest/download

Share this post


Link to post
Share on other sites
Advertisement

With VoodooBattery it shows the indicator on 10.13 (17A365) Menu Bar.. (ignoring 0% caused of battery device fault).

 

 

EH6Rkc1.png

 

May be you should correct your DSDT to make laptop battery monitoring. Something about 16 bit EC registers. It is common requirement while Dell laptops already have good DSDT.

Share this post


Link to post
Share on other sites

May be you should correct your DSDT to make laptop battery monitoring. Something about 16 bit EC registers. It is common requirement while Dell laptops already have good DSDT.

OK, NP now it gives normal indicator after I disassembled my laptop parts and may be EC reset, as "Charged / Full" instead of "0%".. but,

any idea how to disable this warning message upon every boot?

[Warning] Battery 0 has no remaining capacity reported

Thanks @Slice.

Share this post


Link to post
Share on other sites

OK, NP now it gives normal indicator after I disassembled my laptop parts and may be EC reset, as "Charged / Full" instead of "0%".. but,

any idea how to disable this warning message upon every boot?

[Warning] Battery 0 has no remaining capacity reported

Thanks @Slice.

may be set Name(_STA, 0) for this battery?

Share this post


Link to post
Share on other sites

may be set Name(_STA, 0) for this battery?

OK, but since under linux with "nosplash debug --verbose" also got similar warning about battery; I think simply ignoring above message due to my battery fault.

Thanks anyway.

Share this post


Link to post
Share on other sites

OK, but since under linux with "nosplash debug --verbose" also got similar warning about battery; I think simply ignoring above message due to my battery fault.

Thanks anyway.

A fortiori you have to set

 Name(_STA, 0)

for failed battery.

Share this post


Link to post
Share on other sites

thank you for voodoobatterysmc

 

i report experienced problem.

 

my laptop connected power cable.

 

first, dark theme, icon is black, need to change white icon if use black theme on setting.

post-980913-0-65723400-1507693494_thumb.png

 

two

i used rehabman's acpibatterymanager.kext before.

case1. only rehabman's acpibatterymanager

post-980913-0-86070500-1507696168_thumb.png

he's kext shown manufacture info and battery

 

case2. rehabman's acpibatterymanager + voodoobatterysmc.kext

post-980913-0-29000900-1507695780_thumb.png

i lost manufacture and shown differ battery size.

 

thanks in advance

 

EDIT1. i will get exact battery size info in windows. then will write here.

 

EDIT2.

i can't get battery cycle. because i used windows7.

post-980913-0-82401600-1507695796_thumb.png

post-980913-0-63872300-1507695799_thumb.png

only rehabman kext shown more correct battery info in macos. The battery capacity is slightly different, but it is almost the same.

 

EDIT3.

on slice's kext, battery capacity is more corrected

Share this post


Link to post
Share on other sites

Rehabman kext uses extended information _BIX while I didn't make it yet. Hope improve soon.

 

About battery capacity look Windows tells in mWh, while MacOS in mAh. Multilier is Voltage.

So Windows value 34610mWh / 8.643V = 4004mAh

Compare!

 

PS. Using VoodooBatterySMC assumes you need no double it by ACPIBatteryManager.

Share this post


Link to post
Share on other sites

Rehabman kext uses extended information _BIX while I didn't make it yet. Hope improve soon.

 

About battery capacity look Windows tells in mWh, while MacOS in mAh. Multilier is Voltage.

So Windows value 34610mWh / 8.643V = 4004mAh

Compare!

 

PS. Using VoodooBatterySMC assumes you need no double it by ACPIBatteryManager.

I learned it from you. I will report it to rehabman. Thank you so much.

 

 

나의 LG-F800S 의 Tapatalk에서 보냄

Share this post


Link to post
Share on other sites

Rehabman kext uses extended information _BIX while I didn't make it yet. Hope improve soon.

 

About battery capacity look Windows tells in mWh, while MacOS in mAh. Multilier is Voltage.

So Windows value 34610mWh / 8.643V = 4004mAh

Compare!

 

PS. Using VoodooBatterySMC assumes you need no double it by ACPIBatteryManager.

Using Rehabman's kext I can easily get some info:

2017-10-12 01:42:49.779 HWMonitorSMC[2331:128832] {
    Amperage = 0;
    AtCriticalLevel = 0;
    AtWarnLevel = 0;
    AvgTimeToEmpty = 65535;
    AvgTimeToFull = 65535;
    BatteryInstalled = 1;
    BatteryInvalidWakeSeconds = 30;
    BatterySerialNumber = "Primary- 2993";
    BatteryType = Lion;
    CellVoltage =     (
        3168,
        3168,
        3168,
        3170
    );
    CurrentCapacity = 3962;
    CycleCount = 0;
    DesignCapacity = 8719;
    DeviceName = Primary;
    ExternalChargeCapable = 1;
    ExternalConnected = 1;
    FirmwareSerialNumber = 11346;
    FullyCharged = 1;
    IOGeneralInterest = "IOCommand is not serializable";
    InstantAmperage = 0;
    InstantTimeToEmpty = 65535;
    InstantTimeToFull = 65535;
    IsCharging = 0;
    LegacyBatteryInfo =     {
        Amperage = 0;
        Capacity = 8719;
        Current = 3962;
        "Cycle Count" = 0;
        Flags = 5;
        Voltage = 12674;
    };
    ManufactureDate = 0;
    Manufacturer = "Hewlett-Packard ";
    MaxCapacity = 8719;
    MaxErr = 0;
    PermanentFailureStatus = 0;
    PostChargeWaitSeconds = 120;
    PostDischargeWaitSeconds = 120;
    "Quick Poll" = 0;
    Serial = " 2893";
    Temperature = 0;
    TimeRemaining = 65535;
    Voltage = 12674;
}

CFMutableDictionaryRef m , dict = NULL;

    io_registry_entry_t entry = 0;

    m = IOServiceMatching( "IOPMPowerSource" );

... bla bla

 

Isn't voodobattery published in the same path?

Share this post


Link to post
Share on other sites

Using Rehabman's kext I can easily get some info:

2017-10-12 01:42:49.779 HWMonitorSMC[2331:128832] {
    Amperage = 0;
    AtCriticalLevel = 0;
    AtWarnLevel = 0;
    AvgTimeToEmpty = 65535;
    AvgTimeToFull = 65535;
    BatteryInstalled = 1;
    BatteryInvalidWakeSeconds = 30;
    BatterySerialNumber = "Primary- 2993";
    BatteryType = Lion;
    CellVoltage =     (
        3168,
        3168,
        3168,
        3170
    );
    CurrentCapacity = 3962;
    CycleCount = 0;
    DesignCapacity = 8719;
    DeviceName = Primary;
    ExternalChargeCapable = 1;
    ExternalConnected = 1;
    FirmwareSerialNumber = 11346;
    FullyCharged = 1;
    IOGeneralInterest = "IOCommand is not serializable";
    InstantAmperage = 0;
    InstantTimeToEmpty = 65535;
    InstantTimeToFull = 65535;
    IsCharging = 0;
    LegacyBatteryInfo =     {
        Amperage = 0;
        Capacity = 8719;
        Current = 3962;
        "Cycle Count" = 0;
        Flags = 5;
        Voltage = 12674;
    };
    ManufactureDate = 0;
    Manufacturer = "Hewlett-Packard ";
    MaxCapacity = 8719;
    MaxErr = 0;
    PermanentFailureStatus = 0;
    PostChargeWaitSeconds = 120;
    PostDischargeWaitSeconds = 120;
    "Quick Poll" = 0;
    Serial = " 2893";
    Temperature = 0;
    TimeRemaining = 65535;
    Voltage = 12674;
}

CFMutableDictionaryRef m , dict = NULL;

    io_registry_entry_t entry = 0;

    m = IOServiceMatching( "IOPMPowerSource" );

... bla bla

 

Isn't voodobattery published in the same path?

Exactly

class AppleSmartBattery : public IOPMPowerSource {

Share this post


Link to post
Share on other sites

About battery capacity look Windows tells in mWh, while MacOS in mAh. Multilier is Voltage.

So Windows value 34610mWh / 8.643V = 4004mAh

Compare!

 

PS. Using VoodooBatterySMC assumes you need no double it by ACPIBatteryManager.

So "Battery Amperage,  mA" should be "Battery Amperage,  mAh"? 

And this refear to the current capacity then?

 

Share this post


Link to post
Share on other sites

 

Exactly

class AppleSmartBattery : public IOPMPowerSource {

 

 

i reworked the app, now show voltage and amperage using rehabman's kext by just reading kIOPMPSVoltageKey and kIOPMPSCurrentCapacityKey.

Did not test your kext yet but it should work if mentioned keys are present and populated by voodoobattery.

Source and precompiled app attached.

 

P.S. I introduced I little bug and by clicking voltage it may be always displayed in the top bar. Don't panic I'll fix it.... now I'v to go. please let me know

HWMonitorSMC.app.zip

HWMonitorSMC.zip

Share this post


Link to post
Share on other sites

So "Battery Amperage,  mA" should be "Battery Amperage,  mAh"? 

And this refear to the current capacity then?

 

No, mA means current in units "milliAmpers".

mAh means capacity in units mA * hours.

How many hours the laptop can work with battery can be calculated from capacity and current

Hours = mAh/mA 

So, If I'll use your kext, I need to delete the RehabMan's kext?

 

Yes

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By welker
      Hello people,
      I'm having trouble enabling the battery status. I already installed Kext ACPIBatteryManager and tried to apply a ready-made RehabMan patch for Dell models, the patch compiles without errors but does not correct the problem.
      The percentage is stuck at 99% and the icon is as if it were charging, Can someone help me?
       
      My laptop is a Dell Inspiron 14 Series, model i14-5458
    • By nijhawank
      Hi friends,
       
      Recently I had been looking for ways to control the battery charging on my hackintosh which is a Thinkpad T460 with dual batteries. On Windows there's a program Lenovo Vantage that lets you set the Battery Charging Start and Stop Thresholds. These thresholds continue to apply even when the laptop is turned off as these thresholds are managed by the embedded controller, so from that perspective its a set once and forget.
       
      But there was one more thing that was frustrating me. By default Lenovo uses the external battery first and once its almost drained (less than 5%), it switches to the internal battery.
      Although the Charging Start and Stop Limits are a good way to increase the life span of Lithium batteries (by lowering the max charge limit), the complete drainage of the external battery prior to switching to internal is not a good idea.
      Fortunately Lenovo EC provide options to force drain (use) a battery (even with the ac adapter connected) thereby allowing to manually switch to the internal one, however these are manual controls. In Linux, there's a program tpacpi-bat that runs as a daemon and performs an efficient management of the dual batteries such as switching to internal battery when the external one reaches a configurable lower limit. However, this is Linux only and uses the ACPI interface.
       
      I did some research to understand my options in macOS. I found RehabMan's ACPIDebug.kext and its ability (using another RehabMan's tool ioio) to call a function defined in the DSDT. With information collected tpacpi-bat and ACPIDebug.kext, I have created a dirty version. 
       
      So this is how you use it...
      1. Use the attached SSDT-RMDT. As this was just a rough work to validate my understanding, I just did a hard coding for the first battery. 
      2. Install ACPIDebug.kext
      3. After the reboot, you can trigger the following battery operations...
      a. Set Battery Charge Start Threshold
      ioio -s org_rehabman_ACPIDebug dbg1 <start-percent>
      a. Set Battery Charge Stop Threshold
      ioio -s org_rehabman_ACPIDebug dbg2 <stop-percent>
      a. Force Discharge
      ioio -s org_rehabman_ACPIDebug dbg3 <0|1> //0 to disable, 1 to enable
      a. Inhibit battery charging for specified number of minutes
      ioio -s org_rehabman_ACPIDebug dbg4 <minutes> //0 to disable
      a. View Battery Info
      ioio -s org_rehabman_ACPIDebug dbg5 <anything> //pass anything, its ignored
      a. View Battery Charge Start/Stop Thresholds
      ioio -s org_rehabman_ACPIDebug dbg0 <anything> //pass anything, its ignored
       
      You can see the output using the Log Viewer Console (filter on ACPIDebug). You'd see something like this...
      default    19:34:35.175265 -0800    kernel    ACPIDebug: "View Thresholds"
      default    19:34:35.176349 -0800    kernel    ACPIDebug: { "Charge Start Threshold=", 0x28, }
      default    19:34:35.176489 -0800    kernel    ACPIDebug: { "Charge Stop  Threshold=", 0x3c, }
      default    21:07:36.023627 -0800    kernel    ACPIDebug: "Battery Info"
      default    21:07:36.032040 -0800    kernel    ACPIDebug: { "Conversion (mW[h] -> mA[h]) Required?=", 0x0, }
      default    21:07:36.032323 -0800    kernel    ACPIDebug: { "Design Voltage=", 0x2a30, }
      default    21:07:36.032519 -0800    kernel    ACPIDebug: { "Design Capacity=", 0xdb60, }
      default    21:07:36.032772 -0800    kernel    ACPIDebug: { "Last Full Capacity=", 0x6a9a, }
      default    21:07:36.033783 -0800    kernel    ACPIDebug: { "Remaining Capacity=", 0x2e7c, }
      default    21:07:36.033968 -0800    kernel    ACPIDebug: { "Remaining Percent=", 0x2b, }
      default    21:11:19.319090 -0800    kernel    ACPIDebug: { "Charge Stop Threshold=", 0x5a, }
      default    21:11:30.722450 -0800    kernel    ACPIDebug: { "Charge Start Threshold=", 0x50, }
      default    23:34:39.071335 -0800    kernel    ACPIDebug: "Force Discharge=Enabled"
      default    23:34:59.427494 -0800    kernel    ACPIDebug: "Force Discharge=Disabled"
      default    23:35:08.475281 -0800    kernel    ACPIDebug: { "Inhibit Charge Enabled (in Minutes)=", 0xf, }
      default    23:35:12.971671 -0800    kernel    ACPIDebug: "Inhibit Charge=Disabled"
       
      At this time, I just hard-coded for the BAT0 to quickly validate my understanding and its working well. 
       
      What's next? As I understand (and please correct me if I'm wrong), I can't return values with ACPIDebug.kext along with ioio, plus this is also all very hacky.
      To be able to create a program that reads the current remaining capacity (percent) and switches control to internal batter, I need a way to return this info. Currently I'm just outputting it to the logs.
       
      My thinking is to modify ACPIDebug.kext or one of these other kexts (ACPISensors.kext) to add code for above and then create a program to optimally manage the operation of my two batteries.
      However, I'm very new to all of this and will take some time.
       
      In the meanwhile, here is it for your playing pleasures. Please be aware that my SSDT-RMDT is currently hard-coded for BAT0 and doesn't have all the validations. 
      Credits to RehabMan, tpacpi-bat, and other resources on internet.
       
      Thanks all.
       
       
      SSDT-RMDT.dsl
    • By Slice
      Guys,
      Don't mix 6.18 and 3.41.
       
      There are three different projects for monitoring temperatures, voltages, fans speed and other hardware parameters:
      Initially it was FakeSMC with plugins for producing SMC keys for hardware parameters for different hardware. But sometimes ago Kozlek separated own version of FakeSMC and producing new set of plugins while I stay with good working version 3. So..
      1. FakeSMC v3 with Hardware Sensors3  which I still supported.
      2. FakeSMC v6 (rev1800) by Kozlek and supported by Rehabman. AFAIK both are abandoned and the project is not supported. Or may be maintained by coauthors.
      3. New VirtualSMC by vit9696 with own set of sensors kexts. It depends on Lilu.kext. The project is in active development.
      All three project have incompatible interfaces sensors<->SMC so they are incompatible with each other.
       
      There are applications for monitoring hardware parameters and they commonly depends on these projects.
      1. iStat, iStatMenu, iStatPro compatible with real Macs because they use SMC keys just like those presents in real Macs.
      2. HWMonitorSMC by Navi (initial codes from Kozlek)  used in my HWSensors3.
      3. HWMonitor by Kozlek with graphics like in IntelPowerGadget used in his HWSensors version.
      4. HWMonitorSMC2 by Vector_Sigma tends to be universal supporting all project. It also may use sensors information produces by Apple graphics and by IntelPowerGadget.
       
      Let us discuss here differences and common ideas for this projects.
       
×