From 14d40cfa6e747d7da74126cf52f8867d41b833ef Mon Sep 17 00:00:00 2001 From: Jiri Mencak Date: Wed, 24 Jan 2024 14:49:36 +0100 Subject: [PATCH] Do not report errors on systems with no wifi This change does not attempt to _wifi_set_power_level() unless /proc/net/wireless exists. Other changes: fix a typo. Signed-off-by: Jiri Mencak --- profiles/functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profiles/functions b/profiles/functions index 9dd3bd91b..1468f403e 100644 --- a/profiles/functions +++ b/profiles/functions @@ -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