netstar pushed a commit to branch master.

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

commit c0c26ff8821c816ea371a77b6c238857b182bf9e
Author: Alastair Poole <[email protected]>
Date:   Sat Jul 11 18:24:30 2020 +0100

    machine: linux battery model/vendor purge
    
    If enough people complain i'll bring this back, but for now keep
    it simple until i can test it again properly...it works but
    it's horrible
---
 src/bin/system/machine/sensors.bogox | 33 +++------------------------------
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/src/bin/system/machine/sensors.bogox 
b/src/bin/system/machine/sensors.bogox
index 5562123..7aa8918 100644
--- a/src/bin/system/machine/sensors.bogox
+++ b/src/bin/system/machine/sensors.bogox
@@ -277,7 +277,6 @@ _battery_state_get(power_t *power)
    struct dirent *dh;
    struct stat st;
    DIR *dir;
-   char *model, *vendor;
    char *buf, *naming = NULL;
 
    for (int i = 0; i < power->battery_count; i++) {
@@ -290,6 +289,7 @@ _battery_state_get(power_t *power)
 
         dir = opendir(path);
         if (!dir) return;
+
         while ((dh = readdir(dir)) != NULL)
           {
              char *e;
@@ -306,45 +306,18 @@ _battery_state_get(power_t *power)
         if (!naming)
           continue;
 
-        buf = file_contents(strsli_printf("/sys/class/power_supply/%s/%s_full",
-                            power->batteries[i]->name, naming));
+        buf = 
file_contents(strsli_printf("/sys/class/power_supply/%s/%s_full", 
power->batteries[i]->name, naming));
         if (buf)
           {
              power->batteries[i]->charge_full = atol(buf);
              free(buf);
           }
-        buf = file_contents(strsli_printf("/sys/class/power_supply/%s/%s_now",
-                            power->batteries[i]->name, naming));
+        buf = file_contents(strsli_printf("/sys/class/power_supply/%s/%s_now", 
power->batteries[i]->name, naming));
         if (buf)
           {
              power->batteries[i]->charge_current = atol(buf);
              free(buf);
           }
-
-        vendor = 
file_contents(strsli_printf("/sys/class/power_supply/%s/manufacturer",
-                               power->batteries[i]->name));
-        model = 
file_contents(strsli_printf("/sys/class/power_supply/%s/model_name",
-                              power->batteries[i]->name));
-
-        if (vendor && vendor[0] && model && model[0])
-          {
-             int len;
-
-             len = strlen(vendor) - 1;
-             if (vendor[len] == '\n' || vendor[len] == '\r')
-               vendor[len] = '\0';
-
-             len = strlen(model) - 1;
-             if (model[len] == '\n' || model[len] == '\r')
-               model[len] = '\0';
-
-             free(power->batteries[i]->name);;
-             power->batteries[i]->name = strdup(strsli_printf("%s %s", vendor, 
model));
-          }
-        if (model)
-          free(model);
-        if (vendor)
-          free(vendor);
         free(naming);
      }
 #endif

-- 


Reply via email to