summaryrefslogtreecommitdiff
path: root/hardinfo2/arch/linux/common/sensors.h
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2006-10-14 18:10:13 +0000
committerLeandro A. F. Pereira <leandro@hardinfo.org>2006-10-14 18:10:13 +0000
commit6767e5b82dd2f642bb8986f4e57659990bcccc85 (patch)
treecc8352a4aa9f9b93365a5e356de3d7f8f01d891b /hardinfo2/arch/linux/common/sensors.h
parentf654729f552739d2198250358667bc782524a793 (diff)
Add ACPI Thermal Zone and Battery information
Diffstat (limited to 'hardinfo2/arch/linux/common/sensors.h')
-rw-r--r--hardinfo2/arch/linux/common/sensors.h32
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);
}