Skip to content

Commit

Permalink
Merge pull request #589 from jmencak/powersave-wifi
Browse files Browse the repository at this point in the history
Do not report errors on systems with no wifi
  • Loading branch information
yarda authored Feb 8, 2024
2 parents 11c6c57 + 14d40cf commit 95be4c0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion profiles/functions
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,16 @@ _wifi_set_power_level() {
# 6 disable power savings
level=$1

# do not report errors on systems with no wireless
[ -e /proc/net/wireless ] || return 0

# apply the settings using iwpriv
ifaces=$(cat /proc/net/wireless | grep -v '|' | sed 's@^ *\([^:]*\):.*@\1@')
for iface in $ifaces; do
iwpriv $iface set_power $level
done

# some adapters may relay on sysfs
# some adapters may rely on sysfs
for i in /sys/bus/pci/devices/*/power_level; do
(echo $level > $i) &> /dev/null
done
Expand Down

0 comments on commit 95be4c0

Please sign in to comment.