summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2020-07-09 01:11:31 +0100
committerAlastair Poole <netstar@gmail.com>2020-07-09 01:11:31 +0100
commit1fa239b404ead097c1e019f6cdad6eb5f9f2f7e0 (patch)
tree366fdd2f375317959a0c90cde298e6902623921c
parent12ddeaa2d1450130054bd0b9f131f409b3948b30 (diff)
battery: OpenBSD use proper constants.HEADmaster
Not a workaround, we can be AMP or WATT hour.
-rw-r--r--src/modules/battery/e_mod_sysctl.c35
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 23518b298..84a751cac 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()
188 charge = 0; 188 charge = 0;
189 189
190 /* last full capacity */ 190 /* last full capacity */
191 bat->mib[3] = 7; 191 bat->mib[3] = SENSOR_WATTHOUR;
192 bat->mib[4] = 0; 192 bat->mib[4] = 0;
193 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) 193 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1)
194 { 194 {
@@ -196,31 +196,30 @@ _battery_sysctl_battery_update()
196 } 196 }
197 197
198 /* remaining capacity */ 198 /* remaining capacity */
199 bat->mib[3] = 7; 199 bat->mib[3] = SENSOR_WATTHOUR;
200 bat->mib[4] = 3; 200 bat->mib[4] = 3;
201 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) 201 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1)
202 { 202 {
203 charge = (double)s.value; 203 charge = (double)s.value;
204 } 204 }
205 205
206 /* This is a workaround because there's an ACPI bug */
207 if ((EINA_FLT_EQ(charge, 0.0)) || (EINA_FLT_EQ(bat->last_full_charge, 0.0))) 206 if ((EINA_FLT_EQ(charge, 0.0)) || (EINA_FLT_EQ(bat->last_full_charge, 0.0)))
208 { 207 {
209 /* last full capacity */ 208 /* last full capacity */
210 bat->mib[3] = 8; 209 bat->mib[3] = SENSOR_AMPHOUR;
211 bat->mib[4] = 0; 210 bat->mib[4] = 0;
212 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) 211 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1)
213 { 212 {
214 bat->last_full_charge = (double)s.value; 213 bat->last_full_charge = (double)s.value;
215 } 214 }
216 215
217 /* remaining capacity */ 216 /* remaining capacity */
218 bat->mib[3] = 8; 217 bat->mib[3] = SENSOR_AMPHOUR;
219 bat->mib[4] = 3; 218 bat->mib[4] = 3;
220 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1) 219 if (sysctl(bat->mib, 5, &s, &slen, NULL, 0) != -1)
221 { 220 {
222 charge = (double)s.value; 221 charge = (double)s.value;
223 } 222 }
224 } 223 }
225 224
226 bat->got_prop = 1; 225 bat->got_prop = 1;