summaryrefslogtreecommitdiff
path: root/recipes-kernel/rsi-91x/files/rs9113_remove_modules.sh
blob: 606f069bd8f3a34abf6b57a2ba307087da3b44bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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