Don't set a default ACPI temperature sensor.

Use the first available temperature sensor if none is set.


SVN revision: 27435
This commit is contained in:
Sebastian Dransfeld 2006-12-14 15:07:47 +00:00
parent bc4289566a
commit 4ce743a844
1 changed files with 13 additions and 13 deletions

View File

@ -269,14 +269,15 @@ _temperature_cb_check(void *data)
} }
else else
{ {
char *name; const char *name;
ret = 1; ret = 0;
while ((name = ecore_list_next(therms))) name = temperature_config->acpi_sel;
if (!name) name = ecore_list_next(therms);
if (name)
{ {
char *p, *q; char *p, *q;
FILE *f; FILE *f;
name = temperature_config->acpi_sel;
snprintf(buf, sizeof(buf), "/proc/acpi/thermal_zone/%s/temperature", name); snprintf(buf, sizeof(buf), "/proc/acpi/thermal_zone/%s/temperature", name);
f = fopen(buf, "rb"); f = fopen(buf, "rb");
if (f) if (f)
@ -284,16 +285,15 @@ _temperature_cb_check(void *data)
fgets(buf, sizeof(buf), f); buf[sizeof(buf) - 1] = 0; fgets(buf, sizeof(buf), f); buf[sizeof(buf) - 1] = 0;
fclose(f); fclose(f);
p = strchr(buf, ':'); p = strchr(buf, ':');
if (!p) if (p)
{ {
ret = 0; p++;
continue; while (*p == ' ') p++;
q = strchr(p, ' ');
if (q) *q = 0;
temp = atoi(p);
ret = 1;
} }
p++;
while (*p == ' ') p++;
q = strchr(p, ' ');
if (q) *q = 0;
temp = atoi(p);
} }
} }
ecore_list_destroy(therms); ecore_list_destroy(therms);
@ -414,7 +414,7 @@ e_modapi_init(E_Module *m)
temperature_config->high = 80; temperature_config->high = 80;
temperature_config->sensor_name = evas_stringshare_add("temp1"); temperature_config->sensor_name = evas_stringshare_add("temp1");
temperature_config->units = CELCIUS; temperature_config->units = CELCIUS;
temperature_config->acpi_sel = evas_stringshare_add("TZ1"); temperature_config->acpi_sel = NULL;
} }
E_CONFIG_LIMIT(temperature_config->poll_time, 0.5, 1000.0); E_CONFIG_LIMIT(temperature_config->poll_time, 0.5, 1000.0);
E_CONFIG_LIMIT(temperature_config->low, 0, 100); E_CONFIG_LIMIT(temperature_config->low, 0, 100);