#!/bin/sh # NAME: /lib/systemd/system-sleep/wifi-reset # DESC: Resets WiFi which can be flakey after a long suspend. MYNAME=$0 restart_wifi() { /usr/bin/logger $MYNAME 'restart_wifi BEGIN' /sbin/modprobe -v -r mwifiex_pcie # This removes mwifiex too /sbin/modprobe -v mwifiex /sbin/modprobe -v mwifiex_pcie # 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