Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 36 lines (28 sloc) 1.55 KB
#!/bin/sh
# OK so this even exists because after suspending my Dell Vostro 3350
# without headphones plugged in they won't work after resuming from it.
# Same goes for speakers at suspend with headphones plugged.
#
# So how this script works?
# - Stop any player that might be using sound output right.
# - Plug or unplug your headphones depending on what output you want to get
# working and run this script.
#
# *Must be run as root*
BATSTAT="`cat /sys/class/power_supply/AC/online`"
if test $BATSTAT -gt 0
then
echo "1" | tee "/sys/module/snd_hda_intel/parameters/power_save" &>/dev/null
echo "Y" | tee "/sys/module/snd_hda_intel/parameters/power_save_controller" &>/dev/null
echo "1" | tee "/sys/module/snd_ac97_codec/parameters/power_save" &>/dev/null
echo "0" | tee "/sys/module/snd_hda_intel/parameters/power_save" &>/dev/null
echo "N" | tee "/sys/module/snd_hda_intel/parameters/power_save_controller" &>/dev/null
echo "0" | tee "/sys/module/snd_ac97_codec/parameters/power_save" &>/dev/null
else
echo "0" | tee "/sys/module/snd_hda_intel/parameters/power_save" &>/dev/null
echo "N" | tee "/sys/module/snd_hda_intel/parameters/power_save_controller" &>/dev/null
echo "0" | tee "/sys/module/snd_ac97_codec/parameters/power_save" &>/dev/null
echo "1" | tee "/sys/module/snd_hda_intel/parameters/power_save" &>/dev/null
echo "Y" | tee "/sys/module/snd_hda_intel/parameters/power_save_controller" &>/dev/null
echo "1" | tee "/sys/module/snd_ac97_codec/parameters/power_save" &>/dev/null
fi
Something went wrong with that request. Please try again.