Comment 39 for bug 1913350

Revision history for this message
In , wacossusca34 (wacossusca34-linux-kernel-bugs) wrote :

I also happened to converge along the same hacky solution to reload the driver as Paul did, so for any other users stuck with this hardware waiting for Intel's driver team to properly support this product, you can adopt this script to your liking:

echo "Listening for device crashes"
last=`date +%s`
inst=0
dmesg -W -Lnever | grep --line-buffered "iwlwifi 0000:06:00.0: Failed to wake NIC for hcmd" | while read -r l;
do
    inst=$(expr $inst + 1)
    if [ $inst -ge 2 ]
    then
        cur=`date +%s`
        dif=$(expr $cur - $last)
        if [ $dif -ge 5 ]
        then
            echo -n "Detected crash, cycling device..."
            echo "1" > /sys/bus/pci/devices/0000\:06\:00.0//remove
            sleep 1
            echo "1" > /sys/bus/pci/rescan
            echo " done"
            last=`date +%s`
        fi
        inst=0
    fi
done

When the driver crashes, it takes about 5-10 seconds for it to automatically recover if this script is running as superuser.