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:
parent
0aacce1c52
commit
f29aa9ab06
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user