battery hack works on M1

This commit is contained in:
Jos Dehaes 2021-10-05 23:24:59 +02:00
parent c75b0f1cea
commit 0ad93684c2

View file

@ -333,7 +333,8 @@ namespace Cpu {
FILE *bat = popen("pmset -g batt", "r");
if (bat) {
char buf[2048];
if (fgets(buf, sizeof(buf), bat) != NULL) {
while (fgets(buf, sizeof(buf), bat) != NULL) {
Logger::debug(buf);
char *perc = strstr(buf, "%");
if (perc) {
has_battery = true;