Skip to content

Instantly share code, notes, and snippets.

@nottux
Last active March 22, 2021 16:01
Show Gist options
  • Save nottux/4b7eb461d95dc6889a5b154b9acbdc74 to your computer and use it in GitHub Desktop.
Save nottux/4b7eb461d95dc6889a5b154b9acbdc74 to your computer and use it in GitHub Desktop.
That's how you save power
#!/bin/bash
if ls /tmp/fr_powsav.sh &>/dev/null
#credits to "Ric Klaren" @askubuntu.com https://askubuntu.com/a/1026527/928621
then HIDDEVICES=$(ls /sys/bus/usb/drivers/usbhid | grep -oE '^[0-9]+-[0-9\.]+' | sort -u)
for i in $HIDDEVICES; do
echo -n "Enabling " | cat - /sys/bus/usb/devices/$i/product
echo 'on' | sudo tee /sys/bus/usb/devices/$i/power/control >/dev/null
done
###
exit
fi
if echo "$1"|grep -qi 'b\|l\|t'
then echo killing bluetooth
sudo systemctl start bluetooth
rfkill block bluetooth
fi
sudo powertop --auto-tune
echo powersave|sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
touch /tmp/fr_powsav.sh
bash "$0"
@nottux
Copy link
Author

nottux commented Sep 8, 2020

1:13 > 2:48 hrs powersave (you may need to turn off bluetooth from blueman menu or it might update and say its turned off, I don't remember

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