hotplug: Allow configuring radio name.
authorBen Greear <greearb@candelatech.com>
Fri, 26 Oct 2018 17:05:39 +0000 (10:05 -0700)
committerJohn Crispin <john@phrozen.org>
Mon, 26 Nov 2018 11:05:45 +0000 (12:05 +0100)
This way the radio (phy) name can be the same through module reloads.

To set the desired name:

uci set wireless.@wifi-device[0].phyname=wiphy0

I guess this only works on ipq6086 boards as I could not find a more
generic place to put this.  Maybe someone can improve it.

Signed-off-by: Ben Greear <greearb@candelatech.com>
target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

index afa425f07540a47a2b6b52b8e4e86616d35423cf..8956bbd74ad2ece1b5a120a27f85db0401bd9a41 100644 (file)
@@ -35,3 +35,24 @@ case "$board" in
        *)
                ;;
 esac
+
+OPATH=${DEVPATH##/devices/platform/}
+OPATH=${OPATH%%/ieee*}
+
+# 10 radios is enough for anyone!
+for i in `seq 0 9`;
+  do
+  BUS=`uci get wireless.@wifi-device[$i].path`
+  if [ "$BUS " == "$OPATH " ]
+      then
+      PHYNAME=${DEVPATH##*ieee80211/}
+      NPHYNAME=`uci get wireless.@wifi-device[$i].phyname`
+      if [ "$NPHYNAME " != " " ]
+          then
+          if [ "$PHYNAME " != "$NPHYNAME " ]
+              then
+              iw $PHYNAME set name $NPHYNAME
+          fi
+      fi
+  fi
+done