1
0

Add 'Not charging' status support

Exists on various ThinkPads. Seems to be both a synonym for "full".

Tested on:
- ThinkPad T500 (Spenser Truex <truex@equwal.com)
- ThinkPad T420 (drkhsh <me@drkhsh.at)
This commit is contained in:
Spenser Truex 2022-10-26 21:34:47 +02:00 committed by drkhsh
parent 0aacce1c52
commit f29aa9ab06

View File

@ -53,6 +53,7 @@
{ "Charging", "+" }, { "Charging", "+" },
{ "Discharging", "-" }, { "Discharging", "-" },
{ "Full", "o" }, { "Full", "o" },
{ "Not charging", "o" },
}; };
size_t i; size_t i;
char path[PATH_MAX], state[12]; char path[PATH_MAX], state[12];
@ -61,7 +62,7 @@
"/sys/class/power_supply/%s/status", bat) < 0) { "/sys/class/power_supply/%s/status", bat) < 0) {
return NULL; return NULL;
} }
if (pscanf(path, "%12s", state) != 1) { if (pscanf(path, "%12[a-zA-Z ]", state) != 1) {
return NULL; return NULL;
} }
@ -84,7 +85,7 @@
"/sys/class/power_supply/%s/status", bat) < 0) { "/sys/class/power_supply/%s/status", bat) < 0) {
return NULL; return NULL;
} }
if (pscanf(path, "%12s", state) != 1) { if (pscanf(path, "%12[a-zA-Z ]", state) != 1) {
return NULL; return NULL;
} }