Wi-Fi падает случайным образом

OpenSSH (включая портативную версию) больше не зависит ни от OpenSSL, ни от LibreSSL, если на то пошло.

0
01.06.2018, 10:54
1 ответ

Это не устраняет проблему, так как Wi-Fi в конечном итоге снова отключается --все, что делает этот скрипт, это делает так, чтобы у вас снова был Wi-Fi без необходимости перезагрузки (сохранить как fixwifi.sh и запустите как sudo):

#!/bin/sh

# If an interface name was not passed in then assume that wlan0 is the interface name.
if [ -z "$1" ]; then
    interface="wlan0"
else
    interface=$1
fi

# Figure out what pci slot Linux has assigned the Network controller: Intel Corporation Wireless 7260
wirelessPCI=$(lspci |grep "Wireless 7260")
pci=$(echo ${wirelessPCI} | awk '{ print $1 }')
devicePath="/sys/bus/pci/devices/0000:$pci/remove"

# Not the best solution as this script can hang. 
# But since if this script fails the ONLY way to revive the wifi anyway is a reboot...
# Feel free to improve the script if you have the scriptfu ninja skills to do so.
while true; do

    # Tell Linux to remove the wifi card from the PCI device list only if it exists in the first place.
    if [ -f $devicePath ]; then
        echo 1 | sudo tee $devicePath > /dev/null
        sleep 1
    fi

    # Reprobe the driver modules in case we have removed them in a failed attempt to wake the network card.
    sudo modprobe iwlmvm
    sudo modprobe iwlwifi

    # Try to have Linux bring the network card back online as a PCI device. 
    echo 1 | sudo tee /sys/bus/pci/rescan > /dev/null
    sleep 1

    # Check if Linux managed to bring the network card back online as a PCI device.
    if [ -f $devicePath ]; then

        # Looks like we are back in business. 
        # So we try to set the PCI slot with some voodoo I don't understand that the Intel devs told me to try.
        # https://bugzilla.kernel.org/show_bug.cgi?id=191601
        sudo setpci -s $pci 0x50.B=0x40

        # Bring the wireless network interface up.
        sudo ifconfig $interface up

        # Did the wifi interface actually go live?
        exitCode=$?
        if [ $exitCode -eq 0 ];then

            # Not sure why in the hell this is not the default for wireless intefaces.
            # It is well documented that: (power_management === ON) === Wifi-Stupidity
            sudo iwconfig $interface power off

            # The exit code will be the exit code of our attempt at turning power management off for $interface/wlan0.
            break
        fi
    else
        # It's worse than that the wifi's dead Jim! Dead Jim! Dead!
        # We tell Linux to remove the the wifi driver modules and loop back in an attempt to revive the wifi.
        sudo modprobe -r iwlmvm
        sudo modprobe -r iwlwifi
    fi
done
1
28.01.2020, 02:43

Теги

Похожие вопросы