[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: thermal control iMacG5 - solution with kernel 2.6.15



>> Check /sys/devices/platform/windfarm.0/*, the files in there should
>> show you the fan speeds and temperatures.

> Great, I can see them now. Thanks a lot!

Thanks for your discussion, which allowed me to make a (crude but
working) thermal control on my iMac G5 with a 2.6.15 kernel,
where /sys/devices/platform/windfarm.0/cpu_fan doesn't exist. I post the
solution here, so anyone shy of trying a rc kernel could find it.

Apparently reading the temperature is enough to stop the fans for a
while, probably because the firmware sees that as the sign of having a
thermal control. One can therefor run the script below, even as a user,
to switch the fan off as long the temperature isn't to high.

By the way, since this script works for an unprivileged user, it may
raise security concern. I guess an iMac G5 with windfarm enabled but no
thermal control could be dammaged by a variant of this script (just set
MaxTemp to 200) run by *any* user. Since the simple reading of cpu_temp
switches the fan off, shouldn't it be only allowed to root (at least
when there is no control of the fans) ?

	Fred, happier since his iMac is quieter.

PS: Please CC me: I'm not on the list

#! /bin/sh
# Frédéric Grosshans (c) 2006 
# GPL v2 or later

TempFile='/sys/devices/platform/windfarm.0/cpu_temp'
RepeatTime=15
MaxTemp=60
CoolingTime=180 #Above one minute (?) needed to let the fans start

while true
	do
		# Reading the cpu_temp file is enough to stop the fans 
		# for a while ...
		read Tmp< $TempFile;
		echo $(date) ${Tmp%%\.*}
		while [ ${Tmp%%\.*} -le $MaxTemp ]
			do
				sleep $RepeatTime;
				read Tmp< $TempFile;
				echo $(date) ${Tmp}
			done
		echo $(date) "Cooling !"
		#But on sometime has to let them run
		sleep $CoolingTime
	done






Reply to: