diff options
author | Michael Neumann <mneumann@ntecs.de> | 2015-08-16 16:35:39 +0200 |
---|---|---|
committer | Michael Neumann <mneumann@ntecs.de> | 2015-08-16 16:35:39 +0200 |
commit | 0b4fa586baa82d27021f2e7a561d98ac42e06ba2 (patch) | |
tree | 09475baf584c34316db9d97625499b260bc0bed0 /libLumina/LuminaOS-DragonFly.cpp | |
parent | DragonFly does not have graphical mixer (diff) | |
download | lumina-0b4fa586baa82d27021f2e7a561d98ac42e06ba2.tar.gz lumina-0b4fa586baa82d27021f2e7a561d98ac42e06ba2.tar.bz2 lumina-0b4fa586baa82d27021f2e7a561d98ac42e06ba2.zip |
Implement Battery hooks for DragonFly
Diffstat (limited to 'libLumina/LuminaOS-DragonFly.cpp')
-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 |