blob: 9822ad2a21988076db3b884cc8c27f8bd5bbf7c0 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#!/bin/sh
append DRIVERS "mt7615e5"
. /lib/wifi/mt7615e.inc
# Hua Shao : This script assumes that:
# 1. 7615 is the only wifi device.
# 2. DBDC=1
# 3. MULTI_PROFILE=1
# 4. DEFAULT_5G=1, which means ra0/rai0/rae0 -> 5G, rax0/ray0/raz0 -> 2G
# If your product is not exactly the same as above, then some minor fixes are necessary.
prepare_mt7615e5() {
#prepare_ralink_wifi mt7615e
:
}
scan_mt7615e5() {
#scan_ralink_wifi mt7615e mt7615e
:
}
disable_mt7615e5() {
# unregister hwnat hook.
iwpriv ra0 set hw_nat_register=0 2>/dev/null || true
[ x"$2" == x"" ] && {
# let mt7615e2 do the work
return
}
cd /sys/class/net/
for vif in apcli*; do
if echo "$vif" | grep -q -e "apcli[0-9ie]" ; then
ifconfig $vif down;
fi
done
for vif in ra*; do
if echo "$vif" | grep -q -e "ra[0-9ie]" ; then
ifconfig $vif down;
ubus call network.interface.lan remove_device "{\"name\":\"$vif\"}"
fi
done
}
enable_mt7615e5() {
[ x"$2" == x"" ] && {
# let mt7615e2 do the work
return
}
[ -f /tmp/mtk/wifi/.mt7615e.1.2g.need_reload ] && {
cd /sys/class/net/
for vif in apcli*; do
ifconfig $vif down;
done
for vif in ra*; do
ifconfig $vif down;
done
rmmod mt7615e
modprobe mt7615e
}
uci2dat -d mt7615e5 -f /etc/wireless/mt7615e/mt7615e.1.5G.dat > /tmp/uci2dat.log
ifconfig ra0 up # ra0 is the root vif
cd /sys/class/net/
for vif in ra*; do
if echo "$vif" | grep -q -e "ra[0-9ie]" ; then
ifconfig $vif up;
ubus call network.interface.lan add_device "{\"name\":\"$vif\"}"
local tmp=$(brctl show | grep $vif)
if [ x"$tmp" == x"" ]
then
echo "add $vif to br-lan" >> /tmp/wifi.log
brctl addif br-lan $vif
fi
fi
done
for vif in apcli*; do
if echo "$vif" | grep -q -e "apcli[0-9ie]" ; then
ifconfig $vif up;
fi
done
# register hwnat hook.
iwpriv ra0 set hw_nat_register=1 2>/dev/null || true
}
detect_mt7615e5() {
ssid5g=mt7615e-5g-`ifconfig eth0 | grep HWaddr | cut -c 51- | sed 's/://g'`
[ -e /etc/config/wireless ] && return
cat <<EOF
config wifi-device mt7615e5
option type mt7615e5
option vendor ralink
option band 5g
option channel 0
option autoch 2
option g256qam 1
option e2paccmode 2
config wifi-iface
option device mt7615e5
option ifname ra0
option network lan
option mode ap
option ssid $ssid5g
option encryption psk2
option key 12345678
EOF
}
|