raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=f6ab93b7b0a4b6c075416cf9adfb712a2b282070

commit f6ab93b7b0a4b6c075416cf9adfb712a2b282070
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Mon Aug 17 18:19:27 2020 +0100

    temperature - remvoe udev support as it causes mainloop stalls
    
    so this was the hiccups have been seeing... it was temperature +eeze+
    udev stalling out. tempget backend works without stalls so that is now
    the only one.
---
 src/modules/temperature/e_mod_config.c | 114 +++++++++++++--------------------
 src/modules/temperature/e_mod_main.c   |  56 ++--------------
 src/modules/temperature/e_mod_main.h   |  23 -------
 src/modules/temperature/e_mod_udev.c   |  51 ---------------
 src/modules/temperature/meson.build    |   6 --
 5 files changed, 50 insertions(+), 200 deletions(-)

diff --git a/src/modules/temperature/e_mod_config.c 
b/src/modules/temperature/e_mod_config.c
index a355160e2..35e81a0ca 100644
--- a/src/modules/temperature/e_mod_config.c
+++ b/src/modules/temperature/e_mod_config.c
@@ -12,9 +12,6 @@ struct _E_Config_Dialog_Data
      } poll;
 
    int unit_method;
-#ifdef HAVE_EEZE
-   int backend;
-#endif
    struct
      {
         int low, high;
@@ -121,75 +118,67 @@ _fill_data_tempget(E_Config_Dialog_Data *cfdata)
    cfdata->temp.low = cfdata->inst->low;
    cfdata->temp.high = cfdata->inst->high;
    cfdata->sensor = 0;
-#ifdef HAVE_EEZE
-   cfdata->backend = cfdata->inst->backend;
-   if (cfdata->backend == TEMPGET)
+   switch (cfdata->inst->sensor_type)
      {
-#endif
-        switch (cfdata->inst->sensor_type)
+      case SENSOR_TYPE_NONE:
+      case SENSOR_TYPE_FREEBSD:
+      case SENSOR_TYPE_OMNIBOOK:
+      case SENSOR_TYPE_LINUX_MACMINI:
+      case SENSOR_TYPE_LINUX_PBOOK:
+      case SENSOR_TYPE_LINUX_INTELCORETEMP:
+        break;
+      case SENSOR_TYPE_LINUX_I2C:
+        _fill_sensors(cfdata, "i2c");
+        break;
+      case SENSOR_TYPE_LINUX_PCI:
+        _fill_sensors(cfdata, "pci");
+        break;
+      case SENSOR_TYPE_LINUX_ACPI:
           {
-           case SENSOR_TYPE_NONE:
-           case SENSOR_TYPE_FREEBSD:
-           case SENSOR_TYPE_OMNIBOOK:
-           case SENSOR_TYPE_LINUX_MACMINI:
-           case SENSOR_TYPE_LINUX_PBOOK:
-           case SENSOR_TYPE_LINUX_INTELCORETEMP:
-             break;
-           case SENSOR_TYPE_LINUX_I2C:
-             _fill_sensors(cfdata, "i2c");
-             break;
-           case SENSOR_TYPE_LINUX_PCI:
-             _fill_sensors(cfdata, "pci");
-             break;
-           case SENSOR_TYPE_LINUX_ACPI:
+             Eina_List *l;
+
+             if ((l = ecore_file_ls("/proc/acpi/thermal_zone")))
                {
-                  Eina_List *l;
+                  char *name;
+                  int n = 0;
 
-                  if ((l = ecore_file_ls("/proc/acpi/thermal_zone")))
+                  EINA_LIST_FREE(l, name)
                     {
-                       char *name;
-                       int n = 0;
-
-                       EINA_LIST_FREE(l, name)
-                         {
-                            cfdata->sensors =
-                              eina_list_append(cfdata->sensors, name);
-                            if (!strcmp(cfdata->inst->sensor_name, name))
-                              cfdata->sensor = n;
-                            n++;
-                         }
+                       cfdata->sensors =
+                       eina_list_append(cfdata->sensors, name);
+                       if (!strcmp(cfdata->inst->sensor_name, name))
+                       cfdata->sensor = n;
+                       n++;
                     }
-                  break;
                }
-           case SENSOR_TYPE_LINUX_SYS:
+             break;
+          }
+      case SENSOR_TYPE_LINUX_SYS:
+          {
+             Eina_List *l;
+
+             if ((l = ecore_file_ls("/sys/class/thermal")))
                {
-                  Eina_List *l;
+                  char *name;
+                  int n = 0;
 
-                  if ((l = ecore_file_ls("/sys/class/thermal")))
+                  EINA_LIST_FREE(l, name)
                     {
-                       char *name;
-                       int n = 0;
-
-                       EINA_LIST_FREE(l, name)
+                       if (!strncmp(name, "thermal", 7))
                          {
-                            if (!strncmp(name, "thermal", 7))
-                              {
-                                 cfdata->sensors =
-                                    eina_list_append(cfdata->sensors, name);
-                                 if (!strcmp(cfdata->inst->sensor_name, name))
-                                    cfdata->sensor = n;
-                                 n++;
-                              }
+                            cfdata->sensors =
+                            eina_list_append(cfdata->sensors, name);
+                            if (!strcmp(cfdata->inst->sensor_name, name))
+                            cfdata->sensor = n;
+                            n++;
                          }
                     }
-                  break;
                }
-           default:
              break;
           }
-#ifdef HAVE_EEZE
-   }
-#endif
+      default:
+        break;
+     }
 }
 
 static void
