From 41a8e8b7ca911448c0c4f6a0a960aba961afd36c Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Tue, 28 Apr 2020 19:21:41 +0100 Subject: [PATCH] FreeBSD: Fix --- src/bin/system.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/system.c b/src/bin/system.c index 8445ab2..3a3d46f 100644 --- a/src/bin/system.c +++ b/src/bin/system.c @@ -899,7 +899,10 @@ _battery_state_get(power_t *power) battio.unit = i; if (ioctl(fd, ACPIIO_BATT_GET_BIF, &battio) != -1) { - power->batteries[i]->charge_full = battio.bif.dcap; + if (battio.bif.lfcap == 0) + power->batteries[i]->charge_full = battio.bif.dcap; + else + power->batteries[i]->charge_full = battio.bif.lfcap; } snprintf(name, sizeof(name), "%s %s", battio.bif.oeminfo, battio.bif.model); power->battery_names[i] = strdup(name);