battery hack works on M1

This commit is contained in:
Jos Dehaes 2021-10-05 23:24:59 +02:00 committed by aristocratos
parent ce51031142
commit a9b64d62e4

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;