[openwrt/openwrt] mediatek: set persistent wifi mac for bpi-r64 and bpi-r3
LEDE Commits
lede-commits at lists.infradead.org
Thu Nov 24 08:47:16 PST 2022
dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/c1d1202e67dc929e58c4d6d1f2698363cbf1b6f7
commit c1d1202e67dc929e58c4d6d1f2698363cbf1b6f7
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu Nov 24 16:38:29 2022 +0000
mediatek: set persistent wifi mac for bpi-r64 and bpi-r3
Use persistent MAC address for the built-in wireless interfaces of the
BPi-R64 and BPi-R3 development boards.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
.../base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 18 ++++++++++++++++++
.../base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 3 +++
2 files changed, 21 insertions(+)
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
new file mode 100644
index 0000000000..fd822e3d4c
--- /dev/null
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
@@ -0,0 +1,18 @@
+[ "$ACTION" == "add" ] || exit 0
+
+PHYNBR=${DEVPATH##*/phy}
+
+[ -n $PHYNBR ] || exit 0
+
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+board=$(board_name)
+
+case "$board" in
+ bananapi,bpi-r3)
+ addr=$(macaddr_add $(cat /sys/class/net/eth0/address) 2)
+ [ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress
+ ;;
+esac
diff --git a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
index d573465745..00ed12cd2f 100644
--- a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
+++ b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
@@ -10,6 +10,9 @@ PHYNBR=${DEVPATH##*/phy}
board=$(board_name)
case "$board" in
+ bananapi,bpi-r64)
+ [ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress
+ ;;
ruijie,rg-ew3200gx-pro)
[ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress
More information about the lede-commits
mailing list