netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=aa1822c2124c3fb16562214703faaaf3c5f125a7

commit aa1822c2124c3fb16562214703faaaf3c5f125a7
Author: Alastair Poole <nets...@gmail.com>
Date:   Sat Jul 11 18:48:13 2020 +0100

    machine: ahead of the game...
    
    Meh, we can't yet query by type.
---
 src/bin/system/machine/sensors.bogox | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/src/bin/system/machine/sensors.bogox 
b/src/bin/system/machine/sensors.bogox
index fbb6829..5562123 100644
--- a/src/bin/system/machine/sensors.bogox
+++ b/src/bin/system/machine/sensors.bogox
@@ -118,8 +118,6 @@ _power_battery_count_get(power_t *power)
 {
 #if defined(__OpenBSD__)
    struct sensordev snsrdev;
-   struct sensor snsr;
-   size_t slen = sizeof(struct sensor);
    size_t sdlen = sizeof(struct sensordev);
    int mibs[5] = { CTL_HW, HW_SENSORS, 0, 0, 0 };
    int i, devn;
@@ -134,20 +132,7 @@ _power_battery_count_get(power_t *power)
                break;
           }
 
-        for (int n = 0; n < snsrdev.maxnumt[SENSOR_WATTHOUR]; n++) {
-             mibs[4] = n;
-
-             if (sysctl(mibs, 5, &snsr, &slen, NULL, 0) == -1)
-               continue;
-
-             if (slen > 0 && (snsr.flags & SENSOR_FINVALID) == 0)
-               break;
-          }
-
-        if (sysctl(mibs, 5, &snsr, &slen, NULL, 0) == -1)
-          continue;
-
-        if ((snsr.type == SENSOR_AMPHOUR) || (snsr.type == SENSOR_WATTHOUR))
+        if (!strncmp(snsrdev.xname, "acpibat", 7))
           {
              i = power->battery_count;
              power->batteries = realloc(power->batteries, 1 +
@@ -162,7 +147,6 @@ _power_battery_count_get(power_t *power)
              tmp[1] = mibs[1];
              tmp[2] = mibs[2];
           }
-
         if (!strcmp("acpiac0", snsrdev.xname))
           {
              power->ac_mibs[0] = mibs[0];

-- 


Reply via email to