@@ -309,16 +298,6 @@ _basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas 
*evas, E_Config_Dialog_Data
 
    e_widget_toolbook_page_append(otb, NULL, _("Temperatures"), ol,
                                  1, 1, 1, 0, 0.0, 0.0);
-#ifdef HAVE_EEZE
-   ol = e_widget_list_add(evas, 0, 0);
-   rg = e_widget_radio_group_new(&(cfdata->backend));
-   ow = e_widget_radio_add(evas, _("Internal"), TEMPGET, rg);
-   e_widget_list_object_append(ol, ow, 1, 1, 0.5);
-   ow = e_widget_radio_add(evas, _("udev"), UDEV, rg);
-   e_widget_list_object_append(ol, ow, 1, 1, 0.5);
-   e_widget_toolbook_page_append(otb, NULL, _("Hardware"), ol,
-                                 1, 1, 1, 0, 0.0, 0.0);
-#endif
    e_widget_toolbook_page_show(otb, 0);
    return otb;
 }
@@ -330,9 +309,6 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, 
E_Config_Dialog_Data *cfdata)
    cfdata->inst->units = cfdata->unit_method;
    cfdata->inst->low = cfdata->temp.low;
    cfdata->inst->high = cfdata->temp.high;
-#ifdef HAVE_EEZE
-   cfdata->inst->backend = cfdata->backend;
-#endif
 
    eina_stringshare_replace(&cfdata->inst->sensor_name,
                             eina_list_nth(cfdata->sensors, cfdata->sensor));
diff --git a/src/modules/temperature/e_mod_main.c 
b/src/modules/temperature/e_mod_main.c
index a5892bc21..dbd6e5547 100644
--- a/src/modules/temperature/e_mod_main.c
+++ b/src/modules/temperature/e_mod_main.c
@@ -50,14 +50,8 @@ static Config *temperature_config = NULL;
 static void
 _temperature_thread_free(Tempthread *tth)
 {
-#if defined(HAVE_EEZE)
-   const char *s;
-#endif
    eina_stringshare_del(tth->sensor_name);
    eina_stringshare_del(tth->sensor_path);
-#if defined(HAVE_EEZE)
-   EINA_LIST_FREE(tth->tempdevs, s) eina_stringshare_del(s);
-#endif
    e_powersave_sleeper_free(tth->sleeper);
    free(tth->extn);
    free(tth);
@@ -114,18 +108,6 @@ _temperature_apply(Config_Face *inst, int temp)
      }
 }
 
