diff options
Diffstat (limited to 'hardinfo2/arch/linux/common/sensors.h')
| -rw-r--r-- | hardinfo2/arch/linux/common/sensors.h | 32 | 
1 files changed, 31 insertions, 1 deletions
| diff --git a/hardinfo2/arch/linux/common/sensors.h b/hardinfo2/arch/linux/common/sensors.h index ef834de2..af707076 100644 --- a/hardinfo2/arch/linux/common/sensors.h +++ b/hardinfo2/arch/linux/common/sensors.h @@ -232,6 +232,36 @@ read_sensors(void)          path_hwmon = g_strdup_printf("/sys/class/hwmon/hwmon%d/device/", ++hwmon);      } -    g_free(path_hwmon);     +    g_free(path_hwmon); +     +    path_hwmon = g_strdup("/proc/acpi/thermal_zone"); +    if (g_file_test(path_hwmon, G_FILE_TEST_EXISTS)) { +      GDir *tz; +       +      if ((tz = g_dir_open(path_hwmon, 0, NULL))) { +        const gchar *entry; +         +        sensors = g_strdup_printf("%s\n[ACPI Thermal Zone]\n", sensors); +        while ((entry = g_dir_read_name(tz))) { +          gchar *path = g_strdup_printf("%s/%s/temperature", path_hwmon, entry); +          gchar *contents; +           +          if (g_file_get_contents(path, &contents, NULL, NULL)) { +            int temperature; +             +            sscanf(contents, "temperature: %d C", &temperature); +           +            sensors = g_strdup_printf("%s\n%s=%d\302\260C\n", +                      sensors, entry, temperature); +                       +            g_free(contents); +          } +        } +       +        g_dir_close(tz); +      } +    } +     +    g_free(path_hwmon);  } | 
