diff --git a/CHANGELOG.md b/CHANGELOG.md index 30de26e5..f24f4739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.21.8 | 2023-09-20 | `battery()` fixed parsing (linux) | | 5.21.7 | 2023-09-19 | `wifiConnections()` `wifiNetworks()` fixed security issue (linux) | | 5.21.6 | 2023-09-18 | `baseboard()` improved parsing (windows) | | 5.21.5 | 2023-09-15 | `chassis()`, `baseboard()` improved parsing (windows) | diff --git a/docs/history.html b/docs/history.html index cc2ee289..c7f1802e 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@

Full version history

+ + 5.21.8 + 2023-09-20 + battery() fixed parsing (linux) + 5.21.7 2023-09-19 diff --git a/docs/index.html b/docs/index.html index 02507ff8..6a2b990e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.21.7
+
New Version: 5.21.8
diff --git a/lib/battery.js b/lib/battery.js index 70a3a67a..946dac45 100644 --- a/lib/battery.js +++ b/lib/battery.js @@ -127,6 +127,7 @@ module.exports = function (callback) { const energy = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10); const power = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_POWER_NOW', '='), 10); const current = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CURRENT_NOW', '='), 10); + const charge = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10); result.percent = parseInt('0' + percent, 10); if (result.maxCapacity && result.currentCapacity) { @@ -140,6 +141,8 @@ module.exports = function (callback) { } if (energy && power) { result.timeRemaining = Math.floor(energy / power * 60); + } else if (current && charge) { + result.timeRemaining = Math.floor(charge / current * 60); } else if (current && result.currentCapacity) { result.timeRemaining = Math.floor(result.currentCapacity / current * 60); }