diff options
author | Alastair Poole <netstar@gmail.com> | 2020-07-09 01:11:31 +0100 |
---|---|---|
committer | Alastair Poole <netstar@gmail.com> | 2020-07-09 01:11:31 +0100 |
commit | 1fa239b404ead097c1e019f6cdad6eb5f9f2f7e0 (patch) | |
tree | 366fdd2f375317959a0c90cde298e6902623921c | |
parent | 12ddeaa2d1450130054bd0b9f131f409b3948b30 (diff) | |
download | enlightenment-1fa239b404ead097c1e019f6cdad6eb5f9f2f7e0.tar.gz |
battery: OpenBSD use proper constants.
Not a workaround, we can be AMP or WATT hour.
-rw-r--r-- | src/modules/battery/e_mod_sysctl.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/modules/battery/e_mod_sysctl.c b/src/modules/battery/e_mod_sysctl.c index 23518b2983..84a751cacd 100644 --- a/src/modules/battery/e_mod_sysctl.c +++ b/src/modules/battery/e_mod_sysctl.c @@ -188,7 +188,7 @@ _battery_sysctl_battery_update() charge = 0; /* last full capacity */ - bat->mib[3] = 7; + bat->mib[3] = SENSOR_WATTHOUR; bat->mib[4] = 0; if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) { @@ -196,31 +196,30 @@ _battery_sysctl_battery_update() } /* remaining capacity */ - bat->mib[3] = 7; + bat->mib[3] = SENSOR_WATTHOUR; bat->mib[4] = 3; if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) { charge = (double)s.value; } - /* This is a workaround because there's an ACPI bug */ if ((EINA_FLT_EQ(charge, 0.0)) || (EINA_FLT_EQ(bat->last_full_charge, 0.0))) { - /* last full capacity */ - bat->mib[3] = 8; - bat->mib[4] = 0; - if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) - { - bat->last_full_charge = (double)s.value; - } - - /* remaining capacity */ - bat->mib[3] = 8; - bat->mib[4] = 3; - if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) - { - charge = (double)s.value; - } + /* last full capacity */ + bat->mib[3] = SENSOR_AMPHOUR; + bat->mib[4] = 0; + if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) + { + bat->last_full_charge = (double)s.value; + } + + /* remaining capacity */ + bat->mib[3] = SENSOR_AMPHOUR; + bat->mib[4] = 3; + if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) + { + charge = (double)s.value; + } } bat->got_prop = 1; |