我在我的 Macbook Air 上安裝了 Debian(為什麼?因為有趣。),而且它實際上運作得很好。
然而,在註意到一個名為「kidle_inject」的進程佔用了所有核心上 100% 的 CPU 後,我想檢查溫度,「感測器」告訴我溫度徘徊在 96 攝氏度。
我注意到,在 OSX 上,只要我打開系統,它就會運行(可能剛才還很熱),而在 Debian 上我幾乎聽不到它的聲音,而且筆記本電腦在觸摸時似乎也更熱。 Debian 上。
有沒有辦法讓 Debian 更積極地使用風扇?
答案1
http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/事實證明這是一個有用的開始。
在 中/sys/devices/platform/applesmc.768/
,有一些有用的選項可用於控制風扇速度。
其中“fan1_min”和“fan1_max”是最小和最大風扇速度,“fan1_output”是直接控制風扇的設置,“fan1_manual”使系統忽略最小和最大設定並直接響應更改到“fan1_output”。
如何自動控制這些是議程上的下一個要點。
編輯:另外,請小心這些設置,因為很可能只是關閉風扇,使您的系統面臨過熱的危險。
第二次編輯:
該頁面上的資訊似乎有點過時,因為我發現溫度感測器讀數與風扇設定位於同一目錄中,而不是該頁面建議的其他目錄中。
第三次編輯:根據該頁面上的演算法,我編寫了一個快速的 python 腳本,當以 root 身份運行時,它似乎運作得很好:
#!/usr/bin/python
import time
import glob
import math
last_temp = 0
while True:
time.sleep(1)
files = glob.glob("/sys/devices/platform/applesmc.768/temp*_input")
temp = 0
for file in files:
with open(file) as openfile:
sensor_temp = openfile.read()
temp = max(int(sensor_temp)/1000, temp)
with open("/sys/devices/platform/applesmc.768/fan1_input") as fan1_input:
current_speed = int(fan1_input.read())
increasing = temp > last_temp
last_temp = temp
if increasing:
if temp <= 65:
speed = max(current_speed, 2000)
elif 65 < temp < 80:
step = (6200 - 2000) / ((80 - 65) * (80 - 64) / 2)
speed = max(current_speed, math.ceil(2000 + (temp - 65) * (temp - 64) / 2 * step))
elif temp >= 80:
speed = 6200
else:
if temp >= 80:
speed = 6200
elif 55 < temp < 80:
step = (6200 - 2000) / ( (80 - 55) * (80 - 54) / 2 )
speed = min(current_speed, math.floor(6200 - (80 - temp) * (81 - temp) / 2 * step))
elif temp <= 55:
speed = 2000
print "Temperature: " + str(temp) + " Increasing?: " + str(increasing) + " Current speed: " + str(current_speed) + " Target: " + str(speed)
with open("/sys/devices/platform/applesmc.768/fan1_min", "w") as fan1_input:
#with open("/home/werner/testtemp", 'w+') as fan1_input:
fan1_input.write(str(int(speed)))