Last active
December 10, 2016 00:40
-
-
Save jpouellet/abb3362c26ff96180f53e2cdb2493667 to your computer and use it in GitHub Desktop.
Reload drivers for my intel wireless card automatically if it hangs (on suspend/resume)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
lock=/var/run/lock/iwl-reset.lock | |
fail_msg='iwlwifi 0000:00:00.0: Failed to load firmware chunk!' | |
do_reset=' | |
echo "Resetting wifi..." | |
rmmod iwlmvm | |
rmmod iwlwifi | |
modprobe iwlwifi | |
modprobe iwlmvm | |
sleep 2 | |
' | |
dmesg --kernel --notime --follow --level=err \ | |
| while read msg; do | |
if [ X"$msg" = X"$fail_msg" ]; then | |
echo 'Wifi appears hung' | |
flock -xn "$lock" -c "$do_reset" & | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I could just always {un,re}load the driver on suspend/resume, but sometimes it actually comes back and doesn't need to be reset.