Репозитории ALT
S: | 2.3.11-alt1 |
5.1: | 2.3.5-alt0.M51.1 |
4.1: | 2.3.0-alt1 |
4.0: | 2.3.1-alt0.M40.1 |
3.0: | 2.2.7-alt2 |
Другие репозитории
Upstream: | 2.3.1 |
Группа :: Мониторинг
Пакет: gkrellm
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: gkrellm-2.3.8-aticonfig.patch
Скачать
Скачать
diff --git a/gkrellm/src/sysdeps/linux.c b/gkrellm/src/sysdeps/linux.c
index cb61c06..161fb55 100644
--- a/gkrellm/src/sysdeps/linux.c
+++ b/gkrellm/src/sysdeps/linux.c
@@ -2398,6 +2398,7 @@ gkrellm_sys_uptime_init(void)
#define WINDFARM_INTERFACE 8
#define SYS_THERMAL_INTERFACE 9
#define NVIDIA_SMI_INTERFACE 10
+#define ATICONFIG_INTERFACE 11
#define IBM_ACPI_FAN_FILE "/proc/acpi/ibm/fan"
#define IBM_ACPI_THERMAL "/proc/acpi/ibm/thermal"
@@ -3385,6 +3386,36 @@ gkrellm_sys_sensors_get_temperature(gchar *sensor_path, gint id,
return FALSE;
}
+ if (interface == ATICONFIG_INTERFACE)
+ {
+#if GLIB_CHECK_VERSION(2,0,0)
+ gchar *args[] = { "aticonfig", "--odgt", "--adapter", sensor_path, NULL };
+ gchar *output = NULL;
+ gchar *s = NULL;
+
+ result = g_spawn_sync(NULL, args, NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
+ NULL, NULL, &output, NULL, NULL, NULL);
+
+ if(result && output)
+ {
+ gfloat dummy;
+
+ if(!temp)
+ temp = &dummy;
+ s = strstr(output, "Sensor");
+ if (s)
+ result = (sscanf(s,"Sensor %*s Temperature - %f", temp) == 1);
+ else
+ result = FALSE;
+ }
+
+ g_free(output);
+ return result;
+#else
+ return FALSE;
+#endif
+ }
#ifdef HAVE_LIBSENSORS
if (interface == LIBSENSORS_INTERFACE)
return libsensors_get_value(sensor_path, id, iodev, temp);
@@ -3843,6 +3874,28 @@ sensors_nvclock_ngpus(void)
return n;
}
+static gint
+sensors_aticonfig_ngpus(void)
+ {
+ gint n = 0, s = 0;
+#if GLIB_CHECK_VERSION(2,0,0)
+ gchar *args[] = { "aticonfig", "--list-adapters", NULL };
+ gchar *output = NULL;
+ gboolean result;
+
+ result = g_spawn_sync(NULL, args, NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
+ NULL, NULL, &output, NULL, NULL, NULL);
+
+ if(result && output)
+ n = sscanf(output, "* %d.", &s);
+ g_free(output);
+#endif
+ if (_GK.debug_level & DEBUG_SENSORS)
+ printf("aticonfig gpus = %d\n", n);
+ return n;
+ }
+
static void
sensors_nvclock_init(gboolean enable)
{
@@ -4036,7 +4089,7 @@ gkrellm_sys_sensors_init(void)
sensors_nvidia_smi_read(TRUE);
- /* nvidia-settings GPU core & ambient temperatures
+ /* nvidia-settings/aticonfig GPU core & ambient temperatures
*/
cnt = sensors_nvidia_settings_ngpus();
ngpus_added = 0;
@@ -4082,7 +4135,6 @@ gkrellm_sys_sensors_init(void)
gkrellm_sensors_sysdep_option("use_nvclock",
_("Use nvclock for NVIDIA GPU temperatures"),
sensors_nvclock_init);
-
id = 0;
/* Try for ambient only for gpu:0 for now */
if (gkrellm_sys_sensors_get_temperature("GPUAmbientTemp", id, 0,
@@ -4094,6 +4146,43 @@ gkrellm_sys_sensors_init(void)
1.0, 0.0, NULL, "GPU A");
}
+ /* aticonfig temperature display -
+ | it's very simular to nvidia case
+ */
+ cnt = sensors_aticonfig_ngpus();
+ ngpus_added = 0;
+ if (cnt < 2)
+ {
+ if (gkrellm_sys_sensors_get_temperature("0", id, 0,
+ ATICONFIG_INTERFACE, NULL))
+ {
+ gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE,
+ "0", "ATI/AMD GPU Core",
+ id, 0, ATICONFIG_INTERFACE,
+ 1.0, 0.0, NULL, "GPU C");
+ ++ngpus_added;
+ }
+ }
+ else
+ {
+ for (id = 0; id < cnt; ++id)
+ {
+ sensor_path = g_strdup_printf("%d", id);
+ if (gkrellm_sys_sensors_get_temperature(sensor_path, id, 0,
+ ATICONFIG_INTERFACE, NULL))
+ {
+ snprintf(id_name, sizeof(id_name), "ATI/AMD GPU:%d Core", id);
+ default_label = g_strdup_printf("GPU:%d", id);
+ gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE,
+ sensor_path, id_name,
+ id, 0, ATICONFIG_INTERFACE,
+ 1.0, 0.0, NULL, default_label);
+ g_free(default_label);
+ ++ngpus_added;
+ }
+ g_free(sensor_path);
+ }
+ }
/* UNINORTH sensors
*/