diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-11-19 01:00:30 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-11-19 01:00:30 +0100 |
commit | 2c45fa7254e13c0b76c6decaa71771a1771f86b4 (patch) | |
tree | b9fb3c4a2c9fe32e8a58e79433a5e46ce45e9b76 | |
parent | b06113d21ce467fa905684cfb296231d2e13f2e3 (diff) |
Support more laptops for power supply option
-rw-r--r-- | src/Overlay.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Overlay.cpp b/src/Overlay.cpp index f4729e1..16495fc 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -294,12 +294,18 @@ namespace gsr { static std::string get_power_supply_online_filepath() { std::string result; - if(access("/sys/class/power_supply/ADP1/online", F_OK) == 0) - result = "/sys/class/power_supply/ADP1/online"; - else if(access("/sys/class/power_supply/AC/online", F_OK) == 0) - result = "/sys/class/power_supply/AC/online"; - else if(access("/sys/class/power_supply/ACAD/online", F_OK) == 0) - result = "/sys/class/power_supply/ACAD/online"; + const char *paths[] = { + "/sys/class/power_supply/ADP0/online", + "/sys/class/power_supply/ADP1/online", + "/sys/class/power_supply/AC/online", + "/sys/class/power_supply/ACAD/online" + }; + for(const char *power_supply_online_filepath : paths) { + if(access(power_supply_online_filepath, F_OK) == 0) { + result = power_supply_online_filepath; + break; + } + } return result; } |