forked from enlightenment/enlightenment
add full udev support for temp module:
if e is compiled with eeze as the preferred backend, a new config page will appear in the settings for the temperature module where internal and udev are selectable options. udev mode should support ALL possible hardware, so if you've been having issues with the current temp module, try udev mode! also note that udev mode provides an extra amount of precision for hahas; it also still obeys the configurable polling intervals. please test and report all bugs! SVN revision: 49062
This commit is contained in:
parent
8b6b36637d
commit
95c4186748
|
@ -1,6 +1,12 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = temperature
|
||||
|
||||
if HAVE_EEZE_UDEV
|
||||
DEVICE_FILE = e_mod_udev.c
|
||||
else
|
||||
DEVICE_FILE =
|
||||
endif
|
||||
|
||||
# data files for the module
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||
files_DATA = \
|
||||
|
@ -21,6 +27,8 @@ pkg_LTLIBRARIES = module.la
|
|||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h \
|
||||
e_mod_config.c \
|
||||
e_mod_tempget.c \
|
||||
$(DEVICE_FILE) \
|
||||
e_mod_main_private.h
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
|
|
|
@ -12,7 +12,9 @@ struct _E_Config_Dialog_Data
|
|||
} poll;
|
||||
|
||||
int unit_method;
|
||||
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
int backend;
|
||||
#endif
|
||||
struct
|
||||
{
|
||||
int low, high;
|
||||
|
@ -28,7 +30,7 @@ struct _E_Config_Dialog_Data
|
|||
|
||||
/* local function prototypes */
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _fill_data(E_Config_Dialog_Data *cfdata);
|
||||
static void _fill_data_tempget(E_Config_Dialog_Data *cfdata);
|
||||
static void _fill_sensors(E_Config_Dialog_Data *cfdata, const char *name);
|
||||
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
|
@ -63,56 +65,64 @@ _create_data(E_Config_Dialog *cfd)
|
|||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
cfdata->inst = cfd->data;
|
||||
_fill_data(cfdata);
|
||||
_fill_data_tempget(cfdata);
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
_fill_data_tempget(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
cfdata->unit_method = cfdata->inst->units;
|
||||
cfdata->poll.interval = cfdata->inst->poll_interval;
|
||||
cfdata->temp.low = cfdata->inst->low;
|
||||
cfdata->temp.high = cfdata->inst->high;
|
||||
cfdata->sensor = 0;
|
||||
switch (cfdata->inst->sensor_type)
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
cfdata->backend = cfdata->inst->backend;
|
||||
if (cfdata->backend == TEMPGET)
|
||||
{
|
||||
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:
|
||||
#endif
|
||||
switch (cfdata->inst->sensor_type)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
if ((l = ecore_file_ls("/proc/acpi/thermal_zone")))
|
||||
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:
|
||||
{
|
||||
char *name;
|
||||
int n = 0;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FREE(l, name)
|
||||
if ((l = ecore_file_ls("/proc/acpi/thermal_zone")))
|
||||
{
|
||||
cfdata->sensors =
|
||||
eina_list_append(cfdata->sensors, name);
|
||||
if (!strcmp(cfdata->inst->sensor_name, name))
|
||||
cfdata->sensor = n;
|
||||
n++;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -230,7 +240,16 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Temperatures"), ol,
|
||||
1, 0, 1, 0, 0.5, 0.0);
|
||||
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
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,
|
||||
0, 0, 0, 0, 0.5, 0.0);
|
||||
#endif
|
||||
e_widget_toolbook_page_show(otb, 0);
|
||||
return otb;
|
||||
}
|
||||
|
@ -242,6 +261,9 @@ _basic_apply(E_Config_Dialog *cfd, 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_UDEV
|
||||
cfdata->inst->backend = cfdata->backend;
|
||||
#endif
|
||||
|
||||
eina_stringshare_replace(&cfdata->inst->sensor_name,
|
||||
eina_list_nth(cfdata->sensors, cfdata->sensor));
|
||||
|
|
|
@ -28,11 +28,10 @@ static const E_Gadcon_Client_Class _gadcon_class =
|
|||
};
|
||||
|
||||
/* actual module specifics */
|
||||
static int _temperature_cb_exe_data(void *data, int type, void *event);
|
||||
static int _temperature_cb_exe_del(void *data, int type, void *event);
|
||||
|
||||
static void _temperature_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _temperature_face_cb_post_menu(void *data, E_Menu *m);
|
||||
static void _temperature_face_level_set(Config_Face *inst, double level);
|
||||
|
||||
static void _temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
|
||||
static Eina_Bool _temperature_face_shutdown(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *hdata, void *fdata __UNUSED__);
|
||||
|
@ -55,23 +54,29 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|||
inst = eina_hash_find(temperature_config->faces, id);
|
||||
if (!inst)
|
||||
{
|
||||
inst = E_NEW(Config_Face, 1);
|
||||
inst->id = eina_stringshare_add(id);
|
||||
inst->poll_interval = 128;
|
||||
inst->low = 30;
|
||||
inst->high = 80;
|
||||
inst->sensor_type = SENSOR_TYPE_NONE;
|
||||
inst->sensor_name = NULL;
|
||||
inst->units = CELCIUS;
|
||||
if (!temperature_config->faces)
|
||||
temperature_config->faces = eina_hash_string_superfast_new(NULL);
|
||||
eina_hash_direct_add(temperature_config->faces, inst->id, inst);
|
||||
inst = E_NEW(Config_Face, 1);
|
||||
inst->id = eina_stringshare_add(id);
|
||||
inst->poll_interval = 128;
|
||||
inst->low = 30;
|
||||
inst->high = 80;
|
||||
inst->sensor_type = SENSOR_TYPE_NONE;
|
||||
inst->sensor_name = NULL;
|
||||
inst->units = CELCIUS;
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
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);
|
||||
}
|
||||
if (!inst->id) inst->id = eina_stringshare_add(id);
|
||||
E_CONFIG_LIMIT(inst->poll_interval, 1, 1024);
|
||||
E_CONFIG_LIMIT(inst->low, 0, 100);
|
||||
E_CONFIG_LIMIT(inst->high, 0, 220);
|
||||
E_CONFIG_LIMIT(inst->units, CELCIUS, FAHRENHEIT);
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
E_CONFIG_LIMIT(inst->backend, TEMPGET, UDEV);
|
||||
#endif
|
||||
|
||||
o = edje_object_add(gc->evas);
|
||||
e_theme_edje_object_set(o, "base/theme/modules/temperature",
|
||||
|
@ -84,14 +89,24 @@ _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 = -1;
|
||||
|
||||
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_EEZE_UDEV
|
||||
if (inst->backend == TEMPGET)
|
||||
{
|
||||
#endif
|
||||
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_EEZE_UDEV
|
||||
}
|
||||
else
|
||||
{
|
||||
inst->temp_poller = ecore_poller_add(ECORE_POLLER_CORE, inst->poll_interval, temperature_udev_update_poll, inst);
|
||||
temperature_udev_update(inst);
|
||||
}
|
||||
#endif
|
||||
temperature_face_update_config(inst);
|
||||
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
|
@ -105,22 +120,27 @@ _gc_shutdown(E_Gadcon_Client *gcc)
|
|||
Config_Face *inst;
|
||||
|
||||
inst = gcc->data;
|
||||
|
||||
if (inst->tempget_exe)
|
||||
{
|
||||
ecore_exe_terminate(inst->tempget_exe);
|
||||
ecore_exe_free(inst->tempget_exe);
|
||||
inst->tempget_exe = NULL;
|
||||
ecore_exe_terminate(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;
|
||||
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;
|
||||
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);
|
||||
#endif
|
||||
if (inst->o_temp) evas_object_del(inst->o_temp);
|
||||
inst->o_temp = NULL;
|
||||
if (inst->config_dialog) e_object_del(E_OBJECT(inst->config_dialog));
|
||||
|
@ -171,84 +191,16 @@ _gc_id_new(E_Gadcon_Client_Class *client_class)
|
|||
inst->sensor_type = SENSOR_TYPE_NONE;
|
||||
inst->sensor_name = NULL;
|
||||
inst->units = CELCIUS;
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
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);
|
||||
return inst->id;
|
||||
}
|
||||
|
||||
static int
|
||||
_temperature_cb_exe_data(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Data *ev;
|
||||
Config_Face *inst;
|
||||
int temp;
|
||||
|
||||
ev = event;
|
||||
inst = data;
|
||||
if (ev->exe != inst->tempget_exe) return 1;
|
||||
temp = -999;
|
||||
if ((ev->lines) && (ev->lines[0].line))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; ev->lines[i].line; i++)
|
||||
{
|
||||
if (!strcmp(ev->lines[i].line, "ERROR"))
|
||||
temp = -999;
|
||||
else
|
||||
temp = atoi(ev->lines[i].line);
|
||||
}
|
||||
}
|
||||
if (temp != -999)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
if (inst->units == FAHRENHEIT)
|
||||
temp = (temp * 9.0 / 5.0) + 32;
|
||||
|
||||
if (inst->have_temp != 1)
|
||||
{
|
||||
/* enable therm object */
|
||||
edje_object_signal_emit(inst->o_temp, "e,state,known", "");
|
||||
inst->have_temp = 1;
|
||||
}
|
||||
|
||||
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->have_temp != 0)
|
||||
{
|
||||
/* 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 = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_temperature_cb_exe_del(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Del *ev;
|
||||
Config_Face *inst;
|
||||
|
||||
ev = event;
|
||||
inst = data;
|
||||
if (ev->exe != inst->tempget_exe) return 1;
|
||||
inst->tempget_exe = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_temperature_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
|
@ -260,27 +212,27 @@ _temperature_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *eve
|
|||
ev = event_info;
|
||||
if ((ev->button == 3) && (!inst->menu))
|
||||
{
|
||||
E_Menu *mn;
|
||||
E_Menu_Item *mi;
|
||||
int cx, cy;
|
||||
E_Menu *mn;
|
||||
E_Menu_Item *mi;
|
||||
int cx, cy;
|
||||
|
||||
mn = e_menu_new();
|
||||
e_menu_post_deactivate_callback_set(mn, _temperature_face_cb_post_menu, inst);
|
||||
inst->menu = mn;
|
||||
mn = e_menu_new();
|
||||
e_menu_post_deactivate_callback_set(mn, _temperature_face_cb_post_menu, inst);
|
||||
inst->menu = mn;
|
||||
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Settings"));
|
||||
e_util_menu_item_theme_icon_set(mi, "configure");
|
||||
e_menu_item_callback_set(mi, _temperature_face_cb_menu_configure, inst);
|
||||
mi = e_menu_item_new(mn);
|
||||
e_menu_item_label_set(mi, _("Settings"));
|
||||
e_util_menu_item_theme_icon_set(mi, "configure");
|
||||
e_menu_item_callback_set(mi, _temperature_face_cb_menu_configure, inst);
|
||||
|
||||
e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
|
||||
e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
|
||||
|
||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
|
||||
&cx, &cy, NULL, NULL);
|
||||
e_menu_activate_mouse(mn,
|
||||
e_util_zone_current_get(e_manager_current_get()),
|
||||
cx + ev->output.x, cy + ev->output.y, 1, 1,
|
||||
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
|
||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
|
||||
&cx, &cy, NULL, NULL);
|
||||
e_menu_activate_mouse(mn,
|
||||
e_util_zone_current_get(e_manager_current_get()),
|
||||
cx + ev->output.x, cy + ev->output.y, 1, 1,
|
||||
E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +247,7 @@ _temperature_face_cb_post_menu(void *data, E_Menu *m)
|
|||
inst->menu = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
_temperature_face_level_set(Config_Face *inst, double level)
|
||||
{
|
||||
Edje_Message_Float msg;
|
||||
|
@ -324,6 +276,14 @@ _temperature_face_shutdown(const Eina_Hash *hash __UNUSED__, const void *key __U
|
|||
inst = hdata;
|
||||
if (inst->sensor_name) eina_stringshare_del(inst->sensor_name);
|
||||
if (inst->id) eina_stringshare_del(inst->id);
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
if (inst->tempdevs)
|
||||
{
|
||||
const char *s;
|
||||
EINA_LIST_FREE(inst->tempdevs, s)
|
||||
eina_stringshare_del(s);
|
||||
}
|
||||
#endif
|
||||
free(inst);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -349,21 +309,41 @@ temperature_face_update_config(Config_Face *inst)
|
|||
|
||||
if (inst->tempget_exe)
|
||||
{
|
||||
ecore_exe_terminate(inst->tempget_exe);
|
||||
ecore_exe_free(inst->tempget_exe);
|
||||
inst->tempget_exe = NULL;
|
||||
ecore_exe_terminate(inst->tempget_exe);
|
||||
ecore_exe_free(inst->tempget_exe);
|
||||
inst->tempget_exe = NULL;
|
||||
}
|
||||
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 != NULL ? 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,
|
||||
inst);
|
||||
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
if (inst->backend == TEMPGET)
|
||||
{
|
||||
if (inst->temp_poller)
|
||||
{
|
||||
ecore_poller_del(inst->temp_poller);
|
||||
inst->temp_poller = NULL;
|
||||
}
|
||||
#endif
|
||||
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 != NULL ? 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,
|
||||
inst);
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
}
|
||||
else
|
||||
{/*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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
|
@ -434,6 +414,9 @@ 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_UDEV
|
||||
E_CONFIG_VAL(D, T, backend, INT);
|
||||
#endif
|
||||
E_CONFIG_VAL(D, T, sensor_name, STR);
|
||||
E_CONFIG_VAL(D, T, units, INT);
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ struct _Config_Face
|
|||
/* saved * loaded config values */
|
||||
int poll_interval;
|
||||
int low, high;
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
Eina_List *tempdevs;
|
||||
int backend;
|
||||
Ecore_Poller *temp_poller;
|
||||
#endif
|
||||
int sensor_type;
|
||||
const char *sensor_name;
|
||||
Unit units;
|
||||
|
@ -36,8 +41,7 @@ struct _Config_Face
|
|||
Ecore_Event_Handler *tempget_data_handler;
|
||||
Ecore_Event_Handler *tempget_del_handler;
|
||||
|
||||
// Ecore_Poller *temperature_check_poller;
|
||||
unsigned char have_temp;
|
||||
Eina_Bool have_temp:1;
|
||||
#ifdef __FreeBSD__
|
||||
int mib[5];
|
||||
#endif
|
||||
|
@ -51,12 +55,25 @@ struct _Config
|
|||
E_Module *module;
|
||||
};
|
||||
|
||||
#ifdef HAVE_EEZE_UDEV
|
||||
typedef enum _Backend
|
||||
{
|
||||
TEMPGET,
|
||||
UDEV
|
||||
} Backend;
|
||||
int temperature_udev_update_poll(void *data);
|
||||
void temperature_udev_update(void *data);
|
||||
#endif
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
||||
EAPI void *e_modapi_init (E_Module *m);
|
||||
EAPI int e_modapi_shutdown (E_Module *m);
|
||||
EAPI int e_modapi_save (E_Module *m);
|
||||
|
||||
int _temperature_cb_exe_data(void *data, int type, void *event);
|
||||
int _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);
|
||||
|
|
|
@ -51,28 +51,28 @@ temperature_get_bus_files(const char* bus)
|
|||
|
||||
EINA_LIST_FREE(therms, name)
|
||||
{
|
||||
Eina_List *files;
|
||||
char *file;
|
||||
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;
|
||||
/* 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);
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue