netstar pushed a commit to branch master.

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

commit 2ee73c7fadccdc9e8878083e97595343a40bddd8
Author: Alastair Poole <nets...@gmail.com>
Date:   Tue Apr 6 17:58:50 2021 +0100

    sensors: Fallback fix
---
 src/bin/system/machine/sensors.bogox | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/bin/system/machine/sensors.bogox 
b/src/bin/system/machine/sensors.bogox
index a8a1f5d..e561475 100644
--- a/src/bin/system/machine/sensors.bogox
+++ b/src/bin/system/machine/sensors.bogox
@@ -453,22 +453,23 @@ _battery_state_get(power_t *power)
           }
         closedir(dir);
 
-        if (!naming)
-          continue;
-
-        snprintf(path, sizeof(path), "%s/%s_full", link, naming);
-        buf = file_contents(path);
-        if (buf)
-          {
-             power->batteries[i]->charge_full = atol(buf);
-             free(buf);
-          }
-        snprintf(path, sizeof(path), "%s/%s_now", link, naming);
-        buf = file_contents(path);
-        if (buf)
+        if (naming)
           {
-             power->batteries[i]->charge_current = atol(buf);
-             free(buf);
+             snprintf(path, sizeof(path), "%s/%s_full", link, naming);
+             buf = file_contents(path);
+             if (buf)
+               {
+                  power->batteries[i]->charge_full = atol(buf);
+                  free(buf);
+               }
+             snprintf(path, sizeof(path), "%s/%s_now", link, naming);
+             buf = file_contents(path);
+             if (buf)
+               {
+                  power->batteries[i]->charge_current = atol(buf);
+                  free(buf);
+               }
+             free(naming);
           }
         else
           {
@@ -488,11 +489,9 @@ _battery_state_get(power_t *power)
                     power->batteries[i]->charge_current = 25;
                   else if (buf[0] == 'C')
                     power->batteries[i]->charge_current = 5;
-
                   free(buf);
                }
           }
-        free(naming);
      }
 done:
    if (link) free(link);

-- 


Reply via email to