aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-08-03 11:15:35 +0000
committerJohn Crispin <blogic@openwrt.org>2014-08-03 11:15:35 +0000
commit21384340fad7e3eb63ab2e75c2974da87e498ebf (patch)
treee342895e0a862a0553588d196362c3eac4ae8319 /package
parenteabfb2f4062bbab2478ae8fb0077a44273fa26c4 (diff)
downloadupstream-21384340fad7e3eb63ab2e75c2974da87e498ebf.tar.gz
upstream-21384340fad7e3eb63ab2e75c2974da87e498ebf.tar.bz2
upstream-21384340fad7e3eb63ab2e75c2974da87e498ebf.zip
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 <jow@openwrt.org> Backport of r41873 git-svn-id: svn://svn.openwrt.org/openwrt/branches/barrier_breaker@41965 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh10
-rw-r--r--package/kernel/mac80211/files/lib/wifi/mac80211.sh10
2 files changed, 14 insertions, 6 deletions
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 64b0f989b7..e6241deb5f 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -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
diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
index 5d3adb1511..a3b2199507 100644
--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
@@ -8,9 +8,13 @@ lookup_phy() {
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')"