Created
August 12, 2013 15:21
-
-
Save chrp/6211802 to your computer and use it in GitHub Desktop.
Auto adjust fan speed of graphics card with ATI catalyst driver on Ubuntu.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# first part, get temperature | |
temp_str = `aticonfig --adapter=0 --od-gettemperature` | |
temp = temp_str.scan(/Sensor 0: Temperature - (\d+\.\d+) C/)[0][0].to_i | |
# determine fan speed | |
thresholds = [ 40, 60, 70, 80, 85 ] | |
speeds = [ 10, 25, 30, 35, 50 ] | |
speed = 100 # default speed | |
thresholds.each_with_index do |threshold, index| | |
speed = speeds[index] and break if temp < threshold | |
end | |
# set speed | |
`aticonfig --pplib-cmd "set fanspeed 0 #{speed}"` | |
puts "Temperature: #{temp}°C / Fan speed level: #{speed}%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment