Ubuntu laptop fan speed revisited

My previous post on laptop fan speed worked for me, although wordpress buggered the quotes in the code. My only slight problem was that the screen brightness got reset to full after resuming from sleep. It’s taken me 6 months, but I finally got around to sorting it out.

The solution lay in reading the screen brightness from /sys/class/backlight/acpi_video0/brightness, storing it in a variable then resetting it after the fan speeds have been reset.

sudo touch /etc/pm/sleep.d/99_cooldown.sh
sudo chmod +x /etc/pm/sleep.d/99_cooldown.sh
sudo nano /etc/pm/sleep.d/99_cooldown.sh

In the file paste (ctrl+shift+v) this:

# Stop fan in HP2510p after resuming from sleep
value=`cat /sys/class/backlight/acpi_video0/brightness`
/bin/echo "0" >/sys/class/thermal/cooling_device0/cur_state
/bin/echo "0" >/sys/class/thermal/cooling_device1/cur_state
/bin/echo "0" >/sys/class/thermal/cooling_device2/cur_state
/bin/echo "0" >/sys/class/thermal/cooling_device3/cur_state
/bin/echo "0" >/sys/class/thermal/cooling_device4/cur_state
/bin/echo "0" >/sys/class/thermal/cooling_device5/cur_state
/bin/echo "0" >/sys/class/thermal/cooling_device6/cur_state
/bin/echo "$value" >/sys/class/backlight/acpi_video0/brightness
exit 0

You may need to edit this according to the number of cooling device entries under /sys/class/thermal/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.