#!/bin/bash killall -9 wpa_supplicant killall -9 hostapd killall -9 bluetoothd rm -rf /var/run/wpa_supplicant/ sleep 2 # Find the wifi interfaces ints=$(find -L /sys/class/net -maxdepth 2 -name phy80211) # Remove the links with the ip command. for phy in $ints ; do dir=$(dirname $phy) vap=$(basename $dir) echo Setting $vap down logger -p daemon.alert Setting $vap down ip link set $vap down done # So ifdown is not confused, # make sure ifup/ifdown is now # in the down state. if [[ -x /sbin/ifdown ]] ; then for phy in $ints ; do dir=$(dirname $phy) vap=$(basename $dir) logger -p daemon.alert ifdown $vap ifdown $vap done fi modules=" "$(lsmod)" " ### COMMON HAL MODULES for mod in bnep rfcomm rsi_btsdio rsi_btusb rsi_bt91x rsi_sdio rsi_usb rsi_usb_sta_ap rsi_91x_sta_ap rsi_91x mac80211 cfg80211 bluetooth ; do if [[ ${modules} =~ [[:space:]]${mod}[[:space:]] ]] ; then result+=$(rmmod $mod 2>&1) last=$? if [[ -n $result ]] ; then echo "$result" | logger -s -p daemon.notice fi fi done if ((last > 0)) ; then echo "${result}" | logger -s -p daemon.notice lsmod | grep rsi | logger -s -p daemon.notice fi UNBIND=/sys/devices/soc0/soc/2100000.aips-bus/2190000.usdhc/driver/unbind if [[ -f $UNBIND ]] ; then echo 2190000.usdhc >$UNBIND fi