Comment 18 for bug 1585886

Revision history for this message
Dimon2242 (dimon2242) wrote :

I created script in /lib/systemd/system-sleep/ and give it chmod +x, and every wakeup it is run.

#!/bin/sh

# NAME: /lib/systemd/system-sleep/iwlwifi-reset
# DESC: Resets Intel WiFi after a long suspend.
# DATE: Apr 1, 2017. Modified April 8, 2017.

# NOTE: Per AU comment restart network.

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
 nohup nm-applet &
    /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