#!/bin/sh # This script toggles ALPM (Agressive Link Power Management) when on # battery for all SATA AHCI controllers that support it. # Don't do anything if there's no controllers with the feature test ! -z "/sys/class/scsi_host/host*/link_power_management_policy" || exit 0 case "$1" in true) echo "**SATA ALPM power savings ON" val=min_power ;; false) echo "**SATA ALPM power savings OFF" val=max_performance ;; *) echo "**Called with unknown arg \"$1\" (should be true/false)" exit 1 ;; esac for ctl in /sys/class/scsi_host/host*/link_power_management_policy; do echo $val > $ctl done exit 0