Author: blogic
Date: 2014-08-03 13:15:35 +0200 (Sun, 03 Aug 2014)
New Revision: 41965

Modified:
   
branches/barrier_breaker/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
   branches/barrier_breaker/package/kernel/mac80211/files/lib/wifi/mac80211.sh
Log:
mac80211: support wildcard paths when matching phys

This change introduces support for wildcard patterns in "option path"
of section "wifi-device".

Objective is to allow paths like "*/usb[0-9]/*/*" in order to claim
any usb device using the same backend type, regardless of its bus
address or phy name.

Signed-off-by: Jo-Philipp Wich <[email protected]>

Backport of r41873

Modified: 
branches/barrier_breaker/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
===================================================================
--- 
branches/barrier_breaker/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
      2014-08-03 11:15:33 UTC (rev 41964)
+++ 
branches/barrier_breaker/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
      2014-08-03 11:15:35 UTC (rev 41965)
@@ -364,9 +364,13 @@
 
 find_phy() {
        [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
-       [ -n "$path" -a -d "/sys/devices/$path/ieee80211" ] && {
-               phy="$(ls /sys/devices/$path/ieee80211 | grep -m 1 phy)"
-               [ -n "$phy" ] && return 0
+       [ -n "$path" ] && {
+               for phy in /sys/devices/$path/ieee80211/phy*; do
+                       [ -e "$phy" ] && {
+                               phy="${phy##*/}"
+                               return 0
+                       }
+               done
        }
        [ -n "$macaddr" ] && {
                for phy in $(ls /sys/class/ieee80211 2>/dev/null); do

Modified: 
branches/barrier_breaker/package/kernel/mac80211/files/lib/wifi/mac80211.sh
===================================================================
--- branches/barrier_breaker/package/kernel/mac80211/files/lib/wifi/mac80211.sh 
2014-08-03 11:15:33 UTC (rev 41964)
+++ branches/barrier_breaker/package/kernel/mac80211/files/lib/wifi/mac80211.sh 
2014-08-03 11:15:35 UTC (rev 41965)
@@ -8,9 +8,13 @@
 
        local devpath
        config_get devpath "$device" path
-       [ -n "$devpath" -a -d "/sys/devices/$devpath/ieee80211" ] && {
-               phy="$(ls /sys/devices/$devpath/ieee80211 | grep -m 1 phy)"
-               [ -n "$phy" ] && return
+       [ -n "$devpath" ] && {
+               for _phy in /sys/devices/$devpath/ieee80211/phy*; do
+                       [ -e "$_phy" ] && {
+                               phy="${_phy##*/}"
+                               return
+                       }
+               done
        }
 
        local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to