-
Notifications
You must be signed in to change notification settings - Fork 0
/
broadcomctl.sh
executable file
·55 lines (47 loc) · 1.32 KB
/
broadcomctl.sh
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
53
54
55
#!/bin/bash
#----------------------------------------------------------------------------------------
# brcm-BCM4350-ctl
# Version: 0.4.2
#
# WebSite:
# https://lab.mfwlab.com/lab/brcm-BCM4350-ctl/
#
# Copyright © 2020 - Pablo Meniño <pablo.menino@mfwlab.com>
#----------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------
# Main
start_service() {
echo "Adding brcmfmac module"
modprobe brcmfmac || exit -1
sleep 3
echo "Turning radio on"
nmcli radio wifi on || exit -2
echo "Disable power save"
# Get first wifi device
wifi_if_dev=$(iw dev | awk '$1=="Interface"{print $2}')
iw dev $wifi_if_dev set power_save off || exit -3
}
stop_service() {
echo "Turning radio off"
nmcli radio wifi off || exit -1
sleep 3
echo "Removing brcmfmac module"
modprobe -rf brcmfmac || exit -2
}
case $1 in
start)
start_service $1
;;
stop)
stop_service $1
;;
restart)
stop_service $1
sleep 3
start_service $1
;;
esac
#----------------------------------------------------------------------------------------
# Exit
exit 0
#----------------------------------------------------------------------------------------