mediatek: add support for Zyxel EX5601-T0 router
[openwrt/staging/ldir.git] / target / linux / mediatek / filogic / base-files / etc / hotplug.d / ieee80211 / 11_fix_wifi_mac
1 [ "$ACTION" == "add" ] || exit 0
2
3 PHYNBR=${DEVPATH##*/phy}
4
5 [ -n $PHYNBR ] || exit 0
6
7 . /lib/functions.sh
8 . /lib/functions/system.sh
9
10 board=$(board_name)
11
12 case "$board" in
13 asus,tuf-ax4200)
14 CI_UBIPART="UBI_DEV"
15 addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
16 # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict
17 # addresses on multiple VIFs with the other radio. Set LA bit and increment
18 # mac-address instead.
19 [ "$PHYNBR" = "0" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
20 [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
21 ;;
22 bananapi,bpi-r3)
23 addr=$(macaddr_add $(cat /sys/class/net/eth0/address) 2)
24 [ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress
25 [ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress
26 ;;
27 cudy,wr3000-v1)
28 addr=$(mtd_get_mac_binary bdinfo 0xde00)
29 # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict
30 # addresses on multiple VIFs with the other radio. Set LA bit and increment
31 # mac-address instead.
32 [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
33 [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
34 ;;
35 tplink,tl-xdr4288|\
36 tplink,tl-xdr6086|\
37 tplink,tl-xdr6088)
38 [ "$PHYNBR" = "0" ] && get_mac_label > /sys${DEVPATH}/macaddress
39 ;;
40 zyxel,ex5601-t0)
41 addr=$(mtd_get_mac_binary "Factory" 0x4)
42 [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
43 ;;
44 esac