mac80211: support wildcard paths when matching phys
[openwrt/openwrt.git] / package / kernel / mac80211 / files / lib / netifd / wireless / mac80211.sh
index a9f9db1eb47bbc84656a6cd9cba8c988ffce6328..e6241deb5f8c115033cc9264fe9b2830e1e77c56 100644 (file)
@@ -53,7 +53,7 @@ drv_mac80211_init_iface_config() {
        config_add_boolean wds powersave
        config_add_int maxassoc
        config_add_int max_listen_int
-       config_add_int dtim_interval
+       config_add_int dtim_period
 
        # mesh
        config_add_string mesh_id
@@ -364,9 +364,13 @@ mac80211_generate_mac() {
 
 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