b4c1c8f1d042a1d2850b3e8c82b6a47b6875b8a0
[openwrt/staging/dedeckeh.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 mutiple 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 tplink,tl-xdr4288|\
28 tplink,tl-xdr6086|\
29 tplink,tl-xdr6088)
30 [ "$PHYNBR" = "0" ] && get_mac_label > /sys${DEVPATH}/macaddress
31 ;;
32 esac