Feel free, just create an eeze_xyz prefix for your platform and start hacking!
On Fri, Dec 2, 2016 at 1:42 PM Al Poole <[email protected]> wrote: > On that side note, That's something I'm interested in doing. > > > On Fri, Dec 2, 2016 at 5:20 PM, Mike Blumenkrantz < > [email protected]> wrote: > > > Eeze is a device layer abstraction library; the eeze_udev API namespace > is > > so named because every function in its namespace interfaces directly with > > udev. > > > > As a side note, the reason why eeze_udev is the only (and quite a low > > level) API namespace is because nobody using other platforms has > > contributed corresponding APIs for those platforms. > > > > On Fri, Dec 2, 2016 at 11:53 AM Carsten Haitzler <[email protected]> > > wrote: > > > > > On Fri, 02 Dec 2016 14:23:23 +0000 Mike Blumenkrantz > > > <[email protected]> said: > > > > > > > It looks like this calls eeze (and thus udev) functions in a thread. > > udev > > > > is not threadsafe, and using eeze's global context in this way will > > > result > > > > in thread collisions. > > > > > > i thought all eeze was doing was opening /sys files and reading > them...? > > > > > > > On Wed, Nov 30, 2016 at 6:50 PM Carsten Haitzler < > [email protected] > > > > > > > wrote: > > > > > > > > > raster pushed a commit to branch master. > > > > > > > > > > > > > > > > > > http://git.enlightenment.org/core/enlightenment.git/commit/?id= > > a94ba7cbfdeb310c32b5d4655631d2612e66fb40 > > > > > > > > > > commit a94ba7cbfdeb310c32b5d4655631d2612e66fb40 > > > > > Author: Carsten Haitzler (Rasterman) <[email protected]> > > > > > Date: Wed Nov 30 17:06:45 2016 +0900 > > > > > > > > > > e tempget module - mode to using threads instead of tempget > > binary > > > > > > > > > > this should reduce mem usage by a sub binary and aso solve the > > sub > > > > > shell kill issue too nd still keep the polling of system status > > > out of > > > > > the mainloop and keep it unblocked. > > > > > --- > > > > > src/modules/Makefile_temperature.mk | 11 +- > > > > > src/modules/temperature/e_mod_config.c | 44 +++ > > > > > src/modules/temperature/e_mod_main.c | 236 +++++------- > > > > > src/modules/temperature/e_mod_main.h | 41 ++- > > > > > src/modules/temperature/e_mod_tempget.c | 604 > > > > > +++++++++++++++++++++++++++--- > > > > > src/modules/temperature/e_mod_udev.c | 70 +--- > > > > > src/modules/temperature/tempget.c | 634 > > > > > -------------------------------- > > > > > 7 files changed, 730 insertions(+), 910 deletions(-) > > > > > > > > > > diff --git a/src/modules/Makefile_temperature.mk > > > b/src/modules/Makefile_ > > > > > temperature.mk > > > > > index b583063..d1cb7fb 100644 > > > > > --- a/src/modules/Makefile_temperature.mk > > > > > +++ b/src/modules/Makefile_temperature.mk > > > > > @@ -22,14 +22,7 @@ if HAVE_EEZE > > > > > src_modules_temperature_module_la_SOURCES += > > > > > src/modules/temperature/e_mod_udev.c > > > > > endif > > > > > > > > > > -src_modules_temperature_tempgetdir = $(temperaturepkgdir) > > > > > -src_modules_temperature_tempget_PROGRAMS = > > > src/modules/temperature/tempget > > > > > - > > > > > -src_modules_temperature_tempget_CPPFLAGS = $(MOD_CPPFLAGS) > > > > > -src_modules_temperature_tempget_LDADD = $(MOD_LIBS) > > > > > -src_modules_temperature_tempget_SOURCES = > > > > > src/modules/temperature/tempget.c > > > > > - > > > > > PHONIES += temperature install-temperature > > > > > -temperature: $(temperaturepkg_LTLIBRARIES) $(temperature_DATA) > > > > > $(src_modules_temperature_tempget_PROGRAMS) > > > > > -install-temperature: install-temperatureDATA > > > > > install-temperaturepkgLTLIBRARIES > > > > > install-src_modules_temperature_tempgetPROGRAMS > > > > > +temperature: $(temperaturepkg_LTLIBRARIES) $(temperature_DATA) > > > > > +install-temperature: install-temperatureDATA > > > > > install-temperaturepkgLTLIBRARIES > > > > > endif > > > > > diff --git a/src/modules/temperature/e_mod_config.c > > > > > b/src/modules/temperature/e_mod_config.c > > > > > index 57f5212..597184e 100644 > > > > > --- a/src/modules/temperature/e_mod_config.c > > > > > +++ b/src/modules/temperature/e_mod_config.c > > > > > @@ -37,6 +37,50 @@ static Evas_Object > *_basic_create(E_Config_Dialog > > > *cfd, > > > > > Evas *evas, E_Config_Dia > > > > > static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data > > > > > *cfdata); > > > > > static void _cb_display_changed(void *data, Evas_Object *obj > > > EINA_UNUSED); > > > > > > > > > > +static Eina_List * > > > > > +temperature_get_bus_files(const char *bus) > > > > > +{ > > > > > + Eina_List *result; > > > > > + Eina_List *therms; > > > > > + char path[PATH_MAX]; > > > > > + char busdir[PATH_MAX]; > > > > > + char *name; > > > > > + > > > > > + result = NULL; > > > > > + > > > > > + snprintf(busdir, sizeof(busdir), "/sys/bus/%s/devices", bus); > > > > > + /* Look through all the devices for the given bus. */ > > > > > + therms = ecore_file_ls(busdir); > > > > > + > > > > > + EINA_LIST_FREE(therms, name) > > > > > + { > > > > > + Eina_List *files; > > > > > + char *file; > > > > > + > > > > > + /* Search each device for temp*_input, these should be > > > > > + * temperature devices. */ > > > > > + snprintf(path, sizeof(path), "%s/%s", busdir, name); > > > > > + files = ecore_file_ls(path); > > > > > + EINA_LIST_FREE(files, file) > > > > > + { > > > > > + if ((!strncmp("temp", file, 4)) && > > > > > + (!strcmp("_input", &file[strlen(file) - 6]))) > > > > > + { > > > > > + char *f; > > > > > + > > > > > + snprintf(path, sizeof(path), > > > > > + "%s/%s/%s", busdir, name, file); > > > > > + f = strdup(path); > > > > > + if (f) result = eina_list_append(result, f); > > > > > + } > > > > > + free(file); > > > > > + } > > > > > + free(name); > > > > > + } > > > > > + return result; > > > > > +} > > > > > + > > > > > + > > > > > void > > > > > config_temperature_module(Config_Face *inst) > > > > > { > > > > > diff --git a/src/modules/temperature/e_mod_main.c > > > > > b/src/modules/temperature/e_mod_main.c > > > > > index 345b7e6..41e1c38 100644 > > > > > --- a/src/modules/temperature/e_mod_main.c > > > > > +++ b/src/modules/temperature/e_mod_main.c > > > > > @@ -83,7 +83,7 @@ _gc_init(E_Gadcon *gc, const char *name, const > char > > > *id, > > > > > const char *style) > > > > > > > > > > o = edje_object_add(gc->evas); > > > > > e_theme_edje_object_set(o, "base/theme/modules/temperature", > > > > > - "e/modules/temperature/main"); > > > > > + "e/modules/temperature/main"); > > > > > > > > > > gcc = e_gadcon_client_new(gc, name, id, style, o); > > > > > gcc->data = inst; > > > > > @@ -92,37 +92,13 @@ _gc_init(E_Gadcon *gc, const char *name, const > > char > > > > > *id, const char *style) > > > > > inst->o_temp = o; > > > > > inst->module = temperature_config->module; > > > > > inst->have_temp = EINA_FALSE; > > > > > -#ifdef HAVE_EEZE > > > > > - if (inst->backend == TEMPGET) > > > > > - { > > > > > - inst->tempget_data_handler = > > > > > - ecore_event_handler_add(ECORE_EXE_EVENT_DATA, > > > > > - _temperature_cb_exe_data, inst); > > > > > - inst->tempget_del_handler = > > > > > - ecore_event_handler_add(ECORE_EXE_EVENT_DEL, > > > > > - _temperature_cb_exe_del, inst); > > > > > - } > > > > > - else > > > > > - { > > > > > - eeze_init(); > > > > > - inst->temp_poller = > > > > > - ecore_poller_add(ECORE_POLLER_CORE, inst->poll_interval, > > > > > - temperature_udev_update_poll, inst); > > > > > - temperature_udev_update(inst); > > > > > - } > > > > > -#else > > > > > - inst->tempget_data_handler = > > > > > - ecore_event_handler_add(ECORE_EXE_EVENT_DATA, > > > > > - _temperature_cb_exe_data, inst); > > > > > - inst->tempget_del_handler = > > > > > - ecore_event_handler_add(ECORE_EXE_EVENT_DEL, > > > > > - _temperature_cb_exe_del, inst); > > > > > +#ifdef HAVE_EEEZ_UDEV > > > > > + eeze_init(); > > > > > #endif > > > > > - > > > > > temperature_face_update_config(inst); > > > > > > > > > > evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, > > > > > - _temperature_face_cb_mouse_down, > > > inst); > > > > > + _temperature_face_cb_mouse_down, > > > inst); > > > > > return gcc; > > > > > } > > > > > > > > > > @@ -133,25 +109,7 @@ _gc_shutdown(E_Gadcon_Client *gcc) > > > > > > > > > > inst = gcc->data; > > > > > > > > > > - if (inst->tempget_exe) > > > > > - { > > > > > - ecore_exe_kill(inst->tempget_exe); > > > > > - ecore_exe_free(inst->tempget_exe); > > > > > - inst->tempget_exe = NULL; > > > > > - } > > > > > - if (inst->tempget_data_handler) > > > > > - { > > > > > - ecore_event_handler_del(inst->tempget_data_handler); > > > > > - inst->tempget_data_handler = NULL; > > > > > - } > > > > > - if (inst->tempget_del_handler) > > > > > - { > > > > > - ecore_event_handler_del(inst->tempget_del_handler); > > > > > - inst->tempget_del_handler = NULL; > > > > > - } > > > > > #ifdef HAVE_EEEZ_UDEV > > > > > - if (inst->temp_poller) > > > > > - ecore_poller_del(inst->temp_poller); > > > > > eeze_shutdown(); > > > > > #endif > > > > > if (inst->o_temp) evas_object_del(inst->o_temp); > > > > > @@ -181,7 +139,7 @@ _gc_icon(const E_Gadcon_Client_Class > > *client_class > > > > > EINA_UNUSED, Evas *evas) > > > > > > > > > > o = edje_object_add(evas); > > > > > snprintf(buf, sizeof(buf), "%s/e-module-temperature.edj", > > > > > - e_module_dir_get(temperature_config->module)); > > > > > + e_module_dir_get(temperature_config->module)); > > > > > edje_object_file_set(o, buf, "icon"); > > > > > return o; > > > > > } > > > > > @@ -242,7 +200,7 @@ _temperature_face_cb_mouse_down(void *data, > > Evas *e > > > > > EINA_UNUSED, Evas_Object *ob > > > > > } > > > > > } > > > > > > > > > > -void > > > > > +static void > > > > > _temperature_face_level_set(Config_Face *inst, double level) > > > > > { > > > > > Edje_Message_Float msg; > > > > > @@ -269,17 +227,9 @@ _temperature_face_shutdown(const Eina_Hash > > *hash > > > > > EINA_UNUSED, const void *key EI > > > > > Config_Face *inst; > > > > > > > > > > inst = hdata; > > > > > + 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->tempdevs) > > > > > - { > > > > > - const char *s; > > > > > - > > > > > - EINA_LIST_FREE(inst->tempdevs, s) > > > > > - eina_stringshare_del(s); > > > > > - } > > > > > -#endif > > > > > E_FREE(inst); > > > > > return EINA_TRUE; > > > > > } > > > > > @@ -298,113 +248,105 @@ _temperature_face_id_max(const Eina_Hash > > *hash > > > > > EINA_UNUSED, const void *key, voi > > > > > return EINA_TRUE; > > > > > } > > > > > > > > > > -void > > > > > -temperature_face_update_config(Config_Face *inst) > > > > > +static void > > > > > +_temprature_check_main(void *data, Ecore_Thread *th) > > > > > { > > > > > - char buf[8192]; > > > > > + Tempthread *tth = data; > > > > > + int ptemp = -500, temp; > > > > > > > > > > - if (inst->tempget_exe) > > > > > + for (;;) > > > > > { > > > > > - ecore_exe_kill(inst->tempget_exe); > > > > > - ecore_exe_free(inst->tempget_exe); > > > > > - inst->tempget_exe = NULL; > > > > > + if (ecore_thread_check(th)) break; > > > > > + temp = -999; > > > > > +#ifdef HAVE_EEZE > > > > > + if (tth->udev) temp = temperature_udev_get(tth); > > > > > + else > > > > > +#endif > > > > > + temp = temperature_tempget_get(tth); > > > > > + > > > > > + if (ptemp != temp) ecore_thread_feedback(th, (void > > > > > *)((long)temp)); > > > > > + ptemp = temp; > > > > > + usleep((1000000.0 / 8.0) * (double)tth->poll_interval); > > > > > + if (ecore_thread_check(th)) break; > > > > > } > > > > > +} > > > > > > > > > > -#ifdef HAVE_EEZE > > > > > - if (inst->backend == TEMPGET) > > > > > +static void > > > > > +_temprature_check_notify(void *data, Ecore_Thread *th, void *msg) > > > > > +{ > > > > > + Tempthread *tth = data; > > > > > + Config_Face *inst = tth->inst; > > > > > + int temp = (int)((long)msg); > > > > > + char buf[64]; > > > > > + > > > > > + if (th != inst->th) return; > > > > > + if (temp != -999) > > > > > { > > > > > - if (inst->temp_poller) > > > > > + if (inst->units == FAHRENHEIT) temp = (temp * 9.0 / 5.0) + > > 32; > > > > > + > > > > > + if (!inst->have_temp) > > > > > { > > > > > - ecore_poller_del(inst->temp_poller); > > > > > - inst->temp_poller = NULL; > > > > > + /* enable therm object */ > > > > > + edje_object_signal_emit(inst->o_temp, > "e,state,known", > > > ""); > > > > > + inst->have_temp = EINA_TRUE; > > > > > } > > > > > - if (!inst->tempget_exe) > > > > > - { > > > > > - snprintf(buf, sizeof(buf), > > > > > - "exec %s/%s/tempget %i \"%s\" %i", > > > > > - e_module_dir_get(temperature_config->module), > > > > > MODULE_ARCH, > > > > > - inst->sensor_type, > > > > > - (inst->sensor_name ? inst->sensor_name : > > > "(null)"), > > > > > - inst->poll_interval); > > > > > - inst->tempget_exe = > > > > > - ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | > > > > > - > ECORE_EXE_PIPE_READ_LINE_BUFFERED > > | > > > > > - ECORE_EXE_NOT_LEADER | > > > > > - ECORE_EXE_TERM_WITH_PARENT, > inst); > > > > > - } > > > > > - } > > > > > - else if (inst->backend == UDEV) > > > > > - { > > > > > - /*avoid creating a new poller if possible*/ > > > > > - if (inst->temp_poller) > > > > > - ecore_poller_poller_interval_set(inst->temp_poller, > > > > > - inst->poll_interval); > > > > > - else > > > > > - { > > > > > - inst->temp_poller = > > > > > - ecore_poller_add(ECORE_POLLER_CORE, > > inst->poll_interval, > > > > > - temperature_udev_update_poll, > inst); > > > > > - } > > > > > + if (inst->units == FAHRENHEIT) > > > > > + snprintf(buf, sizeof(buf), "%i°F", temp); > > > > > + else > > > > > + snprintf(buf, sizeof(buf), "%i°C", temp); > > > > > + > > > > > + _temperature_face_level_set(inst, > > > > > + (double)(temp - inst->low) / > > > > > + (double)(inst->high - > > inst->low)); > > > > > + edje_object_part_text_set(inst->o_temp, "e.text.reading", > > > buf); > > > > > } > > > > > -#else > > > > > - if (!inst->tempget_exe) > > > > > + else > > > > > { > > > > > - snprintf(buf, sizeof(buf), > > > > > - "%s/%s/tempget %i \"%s\" %i", > > > > > - e_module_dir_get(temperature_config->module), > > > MODULE_ARCH, > > > > > - inst->sensor_type, > > > > > - (inst->sensor_name ? inst->sensor_name : > "(null)"), > > > > > - inst->poll_interval); > > > > > - inst->tempget_exe = > > > > > - ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | > > > > > - ECORE_EXE_PIPE_READ_LINE_BUFFERED | > > > > > - ECORE_EXE_NOT_LEADER | > > > > > - ECORE_EXE_TERM_WITH_PARENT, inst); > > > > > + if (inst->have_temp) > > > > > + { > > > > > + /* disable therm object */ > > > > > + edje_object_signal_emit(inst->o_temp, > > "e,state,unknown", > > > ""); > > > > > + edje_object_part_text_set(inst->o_temp, > > "e.text.reading", > > > > > "N/A"); > > > > > + _temperature_face_level_set(inst, 0.5); > > > > > + inst->have_temp = EINA_FALSE; > > > > > + } > > > > > } > > > > > -#endif > > > > > } > > > > > > > > > > -Eina_List * > > > > > -temperature_get_bus_files(const char *bus) > > > > > +static void > > > > > +_temprature_check_done(void *data, Ecore_Thread *th) > > > > > { > > > > > - Eina_List *result; > > > > > - Eina_List *therms; > > > > > - char path[PATH_MAX]; > > > > > - char busdir[PATH_MAX]; > > > > > - char *name; > > > > > + Tempthread *tth = data; > > > > > + const char *s; > > > > > + > > > > > + eina_stringshare_del(tth->sensor_name); > > > > > + eina_stringshare_del(tth->sensor_path); > > > > > + EINA_LIST_FREE(tth->tempdevs, s) eina_stringshare_del(s); > > > > > + free(tth->extn); > > > > > + free(tth); > > > > > +} > > > > > > > > > > - result = NULL; > > > > > +void > > > > > +temperature_face_update_config(Config_Face *inst) > > > > > +{ > > > > > + Tempthread *tth; > > > > > > > > > > - snprintf(busdir, sizeof(busdir), "/sys/bus/%s/devices", bus); > > > > > - /* Look through all the devices for the given bus. */ > > > > > - therms = ecore_file_ls(busdir); > > > > > + if (inst->th) ecore_thread_cancel(inst->th); > > > > > > > > > > - EINA_LIST_FREE(therms, name) > > > > > - { > > > > > - Eina_List *files; > > > > > - char *file; > > > > > - > > > > > - /* Search each device for temp*_input, these should be > > > > > - * temperature devices. */ > > > > > - snprintf(path, sizeof(path), "%s/%s", busdir, name); > > > > > - files = ecore_file_ls(path); > > > > > - EINA_LIST_FREE(files, file) > > > > > - { > > > > > - if ((!strncmp("temp", file, 4)) && > > > > > - (!strcmp("_input", &file[strlen(file) - 6]))) > > > > > - { > > > > > - char *f; > > > > > - > > > > > - snprintf(path, sizeof(path), > > > > > - "%s/%s/%s", busdir, name, file); > > > > > - f = strdup(path); > > > > > - if (f) result = eina_list_append(result, f); > > > > > - } > > > > > - free(file); > > > > > - } > > > > > - free(name); > > > > > - } > > > > > - return result; > > > > > + tth = calloc(1, sizeof(Tempthread)); > > > > > + tth->poll_interval = inst->poll_interval; > > > > > +#ifdef HAVE_EEZE > > > > > + if (inst->backend != TEMPGET) tth->udev = EINA_TRUE; > > > > > +#endif > > > > > + tth->sensor_type = inst->sensor_type; > > > > > + tth->inst = inst; > > > > > + if (inst->sensor_name) > > > > > + tth->sensor_name = eina_stringshare_add(inst->sensor_name); > > > > > + inst->th = ecore_thread_feedback_run(_temprature_check_main, > > > > > + _temprature_check_notify, > > > > > + _temprature_check_done, > > > > > + _temprature_check_done, > > > > > + tth, EINA_TRUE); > > > > > } > > > > > > > > > > /* module setup */ > > > > > diff --git a/src/modules/temperature/e_mod_main.h > > > > > b/src/modules/temperature/e_mod_main.h > > > > > index 08a60b1..b096b4f 100644 > > > > > --- a/src/modules/temperature/e_mod_main.h > > > > > +++ b/src/modules/temperature/e_mod_main.h > > > > > @@ -26,6 +26,7 @@ typedef enum _Sensor_Type > > > > > > > > > > typedef struct _Config Config; > > > > > typedef struct _Config_Face Config_Face; > > > > > +typedef struct _Tempthread Tempthread; > > > > > > > > > > typedef enum _Unit > > > > > { > > > > > @@ -33,36 +34,43 @@ typedef enum _Unit > > > > > FAHRENHEIT > > > > > } Unit; > > > > > > > > > > +struct _Tempthread > > > > > +{ > > > > > + Config_Face *inst; > > > > > + int poll_interval; > > > > > + Sensor_Type sensor_type; > > > > > + const char *sensor_name; > > > > > + const char *sensor_path; > > > > > + void *extn; > > > > > +#ifdef HAVE_EEZE > > > > > + Eina_List *tempdevs; > > > > > + Eina_Bool udev : 1; > > > > > +#endif > > > > > + Eina_Bool initted : 1; > > > > > +}; > > > > > + > > > > > struct _Config_Face > > > > > { > > > > > const char *id; > > > > > /* saved * loaded config values */ > > > > > int poll_interval; > > > > > int low, high; > > > > > -#ifdef HAVE_EEZE > > > > > - Eina_List *tempdevs; > > > > > - int backend; > > > > > - Ecore_Poller *temp_poller; > > > > > -#endif > > > > > int sensor_type; > > > > > const char *sensor_name; > > > > > Unit units; > > > > > /* config state */ > > > > > E_Gadcon_Client *gcc; > > > > > Evas_Object *o_temp; > > > > > - > > > > > +#ifdef HAVE_EEZE > > > > > + int backend; > > > > > +#endif > > > > > E_Module *module; > > > > > > > > > > E_Config_Dialog *config_dialog; > > > > > E_Menu *menu; > > > > > - Ecore_Exe *tempget_exe; > > > > > - Ecore_Event_Handler *tempget_data_handler; > > > > > - Ecore_Event_Handler *tempget_del_handler; > > > > > + Ecore_Thread *th; > > > > > > > > > > Eina_Bool have_temp:1; > > > > > -#if defined (__FreeBSD__) || defined (__OpenBSD__) > > > > > - int mib[5]; > > > > > -#endif > > > > > }; > > > > > > > > > > struct _Config > > > > > @@ -80,8 +88,7 @@ typedef enum _Backend > > > > > UDEV > > > > > } Backend; > > > > > > > > > > -Eina_Bool temperature_udev_update_poll(void *data); > > > > > -void temperature_udev_update(void *data); > > > > > +int temperature_udev_get(Tempthread *tth); > > > > > #endif > > > > > > > > > > E_API extern E_Module_Api e_modapi; > > > > > @@ -90,12 +97,10 @@ E_API void *e_modapi_init(E_Module *m); > > > > > E_API int e_modapi_shutdown(E_Module *m); > > > > > E_API int e_modapi_save(E_Module *m); > > > > > > > > > > -Eina_Bool _temperature_cb_exe_data(void *data, int type, void > > *event); > > > > > -Eina_Bool _temperature_cb_exe_del(void *data, int type, void > > *event); > > > > > -void _temperature_face_level_set(Config_Face *inst, double level); > > > > > void config_temperature_module(Config_Face *inst); > > > > > void temperature_face_update_config(Config_Face *inst); > > > > > -Eina_List *temperature_get_bus_files(const char* bus); > > > > > + > > > > > +int temperature_tempget_get(Tempthread *tth); > > > > > > > > > > /** > > > > > * @addtogroup Optional_Gadgets > > > > > diff --git a/src/modules/temperature/e_mod_tempget.c > > > > > b/src/modules/temperature/e_mod_tempget.c > > > > > index 5091d07..d4078c3 100644 > > > > > --- a/src/modules/temperature/e_mod_tempget.c > > > > > +++ b/src/modules/temperature/e_mod_tempget.c > > > > > @@ -1,76 +1,580 @@ > > > > > #include "e.h" > > > > > #include "e_mod_main.h" > > > > > > > > > > -Eina_Bool > > > > > -_temperature_cb_exe_data(void *data, EINA_UNUSED int type, void > > > *event) > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > +# include <sys/types.h> > > > > > +# include <sys/sysctl.h> > > > > > +# include <errno.h> > > > > > +#endif > > > > > + > > > > > +#ifdef __OpenBSD__ > > > > > +#include <sys/param.h> > > > > > +#include <sys/sysctl.h> > > > > > +#include <sys/sensors.h> > > > > > +#include <errno.h> > > > > > +#include <err.h> > > > > > +#endif > > > > > + > > > > > +typedef struct > > > > > { > > > > > - Ecore_Exe_Event_Data *ev; > > > > > - Config_Face *inst; > > > > > - int temp; > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) || defined > > > > > (__OpenBSD__) > > > > > + int mib[CTL_MAXNAME]; > > > > > +#endif > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > + unsigned int miblen; > > > > > +#endif > > > > > + int dummy; > > > > > +} Extn; > > > > > + > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > +static const char *sources[] = > > > > > + { > > > > > + "hw.acpi.thermal.tz0.temperature", > > > > > + "dev.cpu.0.temperature", > > > > > + "dev.aibs.0.temp.0", > > > > > + "dev.lm75.0.temperature", > > > > > + NULL > > > > > + }; > > > > > +#endif > > > > > + > > > > > +Eina_List * > > > > > +temperature_get_bus_files(const char *bus) > > > > > +{ > > > > > + Eina_List *result; > > > > > + Eina_List *therms; > > > > > + char path[PATH_MAX]; > > > > > + char busdir[PATH_MAX]; > > > > > + char *name; > > > > > > > > > > - ev = event; > > > > > - inst = data; > > > > > - if ((!inst->tempget_exe) || (ev->exe != inst->tempget_exe)) > > return > > > > > ECORE_CALLBACK_PASS_ON; > > > > > - temp = -999; > > > > > - if ((ev->lines) && (ev->lines[0].line)) > > > > > + result = NULL; > > > > > + > > > > > + snprintf(busdir, sizeof(busdir), "/sys/bus/%s/devices", bus); > > > > > + /* Look through all the devices for the given bus. */ > > > > > + therms = ecore_file_ls(busdir); > > > > > + > > > > > + EINA_LIST_FREE(therms, name) > > > > > { > > > > > - int i; > > > > > + Eina_List *files; > > > > > + char *file; > > > > > > > > > > - for (i = 0; ev->lines[i].line; i++) > > > > > + /* Search each device for temp*_input, these should be > > > > > + * temperature devices. */ > > > > > + snprintf(path, sizeof(path), "%s/%s", busdir, name); > > > > > + files = ecore_file_ls(path); > > > > > + EINA_LIST_FREE(files, file) > > > > > { > > > > > - if (!strcmp(ev->lines[i].line, "ERROR")) > > > > > - temp = -999; > > > > > - else > > > > > - temp = atoi(ev->lines[i].line); > > > > > + if ((!strncmp("temp", file, 4)) && > > > > > + (!strcmp("_input", &file[strlen(file) - 6]))) > > > > > + { > > > > > + char *f; > > > > > + > > > > > + snprintf(path, sizeof(path), > > > > > + "%s/%s/%s", busdir, name, file); > > > > > + f = strdup(path); > > > > > + if (f) result = eina_list_append(result, f); > > > > > + } > > > > > + free(file); > > > > > } > > > > > + free(name); > > > > > } > > > > > - if (temp != -999) > > > > > - { > > > > > - char buf[256]; > > > > > + return result; > > > > > +} > > > > > > > > > > - if (inst->units == FAHRENHEIT) > > > > > - temp = (temp * 9.0 / 5.0) + 32; > > > > > +#ifdef __OpenBSD__ > > > > > +static struct sensor snsr; > > > > > +static size_t slen = sizeof(snsr); > > > > > +#endif > > > > > > > > > > - if (!inst->have_temp) > > > > > +static void > > > > > +init(Tempthread *tth) > > > > > +{ > > > > > + Eina_List *therms; > > > > > + char path[512]; > > > > > +#ifdef __OpenBSD__ > > > > > + int dev, numt; > > > > > + struct sensordev snsrdev; > > > > > + c size_t sdlen = sizeof(snsrdev); > > > > > +#endif > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > + unsigned i; > > > > > + size_t len; > > > > > + int rc; > > > > > +#endif > > > > > + Extn *extn; > > > > > + > > > > > + if (tth->initted) return; > > > > > + tth->initted = EINA_TRUE; > > > > > + > > > > > + extn = calloc(1, sizeof(Extn)); > > > > > + tth->extn = extn; > > > > > + > > > > > + if ((!tth->sensor_type) || > > > > > + ((!tth->sensor_name) || > > > > > + (tth->sensor_name[0] == 0))) > > > > > + { > > > > > + eina_stringshare_del(tth->sensor_name); > > > > > + tth->sensor_name = NULL; > > > > > + eina_stringshare_del(tth->sensor_path); > > > > > + tth->sensor_path = NULL; > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > + for (i = 0; sources[i]; i++) > > > > > + { > > > > > + rc = sysctlbyname(sources[i], NULL, NULL, NULL, 0); > > > > > + if (rc == 0) > > > > > + { > > > > > + tth->sensor_type = SENSOR_TYPE_FREEBSD; > > > > > + tth->sensor_name = eina_stringshare_add(sources[ > > i]); > > > > > + break; > > > > > + } > > > > > + } > > > > > +#elif __OpenBSD__ > > > > > + extn->mib[0] = CTL_HW; > > > > > + extn->mib[1] = HW_SENSORS; > > > > > + > > > > > + for (dev = 0;; dev++) > > > > > { > > > > > - /* enable therm object */ > > > > > - edje_object_signal_emit(inst->o_temp, > "e,state,known", > > > ""); > > > > > - inst->have_temp = EINA_TRUE; > > > > > + extn->mib[2] = dev; > > > > > + if (sysctl(extn->mib, 3, &snsrdev, &sdlen, NULL, 0) > == > > > -1) > > > > > + { > > > > > + if (errno == ENOENT) /* no further sensors */ > > > > > + break; > > > > > + else > > > > > + continue; > > > > > + } > > > > > + if (strcmp(snsrdev.xname, "cpu0") == 0) > > > > > + { > > > > > + sensor_type = SENSOR_TYPE_OPENBSD; > > > > > + sensor_name = strdup("cpu0"); > > > > > + break; > > > > > + } > > > > > + else if (strcmp(snsrdev.xname, "km0") == 0) > > > > > + { > > > > > + sensor_type = SENSOR_TYPE_OPENBSD; > > > > > + sensor_name = strdup("km0"); > > > > > + break; > > > > > + } > > > > > } > > > > > +#else > > > > > + therms = ecore_file_ls("/proc/acpi/thermal_zone"); > > > > > + if (therms) > > > > > + { > > > > > + char *name; > > > > > > > > > > - if (inst->units == FAHRENHEIT) > > > > > - snprintf(buf, sizeof(buf), "%i°F", temp); > > > > > + name = eina_list_data_get(therms); > > > > > + tth->sensor_type = SENSOR_TYPE_LINUX_ACPI; > > > > > + tth->sensor_name = eina_stringshare_add(name); > > > > > + eina_list_free(therms); > > > > > + } > > > > > else > > > > > - snprintf(buf, sizeof(buf), "%i°C", temp); > > > > > + { > > > > > + eina_list_free(therms); > > > > > + therms = ecore_file_ls("/sys/class/thermal"); > > > > > + if (therms) > > > > > + { > > > > > + char *name; > > > > > + Eina_List *l; > > > > > + > > > > > + EINA_LIST_FOREACH(therms, l, name) > > > > > + { > > > > > + if (!strncmp(name, "thermal", 7)) > > > > > + { > > > > > + tth->sensor_type = > > SENSOR_TYPE_LINUX_SYS; > > > > > + tth->sensor_name = > > > eina_stringshare_add(name); > > > > > + eina_list_free(therms); > > > > > + therms = NULL; > > > > > + break; > > > > > + } > > > > > + } > > > > > + if (therms) eina_list_free(therms); > > > > > + } > > > > > + if (therms) > > > > > + { > > > > > + if (ecore_file_exists("/proc/ > > omnibook/temperature")) > > > > > + { > > > > > + tth->sensor_type = SENSOR_TYPE_OMNIBOOK; > > > > > + tth->sensor_name = > > > eina_stringshare_add("dummy"); > > > > > + } > > > > > + else if > > > > > > (ecore_file_exists("/sys/devices/temperatures/sensor1_temperature")) > > > > > + { > > > > > + tth->sensor_type = SENSOR_TYPE_LINUX_PBOOK; > > > > > + tth->sensor_name = > > > eina_stringshare_add("dummy"); > > > > > + } > > > > > + else if > > > > > (ecore_file_exists("/sys/devices/temperatures/cpu_temperature")) > > > > > + { > > > > > + tth->sensor_type = > SENSOR_TYPE_LINUX_MACMINI; > > > > > + tth->sensor_name = > > > eina_stringshare_add("dummy"); > > > > > + } > > > > > + else if > > > > > (ecore_file_exists("/sys/devices/platform/coretemp.0/temp1_input")) > > > > > + { > > > > > + tth->sensor_type = > > > SENSOR_TYPE_LINUX_INTELCORETEMP; > > > > > + tth->sensor_name = > > > eina_stringshare_add("dummy"); > > > > > + } > > > > > + else if > > > > > (ecore_file_exists("/sys/devices/platform/thinkpad_ > > hwmon/temp1_input")) > > > > > + { > > > > > + tth->sensor_type = > > SENSOR_TYPE_LINUX_THINKPAD; > > > > > + tth->sensor_name = > > > eina_stringshare_add("dummy"); > > > > > + } > > > > > + else > > > > > + { > > > > > + // try the i2c bus > > > > > + therms = temperature_get_bus_files("i2c"); > > > > > + if (therms) > > > > > + { > > > > > + char *name; > > > > > > > > > > - _temperature_face_level_set(inst, > > > > > - (double)(temp - inst->low) / > > > > > - (double)(inst->high - inst->low)); > > > > > - edje_object_part_text_set(inst->o_temp, "e.text.reading", > > > buf); > > > > > + if ((name = > eina_list_data_get(therms))) > > > > > + { > > > > > + if (ecore_file_exists(name)) > > > > > + { > > > > > + int len; > > > > > + > > > > > + snprintf(path, sizeof(path), > > > > > + "%s", > > > > > ecore_file_file_get(name)); > > > > > + len = strlen(path); > > > > > + if (len > 6) path[len - 6] = > > > '\0'; > > > > > + tth->sensor_type = > > > > > SENSOR_TYPE_LINUX_I2C; > > > > > + tth->sensor_path = > > > > > eina_stringshare_add(name); > > > > > + tth->sensor_name = > > > > > eina_stringshare_add(path); > > > > > + } > > > > > + } > > > > > + eina_list_free(therms); > > > > > + } > > > > > + if (!tth->sensor_path) > > > > > + { > > > > > + // try the pci bus > > > > > + therms = temperature_get_bus_files(" > > pci"); > > > > > + if (therms) > > > > > + { > > > > > + char *name; > > > > > + > > > > > + if ((name = > > > eina_list_data_get(therms))) > > > > > + { > > > > > + if (ecore_file_exists(name)) > > > > > + { > > > > > + int len; > > > > > + > > > > > + snprintf(path, > > > sizeof(path), > > > > > + "%s", > > > > > ecore_file_file_get(name)); > > > > > + len = strlen(path); > > > > > + if (len > 6) path[len - > > 6] > > > = > > > > > '\0'; > > > > > + tth->sensor_type = > > > > > SENSOR_TYPE_LINUX_PCI; > > > > > + tth->sensor_path = > > > > > eina_stringshare_add(name); > > > > > + > > > > > eina_stringshare_del(tth->sensor_name); > > > > > + tth->sensor_name = > > > > > eina_stringshare_add(path); > > > > > + } > > > > > + } > > > > > + eina_list_free(therms); > > > > > + } > > > > > + } > > > > > + } > > > > > + } > > > > > + } > > > > > +#endif > > > > > } > > > > > - else > > > > > + if ((tth->sensor_type) && (tth->sensor_name) && > > > (!tth->sensor_path)) > > > > > { > > > > > - if (inst->have_temp) > > > > > + char *name; > > > > > + > > > > > + switch (tth->sensor_type) > > > > > { > > > > > - /* disable therm object */ > > > > > - edje_object_signal_emit(inst->o_temp, > > "e,state,unknown", > > > ""); > > > > > - edje_object_part_text_set(inst->o_temp, > > "e.text.reading", > > > > > "N/A"); > > > > > - _temperature_face_level_set(inst, 0.5); > > > > > - inst->have_temp = EINA_FALSE; > > > > > + case SENSOR_TYPE_NONE: > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_FREEBSD: > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > + len = sizeof(extn->mib) / sizeof(extn->mib[0]); > > > > > + rc = sysctlnametomib(tth->sensor_name, extn->mib, > > &len); > > > > > + if (rc == 0) > > > > > + { > > > > > + extn->miblen = len; > > > > > + tth->sensor_path = > > > > > eina_stringshare_add(tth->sensor_name); > > > > > + } > > > > > +#endif > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_OPENBSD: > > > > > +#ifdef __OpenBSD__ > > > > > + for (numt = 0; numt < snsrdev.maxnumt[SENSOR_TEMP]; > > > numt++) > > > > > + { > > > > > + extn->mib[4] = numt; > > > > > + slen = sizeof(snsr); > > > > > + if (sysctl(extn->mib, 5, &snsr, &slen, NULL, 0) > == > > > -1) > > > > > + continue; > > > > > + if (slen > 0 && (snsr.flags & SENSOR_FINVALID) > == > > 0) > > > > > + { > > > > > + break; > > > > > + } > > > > > + } > > > > > +#endif > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_OMNIBOOK: > > > > > + tth->sensor_path = > > > > > eina_stringshare_add("/proc/omnibook/temperature"); > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_MACMINI: > > > > > + tth->sensor_path = > > > > > eina_stringshare_add("/sys/devices/temperatures/cpu_temperature"); > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_PBOOK: > > > > > + tth->sensor_path = > > > > > eina_stringshare_add("/sys/devices/temperatures/sensor1_ > > temperature"); > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_INTELCORETEMP: > > > > > + tth->sensor_path = > > > > > eina_stringshare_add("/sys/devices/platform/coretemp.0/ > > temp1_input"); > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_THINKPAD: > > > > > + tth->sensor_path = > > > > > > > > eina_stringshare_add("/sys/devices/platform/thinkpad_ > > hwmon/temp1_input"); > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_I2C: > > > > > + therms = ecore_file_ls("/sys/bus/i2c/devices"); > > > > > + > > > > > + EINA_LIST_FREE(therms, name) > > > > > + { > > > > > + snprintf(path, sizeof(path), > > > > > + "/sys/bus/i2c/devices/%s/%s_input", > > > > > + name, tth->sensor_name); > > > > > + if (ecore_file_exists(path)) > > > > > + { > > > > > + tth->sensor_path = > > eina_stringshare_add(path); > > > > > + /* We really only care about the first > > > > > + * one for the default. */ > > > > > + break; > > > > > + } > > > > > + free(name); > > > > > + } > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_PCI: > > > > > + therms = ecore_file_ls("/sys/bus/pci/devices"); > > > > > + > > > > > + EINA_LIST_FREE(therms, name) > > > > > + { > > > > > + snprintf(path, sizeof(path), > > > > > + "/sys/bus/pci/devices/%s/%s_input", > > > > > + name, tth->sensor_name); > > > > > + if (ecore_file_exists(path)) > > > > > + { > > > > > + tth->sensor_path = > > eina_stringshare_add(path); > > > > > + /* We really only care about the first > > > > > + * one for the default. */ > > > > > + break; > > > > > + } > > > > > + free(name); > > > > > + } > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_ACPI: > > > > > + snprintf(path, sizeof(path), > > > > > + "/proc/acpi/thermal_zone/%s/temperature", > > > > > + tth->sensor_name); > > > > > + tth->sensor_path = eina_stringshare_add(path); > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_SYS: > > > > > + snprintf(path, sizeof(path), > > > > > + "/sys/class/thermal/%s/temp", > > tth->sensor_name); > > > > > + tth->sensor_path = eina_stringshare_add(path); > > > > > + break; > > > > > + > > > > > + default: > > > > > + break; > > > > > } > > > > > } > > > > > - return ECORE_CALLBACK_DONE; > > > > > } > > > > > > > > > > -Eina_Bool > > > > > -_temperature_cb_exe_del(void *data, EINA_UNUSED int type, void > > *event) > > > > > +static int > > > > > +check(Tempthread *tth) > > > > > { > > > > > - Ecore_Exe_Event_Del *ev; > > > > > - Config_Face *inst; > > > > > - > > > > > - ev = event; > > > > > - inst = data; > > > > > - if ((!inst->tempget_exe) || (ev->exe != inst->tempget_exe)) > > return > > > > > ECORE_CALLBACK_PASS_ON; > > > > > - inst->tempget_exe = NULL; > > > > > - return ECORE_CALLBACK_DONE; > > > > > + FILE *f = NULL; > > > > > + int ret = 0; > > > > > + int temp = 0; > > > > > + char buf[512]; > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > + size_t len; > > > > > + size_t ftemp = 0; > > > > > +#endif > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) || defined > > > > > (__OpenBSD__) > > > > > + Extn *extn = tth->extn; > > > > > +#endif > > > > > + > > > > > + /* TODO: Make standard parser. Seems to be two types of > > temperature > > > > > string: > > > > > + * - Somename: <temp> C > > > > > + * - <temp> > > > > > + */ > > > > > + switch (tth->sensor_type) > > > > > + { > > > > > + case SENSOR_TYPE_NONE: > > > > > + /* TODO: Slow down poller? */ > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_FREEBSD: > > > > > +#if defined (__FreeBSD__) || defined(__DragonFly__) > > > > > + len = sizeof(ftemp); > > > > > + if (sysctl(extn->mib, extn->miblen, &ftemp, &len, NULL, 0) > > == > > > 0) > > > > > + { > > > > > + temp = (ftemp - 2732) / 10; > > > > > + ret = 1; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > +#endif > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_OPENBSD: > > > > > +#ifdef __OpenBSD__ > > > > > + if (sysctl(extn->mib, 5, &snsr, &slen, NULL, 0) != -1) > > > > > + { > > > > > + temp = (snsr.value - 273150000) / 1000000.0; > > > > > + ret = 1; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > +#endif > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_OMNIBOOK: > > > > > + f = fopen(tth->sensor_path, "r"); > > > > > + if (f) > > > > > + { > > > > > + char dummy[4096]; > > > > > + > > > > > + if (fgets(buf, sizeof(buf), f) == NULL) goto error; > > > > > + fclose(f); > > > > > + f = NULL; > > > > > + if (sscanf(buf, "%s %s %i", dummy, dummy, &temp) == > 3) > > > > > + ret = 1; > > > > > + else > > > > > + goto error; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_MACMINI: > > > > > + case SENSOR_TYPE_LINUX_PBOOK: > > > > > + f = fopen(tth->sensor_path, "rb"); > > > > > + if (f) > > > > > + { > > > > > + if (fgets(buf, sizeof(buf), f) == NULL) goto error; > > > > > + fclose(f); > > > > > + f = NULL; > > > > > + if (sscanf(buf, "%i", &temp) == 1) > > > > > + ret = 1; > > > > > + else > > > > > + goto error; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_INTELCORETEMP: > > > > > + case SENSOR_TYPE_LINUX_I2C: > > > > > + case SENSOR_TYPE_LINUX_THINKPAD: > > > > > + f = fopen(tth->sensor_path, "r"); > > > > > + if (f) > > > > > + { > > > > > + if (fgets(buf, sizeof(buf), f) == NULL) goto error; > > > > > + fclose(f); > > > > > + f = NULL; > > > > > + /* actually read the temp */ > > > > > + if (sscanf(buf, "%i", &temp) == 1) > > > > > + ret = 1; > > > > > + else > > > > > + goto error; > > > > > + /* Hack for temp */ > > > > > + temp = temp / 1000; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_PCI: > > > > > + f = fopen(tth->sensor_path, "r"); > > > > > + if (f) > > > > > + { > > > > > + if (fgets(buf, sizeof(buf), f) == NULL) goto error; > > > > > + fclose(f); > > > > > + f = NULL; > > > > > + /* actually read the temp */ > > > > > + if (sscanf(buf, "%i", &temp) == 1) > > > > > + ret = 1; > > > > > + else > > > > > + goto error; > > > > > + /* Hack for temp */ > > > > > + temp = temp / 1000; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_ACPI: > > > > > + f = fopen(tth->sensor_path, "r"); > > > > > + if (f) > > > > > + { > > > > > + char *p, *q; > > > > > + > > > > > + if (fgets(buf, sizeof(buf), f) == NULL) goto error; > > > > > + fclose(f); > > > > > + f = NULL; > > > > > + p = strchr(buf, ':'); > > > > > + if (p) > > > > > + { > > > > > + p++; > > > > > + while (*p == ' ') > > > > > + p++; > > > > > + q = strchr(p, ' '); > > > > > + if (q) *q = 0; > > > > > + temp = atoi(p); > > > > > + ret = 1; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > + break; > > > > > + > > > > > + case SENSOR_TYPE_LINUX_SYS: > > > > > + f = fopen(tth->sensor_path, "r"); > > > > > + if (f) > > > > > + { > > > > > + if (fgets(buf, sizeof(buf), f) == NULL) goto error; > > > > > + fclose(f); > > > > > + f = NULL; > > > > > + temp = atoi(buf); > > > > > + temp /= 1000; > > > > > + ret = 1; > > > > > + } > > > > > + else > > > > > + goto error; > > > > > + break; > > > > > + > > > > > + default: > > > > > + break; > > > > > + } > > > > > + > > > > > + if (ret) return temp; > > > > > + > > > > > + return -999; > > > > > +error: > > > > > + if (f) fclose(f); > > > > > + tth->sensor_type = SENSOR_TYPE_NONE; > > > > > + eina_stringshare_del(tth->sensor_name); > > > > > + tth->sensor_name = NULL; > > > > > + eina_stringshare_del(tth->sensor_path); > > > > > + tth->sensor_path = NULL; > > > > > + return -999; > > > > > +} > > > > > + > > > > > +int > > > > > +temperature_tempget_get(Tempthread *tth) > > > > > +{ > > > > > + int temp; > > > > > + > > > > > + init(tth); > > > > > + temp = check(tth); > > > > > + return temp; > > > > > } > > > > > diff --git a/src/modules/temperature/e_mod_udev.c > > > > > b/src/modules/temperature/e_mod_udev.c > > > > > index f0fafd0..1dafb31 100644 > > > > > --- a/src/modules/temperature/e_mod_udev.c > > > > > +++ b/src/modules/temperature/e_mod_udev.c > > > > > @@ -1,33 +1,26 @@ > > > > > #include "e.h" > > > > > #include "e_mod_main.h" > > > > > > > > > > -Eina_Bool > > > > > -temperature_udev_update_poll(void *data) > > > > > +int > > > > > +temperature_udev_get(Tempthread *tth) > > > > > { > > > > > - temperature_udev_update(data); > > > > > - return ECORE_CALLBACK_RENEW; > > > > > -} > > > > > - > > > > > -void > > > > > -temperature_udev_update(void *data) > > > > > -{ > > > > > - Config_Face *inst; > > > > > Eina_List *l; > > > > > - double cur, temp, cpus = 0; > > > > > + double cur, temp; > > > > > char *syspath; > > > > > const char *test; > > > > > char buf[256]; > > > > > - int x, y; > > > > > + int x, y, cpus = 0; > > > > > > > > > > - inst = data; > > > > > temp = -999; > > > > > > > > > > - if (!inst->tempdevs) > > > > > - inst->tempdevs = > > > > > eeze_udev_find_by_type(EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_ > > COLD_SENSOR, > > > NULL); > > > > > - if (eina_list_count(inst->tempdevs)) > > > > > + 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(inst->tempdevs, l, syspa ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
