summaryrefslogtreecommitdiff
path: root/package/ramips/drivers/mt7615e/files/mt7615e.inc
blob: 783191d9b11b4cadf7c43cd7ca191d55e1038b7c (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
#!/bin/sh
# this file will be included into mt7615e2.sh and mt7615e5.sh

disable_mt7615e() {
	cd /sys/class/net/

	# disable apcli interfaces
	for vif in apcli*; do
			ifconfig $vif down;
	done
	# disable ap interfaces
	for vif in ra*; do
			ifconfig $vif down;
			ubus call network.interface.lan remove_device "{\"name\":\"$vif\"}"
	done

	cd -
}


enable_mt7615e() {
	cd /sys/class/net/
	uci2dat -d mt7615e2 -f /etc/wireless/mt7615e/mt7615e.1.2G.dat > /tmp/uci2dat.log
	uci2dat -d mt7615e5 -f /etc/wireless/mt7615e/mt7615e.1.5G.dat >> /tmp/uci2dat.log

	ifconfig ra0 up # ra0 is the root vif

	# enable ap interfaces
	for vif in ra*; do
		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
	done

	# enable apcli interfaces
	for vif in apcli*; do
		ifconfig $vif up;
	done
	cd -
}