netstar pushed a commit to branch master. http://git.enlightenment.org/apps/evisum.git/commit/?id=ab66aa95e808a3481b9d20c73066aefabef15ddd
commit ab66aa95e808a3481b9d20c73066aefabef15ddd Author: Alastair Poole <[email protected]> Date: Tue Jun 16 14:57:09 2020 +0100 linux: read as many thermal sensors as we can. As with OpenBSD. --- src/bin/system/machine.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/bin/system/machine.c b/src/bin/system/machine.c index 4e2ff05..2b46ce3 100644 --- a/src/bin/system/machine.c +++ b/src/bin/system/machine.c @@ -698,12 +698,11 @@ _sensors_thermal_get(Sys_Info *sysinfo) else *temperature = INVALID_TEMP; #elif defined(__linux__) + sensor_t *sensor; struct dirent *dh; DIR *dir; char path[PATH_MAX]; - *temperature = INVALID_TEMP; - dir = opendir("/sys/class/thermal"); if (!dir) return; @@ -716,19 +715,17 @@ _sensors_thermal_get(Sys_Info *sysinfo) char *type = file_contents(path); if (type) { - /* This should ensure we get the highest available core temperature */ - if ((strstr(type, "_pkg_temp")) || - (!strncmp(type, "cpu-thermal", 11))) /* RPI4 */ + sensors = realloc(sensors, 1 + sysinfo->snsr_count * sizeof(sensor_t *)); + sensors[sysinfo->snsr_count++] = sensor = calloc(1, sizeof(sensor_t)); + sensor->name = strdup(dh->d_name); + snprintf(path, sizeof(path), "/sys/class/thermal/%s/temp", dh->d_name); + char *value = file_contents(path); + if (!value) + sensor->invalid = true; + else { - snprintf(path, sizeof(path), "/sys/class/thermal/%s/temp", dh->d_name); - char *value = file_contents(path); - if (value) - { - *temperature = (float)atoi(value) / 1000.0; - free(value); - free(type); - break; - } + sensor->value = (float)atoi(value) / 1000.0; + free(value); } free(type); } --
