1. Change power state of the wifi card to 3
```
$cat /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
[connection]
wifi.powersave = 3
# Slow sleep fix: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1670041
#wifi.powersave = 2
```
2. After saving the file run `sudo systemctl restart NetworkManager`
3. Make a reset bash script and name it `iwlwifi-reset`
```
#!/bin/sh
# NAME: /lib/systemd/system-sleep/iwlwifi-reset
# DESC: Resets Intel WiFi which can be flakey after a long suspend.
# DATE: Apr 1, 2017. Modified August 30, 2017.
MYNAME=$0
restart_wifi() {
/usr/bin/logger $MYNAME 'restart_wifi BEGIN'
/sbin/modprobe -v -r iwldvm # This removes iwlwifi too
/sbin/modprobe -v iwlwifi # This starts iwldvm too
# systemctl restart NetworkManager.service
/usr/bin/logger 'systemctl restart NetworkManager.service (SUPPRESSED)'
/usr/bin/logger $MYNAME 'restart_wifi END'
}
/usr/bin/logger $MYNAME 'case=[' ${1}' ]'
case "${1}/${2}" in
hibernate|suspend|pre*)
;;
resume|thaw|post*)
restart_wifi;;
esac
```
4. Copy the iwlwifi-reset script to systemd folder
```
sudo cp -r /path-to-iwlwifi/script /lib/systemd/system-sleep/
```
5. Set excute permission for the script
```
chmod a+x /lib/systemd/system-sleep/iwlwifi-reset
```
No comments:
Post a Comment