-#ifdef HAVE_EEZE
-static Eina_Bool
-_temperature_udev_poll(void *data)
-{
-   Tempthread *tth = data;
-   int temp = temperature_udev_get(tth);
-
-   _temperature_apply(tth->inst, temp);
-   return EINA_TRUE;
-}
-#endif
-
 static E_Gadcon_Client *
 _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
 {
@@ -145,9 +127,6 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, 
const char *style)
         inst->sensor_name = NULL;
         inst->temp = -900;
         inst->units = CELSIUS;
-#ifdef HAVE_EEZE
-        inst->backend = UDEV;
-#endif
         if (!temperature_config->faces)
           temperature_config->faces = eina_hash_string_superfast_new(NULL);
         eina_hash_direct_add(temperature_config->faces, inst->id, inst);
@@ -157,9 +136,6 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, 
const char *style)
    E_CONFIG_LIMIT(inst->low, 0, 100);
    E_CONFIG_LIMIT(inst->high, 0, 220);
    E_CONFIG_LIMIT(inst->units, CELSIUS, FAHRENHEIT);
-#ifdef HAVE_EEZE
-   E_CONFIG_LIMIT(inst->backend, TEMPGET, UDEV);
-#endif
 
    o = edje_object_add(gc->evas);
    e_theme_edje_object_set(o, "base/theme/modules/temperature",
@@ -234,9 +210,6 @@ _gc_id_new(const E_Gadcon_Client_Class *client_class 
EINA_UNUSED)
    inst->sensor_type = SENSOR_TYPE_NONE;
    inst->sensor_name = NULL;
    inst->units = CELSIUS;
-#ifdef HAVE_EEZE
-   inst->backend = TEMPGET;
-#endif
    if (!temperature_config->faces)
      temperature_config->faces = eina_hash_string_superfast_new(NULL);
    eina_hash_direct_add(temperature_config->faces, inst->id, inst);
@@ -293,13 +266,6 @@ _temperature_face_shutdown(const Eina_Hash *hash 
EINA_UNUSED, const void *key EI
    if (inst->th) ecore_thread_cancel(inst->th);
    if (inst->sensor_name) eina_stringshare_del(inst->sensor_name);
    if (inst->id) eina_stringshare_del(inst->id);
-#ifdef HAVE_EEZE
-   if (inst->poller)
-     {
-        ecore_poller_del(inst->poller);
-        _temperature_thread_free(inst->tth);
-     }
-#endif
    E_FREE(inst);
    return EINA_TRUE;
 }
@@ -367,20 +333,11 @@ temperature_face_update_config(Config_Face *inst)
    if (inst->sensor_name)
      tth->sensor_name = eina_stringshare_add(inst->sensor_name);
 
-#ifdef HAVE_EEZE
-   if (inst->backend != TEMPGET)
-     {
-        inst->poller = ecore_poller_add(ECORE_POLLER_CORE, inst->poll_interval,
-                                        _temperature_udev_poll, tth);
-        inst->tth = tth;
-     }
-   else
-#endif
-     inst->th = ecore_thread_feedback_run(_temperature_check_main,
-                                          _temperature_check_notify,
-                                          _temperature_check_done,
-                                          _temperature_check_done,
-                                          tth, EINA_TRUE);
+   inst->th = ecore_thread_feedback_run(_temperature_check_main,
+                                        _temperature_check_notify,
+                                        _temperature_check_done,
+                                        _temperature_check_done,
+                                        tth, EINA_TRUE);
 }
 
 /* module setup */
@@ -403,9 +360,6 @@ e_modapi_init(E_Module *m)
    E_CONFIG_VAL(D, T, low, INT);
    E_CONFIG_VAL(D, T, high, INT);
    E_CONFIG_VAL(D, T, sensor_type, INT);
