Skip to content

Instantly share code, notes, and snippets.

@TomaszGasior
Last active April 2, 2023 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomaszGasior/73f401116e34615a85553dc162f8d772 to your computer and use it in GitHub Desktop.
Save TomaszGasior/73f401116e34615a85553dc162f8d772 to your computer and use it in GitHub Desktop.
Custom fan speed for Dell Optiplex 7050 Micro on Fedora 37 with Intel Core i7-7700T
#!/bin/bash
export CPU_TEMP_THRESHOLD_FOR_FAN_SPEED_LOW=54
export CPU_TEMP_THRESHOLD_FOR_FAN_SPEED_HIGH=68
export SLEEP_TIME_SECS=10
export GET_CPU_TEMP_FILE=/sys/devices/platform/coretemp.0/hwmon/hwmon*/temp1_input
export SET_FAN_SPEED_FILE=/sys/devices/platform/dell_smm_hwmon/hwmon/hwmon*/pwm1
export FAN_SPEED_OFF=0
export FAN_SPEED_LOW=120
export FAN_SPEED_HIGH=250
while true; do
current_cpu_temp=$((`cat $GET_CPU_TEMP_FILE` / 1000))
if (( $current_cpu_temp >= $CPU_TEMP_THRESHOLD_FOR_FAN_SPEED_LOW )); then
echo $FAN_SPEED_LOW > $SET_FAN_SPEED_FILE
if (( $current_cpu_temp >= $CPU_TEMP_THRESHOLD_FOR_FAN_SPEED_HIGH )); then
sleep 1
echo $FAN_SPEED_HIGH > $SET_FAN_SPEED_FILE
fi
else
echo $FAN_SPEED_OFF > $SET_FAN_SPEED_FILE
fi
sleep $SLEEP_TIME_SECS
done
[Unit]
Description=Custom fan speed of Dell computer using i8k driver
[Service]
Type=simple
ExecStart=/usr/local/libexec/dell-custom-fan-speed
Restart=always
[Install]
WantedBy=multi-user.target
options dell_smm_hwmon force=1
@TomaszGasior
Copy link
Author

TomaszGasior commented Apr 2, 2023

Install files to:

  • dell-custom-fan-speed/usr/local/libexec
  • dell-custom-fan-speed.service/usr/local/lib/systemd/system
  • dell_smm_hwmon.conf/etc/modules-load.d
  • dell_smm_hwmon-force.conf/etc/modprobe.d

Enable with:

  • sudo systemctl daemon-reload; sudo systemctl enable dell-custom-fan-speed.service
  • sudo dracut --force (rebuild initramfs)
  • reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment