netstar pushed a commit to branch master. http://git.enlightenment.org/apps/evisum.git/commit/?id=28bc18283208c68cae2d3aa33752576dfabdcad6
commit 28bc18283208c68cae2d3aa33752576dfabdcad6 Author: Alastair Poole <nets...@gmail.com> Date: Wed Aug 11 23:22:33 2021 +0100 power: quick fix. --- src/bin/system/machine/sensors.bogox | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/bin/system/machine/sensors.bogox b/src/bin/system/machine/sensors.bogox index 7daa014..b4b2719 100644 --- a/src/bin/system/machine/sensors.bogox +++ b/src/bin/system/machine/sensors.bogox @@ -528,15 +528,26 @@ system_power_state_get(power_t *power) close(fd); } #elif defined(__linux__) - char *buf = file_contents("/sys/class/power_supply/AC/online"); - if (buf) + static const char *found = NULL; + static const char *known[] = { + "/sys/class/power_supply/AC/online", + "/sys/class/power_supply/ACAD/online", + "/sys/class/power_supply/ADP0/online", + }; + + for (int i = 0; (!found) && (i < sizeof(known) / sizeof(char *)); i++) { - power->have_ac = atoi(buf); - free(buf); + struct stat st; + if (stat(known[i], &st) == 0) + { + found = known[i]; + break; + } } - else + + if (found) { - char *buf = file_contents("/sys/class/power_supply/ACAD/online"); + char *buf = file_contents(found); if (buf) { power->have_ac = atoi(buf); --