[rdkb][common][app][Refactor hostapd-init.sh]
[Description]
Refactor hostapd-init.sh
1. To compatible two mt715 pcie sku.
phy0 will bring up with 5G setting
phy1 will bring up with 2G setting
[Release-log]
diff --git a/recipes-wifi/hostapd/files/hostapd-init.sh b/recipes-wifi/hostapd/files/hostapd-init.sh
index c49bb5f..a8d9365 100644
--- a/recipes-wifi/hostapd/files/hostapd-init.sh
+++ b/recipes-wifi/hostapd/files/hostapd-init.sh
@@ -3,7 +3,9 @@
create_hostapdConf() {
devidx=0
phyidx=0
-
+ old_path=""
+ pcie7915count=0
+
for _dev in /sys/class/ieee80211/*; do
[ -e "$_dev" ] || continue
@@ -15,6 +17,17 @@
NEW_MAC=$(echo 0x$MAC| awk -F: '{printf "%02x:%s:%s:%s:%s:%s", strtonum($1)+2, $2, $3, $4 ,$5, $6}')
chip="$(cat /sys/class/ieee80211/"$dev"/device/device)"
+ if [ $chip == "0x7915" ]; then
+ path="$(realpath /sys/class/ieee80211/"$dev"/device | cut -d/ -f4-)"
+ if [ -n "$path" ]; then
+ if [ "$path" == "$old_path" ] || [ "$old_path" == "" ]; then
+ pcie7915count="1"
+ else
+ pcie7915count="2"
+ fi
+ fi
+ old_path=$path
+ fi
if [ "$(uci get wireless.radio${phyidx}.disabled)" == "1" ]; then
phyidx=$(($phyidx + 1))
continue
@@ -50,6 +63,10 @@
fi
fi
+ if [ "$pcie7915count" == "2" ]; then
+ cp -f /etc/hostapd-2G.conf /nvram/hostapd"$devidx".conf
+ fi
+
if [ "$band" == "6g" ]; then
cp -f /etc/hostapd-6G.conf /nvram/hostapd"$devidx".conf
fi