Rebased from upstream / out of band repository.
[librecmc/librecmc.git] / target / linux / ath79 / base-files / etc / hotplug.d / ieee80211 / 10_fix_wifi_mac
1 #!/bin/ash
2
3 [ "$ACTION" == "add" ] || exit 0
4
5 PHYNBR=${DEVPATH##*/phy}
6
7 [ -n $PHYNBR ] || exit 0
8
9 . /lib/functions.sh
10 . /lib/functions/system.sh
11 . /lib/functions/k2t.sh
12
13 board=$(board_name)
14
15 case "$board" in
16         iodata,wn-ag300dgr)
17                 # There is no eeprom data for 5 GHz wlan in "art" partition
18                 # which would allow to patch the macaddress
19                 [ "$PHYNBR" -eq 1 ] && \
20                         echo $(macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1) > /sys${DEVPATH}/macaddress
21                 ;;
22         phicomm,k2t)
23                 # The K2T factory firmware does use LAN mac address as the 2.4G wifi mac address
24                 [ "$PHYNBR" -eq 1 ] && \
25                         echo $(k2t_get_mac "lan_mac") > /sys${DEVPATH}/macaddress
26                 ;;
27         *)
28                 ;;
29 esac
30