-#ifdef HAVE_EEZE
-   E_CONFIG_VAL(D, T, backend, INT);
-#endif
    E_CONFIG_VAL(D, T, sensor_name, STR);
    E_CONFIG_VAL(D, T, units, INT);
 
diff --git a/src/modules/temperature/e_mod_main.h 
b/src/modules/temperature/e_mod_main.h
index 5c49e442a..4eb557957 100644
--- a/src/modules/temperature/e_mod_main.h
+++ b/src/modules/temperature/e_mod_main.h
@@ -3,11 +3,6 @@
 
 #include "e.h"
 
-#ifdef HAVE_EEZE
-# include <Eeze.h>
-#endif
-
-
 typedef enum _Sensor_Type
 {
    SENSOR_TYPE_NONE,
@@ -43,9 +38,6 @@ struct _Tempthread
    const char *sensor_path;
    void *extn;
    E_Powersave_Sleeper *sleeper;
-#ifdef HAVE_EEZE
-   Eina_List *tempdevs;
-#endif
    Eina_Bool initted E_BITFIELD;
 };
 
@@ -62,11 +54,6 @@ struct _Config_Face
    /* config state */
    E_Gadcon_Client *gcc;
    Evas_Object *o_temp;
-#ifdef HAVE_EEZE
-   Ecore_Poller *poller;
-   Tempthread *tth;
-   int backend;
-#endif
    E_Module *module;
 
    E_Config_Dialog *config_dialog;
@@ -84,16 +71,6 @@ struct _Config
    E_Module *module;
 };
 
-#ifdef HAVE_EEZE
-typedef enum _Backend
-{
-   TEMPGET,
-   UDEV
-} Backend;
-
-int temperature_udev_get(Tempthread *tth);
-#endif
-
 E_API extern E_Module_Api e_modapi;
 
 E_API void *e_modapi_init(E_Module *m);
diff --git a/src/modules/temperature/e_mod_udev.c 
b/src/modules/temperature/e_mod_udev.c
deleted file mode 100644
index 1dafb3109..000000000
--- a/src/modules/temperature/e_mod_udev.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "e.h"
-#include "e_mod_main.h"
-
-int
-temperature_udev_get(Tempthread *tth)
-{
-   Eina_List *l;
-   double cur, temp;
-   char *syspath;
-   const char *test;
-   char buf[256];
-   int x, y, cpus = 0;
-
-   temp = -999;
-
-   if (!tth->tempdevs)
-     tth->tempdevs =
-       eeze_udev_find_by_type(EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR,
-                              NULL);
-   if (tth->tempdevs)
-     {
-        temp = 0;
-        EINA_LIST_FOREACH(tth->tempdevs, l, syspath)
-          {
-             for (x = 1, y = 0; x < 15; x++)
-               {
-                  if (y >= 2) break;
-                  sprintf(buf, "temp%d_input", x);
-                  if ((test = eeze_udev_syspath_get_sysattr(syspath, buf)))
-                    {
-                       y = 0;
-                       cur = atoi(test);
-                       if (cur > 0)
-                         {
-                            /* udev reports temp in (celsius * 1000) */
-                            temp += (cur / 1000);
-                            cpus++;
-                         }
-                    }
-                  /* keep checking for sensors until 2 in a row don't exist */
-                  else y++;
-               }
-          }
-        if (cpus > 0)
-          {
-             temp /= (double)cpus;
-             return temp;
-          }
-     }
-   return -999;
-}
diff --git a/src/modules/temperature/meson.build 
b/src/modules/temperature/meson.build
index 0846a8654..c41c0d3c7 100644
--- a/src/modules/temperature/meson.build
+++ b/src/modules/temperature/meson.build
@@ -4,9 +4,3 @@ src = files(
   'e_mod_tempget.c',
   'e_mod_main.h'
  )
-
-if get_option('device-udev') == true
-   src += files(
-    'e_mod_udev.c'
-   )
-endif

-- 


Reply via email to