[dev] [slstatus][PATCH] Add 'Not charging' status support

From: Spenser Truex <truex_AT_equwal.com>
Date: Tue, 9 Aug 2022 18:34:23 -0300

Exists on my thinkpad T500. Seems to be both a synonym for "full". Tested
on the T500.
---
 components/battery.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/components/battery.c b/components/battery.c
index f2b0f14..a36132d 100644
--- a/components/battery.c
+++ b/components/battery.c
_AT_@ -53,6 +53,7 @@
 			{ "Charging",    "+" },
 			{ "Discharging", "-" },
 			{ "Full",        "o" },
+			{ "Not charging", "o" },
 		};
 		size_t i;
 		char path[PATH_MAX], state[12];
_AT_@ -61,7 +62,7 @@
 		              "/sys/class/power_supply/%s/status", bat) < 0) {
 			return NULL;
 		}
-		if (pscanf(path, "%12s", state) != 1) {
+		if (pscanf(path, "%12[a-zA-Z ]", state) != 1) {
 			return NULL;
 		}
 
_AT_@ -84,7 +85,7 @@
 		              "/sys/class/power_supply/%s/status", bat) < 0) {
 			return NULL;
 		}
-		if (pscanf(path, "%12s", state) != 1) {
+		if (pscanf(path, "%12[a-zA-Z ]", state) != 1) {
 			return NULL;
 		}
 
-- 
2.35.1
-- 
CAEE B377 FC82 BAF9 102C  D22F C5CE D003 1AA8 E281
Spenser Truex        https://equwal.com

Received on Tue Aug 09 2022 - 23:34:23 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 10 2022 - 01:12:07 CEST