View | Details | Raw Unified | Return to bug 20355
Collapse All | Expand All

(-)a/gkrellm/src/sysdeps/linux.c (-2 / +91 lines)
Lines 2292-2297 gkrellm_sys_uptime_init(void) Link Here
2292
#define IBM_ACPI_INTERFACE			6
2292
#define IBM_ACPI_INTERFACE			6
2293
#define UNINORTH_INTERFACE			7
2293
#define UNINORTH_INTERFACE			7
2294
#define WINDFARM_INTERFACE			8
2294
#define WINDFARM_INTERFACE			8
2295
#define ATICONFIG_INTERFACE			9
2295
2296
2296
#define IBM_ACPI_FAN_FILE	"/proc/acpi/ibm/fan"
2297
#define IBM_ACPI_FAN_FILE	"/proc/acpi/ibm/fan"
2297
#define IBM_ACPI_THERMAL	"/proc/acpi/ibm/thermal"
2298
#define IBM_ACPI_THERMAL	"/proc/acpi/ibm/thermal"
Lines 3092-3097 gkrellm_sys_sensors_get_temperature(gchar *sensor_path, gint id, Link Here
3092
		return FALSE;
3093
		return FALSE;
3093
		}
3094
		}
3094
3095
3096
	if (interface == ATICONFIG_INTERFACE)
3097
		{
3098
#if GLIB_CHECK_VERSION(2,0,0)
3099
		gchar	*args[] = { "aticonfig", "--odgt", "--adapter", sensor_path, NULL };
3100
		gchar	*output = NULL;
3101
		gchar	*s = NULL;
3102
3103
		result = g_spawn_sync(NULL, args, NULL,
3104
					G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
3105
					NULL, NULL, &output, NULL, NULL, NULL);
3106
3107
		if(result && output)
3108
			{
3109
			gfloat dummy;
3110
3111
			if(!temp)
3112
				temp = &dummy;
3113
			s = strstr(output, "Sensor");
3114
			if (s)
3115
				result = (sscanf(s,"Sensor %*s Temperature - %f", temp) == 1);
3116
			else
3117
				result = FALSE;
3118
			}
3119
3120
		g_free(output);
3121
		return result;
3122
#else
3123
		return FALSE;
3124
#endif
3125
		}
3095
#ifdef HAVE_LIBSENSORS
3126
#ifdef HAVE_LIBSENSORS
3096
	if (interface == LIBSENSORS_INTERFACE)
3127
	if (interface == LIBSENSORS_INTERFACE)
3097
		return libsensors_get_value(sensor_path, id, iodev, temp);
3128
		return libsensors_get_value(sensor_path, id, iodev, temp);
Lines 3525-3530 sensors_nvclock_ngpus(void) Link Here
3525
	return n;
3556
	return n;
3526
	}
3557
	}
3527
3558
3559
static gint
3560
sensors_aticonfig_ngpus(void)
3561
	{
3562
	gint		n = 0, s = 0;
3563
#if GLIB_CHECK_VERSION(2,0,0)
3564
	gchar		*args[] = { "aticonfig", "--list-adapters", NULL };
3565
	gchar		*output = NULL;
3566
	gboolean	result;
3567
3568
	result = g_spawn_sync(NULL, args, NULL,
3569
				G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
3570
				NULL, NULL, &output, NULL, NULL, NULL);
3571
3572
	if(result && output)
3573
		n = sscanf(output, "* %d.", &s);
3574
	g_free(output);
3575
#endif
3576
	if (_GK.debug_level & DEBUG_SENSORS)
3577
		printf("aticonfig gpus = %d\n", n);
3578
	return n;
3579
	}
3580
3528
static void
3581
static void
3529
sensors_nvclock_init(gboolean enable)
3582
sensors_nvclock_init(gboolean enable)
3530
	{
3583
	{
Lines 3698-3704 gkrellm_sys_sensors_init(void) Link Here
3698
		fclose(f);
3751
		fclose(f);
3699
		}
3752
		}
3700
3753
3701
	/* nvidia-settings GPU core & ambient temperatues
3754
	/* nvidia-settings/aticonfig GPU core & ambient temperatures
3702
	*/
3755
	*/
3703
	cnt = sensors_nvidia_settings_ngpus();
3756
	cnt = sensors_nvidia_settings_ngpus();
3704
	ngpus_added = 0;
3757
	ngpus_added = 0;
Lines 3744-3750 gkrellm_sys_sensors_init(void) Link Here
3744
		gkrellm_sensors_sysdep_option("use_nvclock",
3797
		gkrellm_sensors_sysdep_option("use_nvclock",
3745
			_("Use nvclock for NVIDIA GPU temperatures"),
3798
			_("Use nvclock for NVIDIA GPU temperatures"),
3746
			sensors_nvclock_init);
3799
			sensors_nvclock_init);
3747
3748
	id = 0;
3800
	id = 0;
3749
	/* Try for ambient only for gpu:0 for now */
3801
	/* Try for ambient only for gpu:0 for now */
3750
	if (gkrellm_sys_sensors_get_temperature("GPUAmbientTemp", id, 0,
3802
	if (gkrellm_sys_sensors_get_temperature("GPUAmbientTemp", id, 0,
Lines 3756-3761 gkrellm_sys_sensors_init(void) Link Here
3756
					1.0, 0.0, NULL, "GPU A");
3808
					1.0, 0.0, NULL, "GPU A");
3757
		}
3809
		}
3758
3810
3811
	/* aticonfig temperature display -
3812
	|  it's very simular to nvidia case
3813
	*/
3814
	cnt = sensors_aticonfig_ngpus();
3815
	ngpus_added = 0;
3816
	if (cnt < 2)
3817
		{
3818
		if (gkrellm_sys_sensors_get_temperature("0", id, 0,
3819
						ATICONFIG_INTERFACE, NULL))
3820
			{
3821
			gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE,
3822
						"0", "ATI/AMD GPU Core",
3823
						id, 0, ATICONFIG_INTERFACE,
3824
						1.0, 0.0, NULL, "GPU C");
3825
			++ngpus_added;
3826
			}
3827
		}
3828
	else
3829
		{
3830
		for (id = 0; id < cnt; ++id)
3831
			{
3832
			sensor_path = g_strdup_printf("%d", id);
3833
			if (gkrellm_sys_sensors_get_temperature(sensor_path, id, 0,
3834
							ATICONFIG_INTERFACE, NULL))
3835
				{
3836
				snprintf(id_name, sizeof(id_name), "ATI/AMD GPU:%d Core", id);
3837
				default_label = g_strdup_printf("GPU:%d", id);
3838
				gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE,
3839
							sensor_path, id_name,
3840
							id, 0, ATICONFIG_INTERFACE,
3841
							1.0, 0.0, NULL, default_label);
3842
				g_free(default_label);
3843
				++ngpus_added;
3844
				}
3845
			g_free(sensor_path);
3846
			}
3847
		}
3759
3848
3760
	/* UNINORTH sensors
3849
	/* UNINORTH sensors
3761
	*/
3850
	*/

Return to bug 20355