diff options
-rw-r--r-- | libLumina/LuminaOS-DragonFly.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index 8c406713..73815ea0 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -187,25 +187,30 @@ void LOS::systemSuspend(){ //Battery Availability bool LOS::hasBattery(){ - int val = LUtils::getCmdOutput("apm -l").join("").toInt(); - return (val >= 0 && val <= 100); + int val = LUtils::getCmdOutput("sysctl -n hw.acpi.battery.units").join("").toInt(); + return (val >= 1); } //Battery Charge Level int LOS::batteryCharge(){ //Returns: percent charge (0-100), anything outside that range is counted as an error - int charge = LUtils::getCmdOutput("apm -l").join("").toInt(); + int charge = LUtils::getCmdOutput("sysctl -n hw.acpi.battery.life").join("").toInt(); if(charge > 100){ charge = -1; } //invalid charge return charge; } //Battery Charging State bool LOS::batteryIsCharging(){ - return (LUtils::getCmdOutput("apm -a").join("").simplified() == "1"); + return (LUtils::getCmdOutput("sysctl -n hw.acpi.battery.state").join("").simplified() == "2"); } //Battery Time Remaining int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining - return LUtils::getCmdOutput("apm -t").join("").toInt(); + int time = LUtils::getCmdOutput("sysctl -n hw.acpi.battery.time").join("").toInt(); + if (time > 0) { + // time is in minutes + time *= 60; + } + return time; } //File Checksums |