Author: nbd
Date: 2016-01-21 14:28:04 +0100 (Thu, 21 Jan 2016)
New Revision: 48425

Modified:
   trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
   trunk/package/kernel/mac80211/files/lib/wifi/mac80211.sh
Log:
mac80211: make the path phy lookup more robust regarding config upgrades, allow 
partial path matching

Signed-off-by: Felix Fietkau <[email protected]>

Modified: trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
===================================================================
--- trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
2016-01-21 11:46:18 UTC (rev 48424)
+++ trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
2016-01-21 13:28:04 UTC (rev 48425)
@@ -394,11 +394,10 @@
 find_phy() {
        [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
        [ -n "$path" ] && {
-               for phy in /sys/devices/$path/ieee80211/phy*; do
-                       [ -e "$phy" ] && {
-                               phy="${phy##*/}"
-                               return 0
-                       }
+               for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
+                       case "$(readlink -f /sys/class/ieee80211/$phy/device)" 
in
+                               *$path) return 0;;
+                       esac
                done
        }
        [ -n "$macaddr" ] && {

Modified: trunk/package/kernel/mac80211/files/lib/wifi/mac80211.sh
===================================================================
--- trunk/package/kernel/mac80211/files/lib/wifi/mac80211.sh    2016-01-21 
11:46:18 UTC (rev 48424)
+++ trunk/package/kernel/mac80211/files/lib/wifi/mac80211.sh    2016-01-21 
13:28:04 UTC (rev 48425)
@@ -10,10 +10,9 @@
        config_get devpath "$device" path
        [ -n "$devpath" ] && {
                for _phy in /sys/devices/$devpath/ieee80211/phy*; do
-                       [ -e "$_phy" ] && {
-                               phy="${_phy##*/}"
-                               return
-                       }
+                       case "$(readlink -f /sys/class/ieee80211/$_phy/device)" 
in
+                               *$devpath) return 0;;
+                       esac
                done
        }
 
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to