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/
sudo chmod +x /etc/pm/sleep.d/
sudo nano /etc/pm/sleep.d/

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/