diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-07-29 09:48:07 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-07-29 09:48:07 +0000 |
commit | 9887616a35142165363a2ae41ce8ae29db898bec (patch) | |
tree | 60ce1cd034379e7f4bf7832b7837fbf5af4d93fe /package/kernel/mac80211/files/lib/wifi | |
parent | 4c377f4f71dec362a3168527cb509db68a0124ec (diff) | |
download | master-187ad058-9887616a35142165363a2ae41ce8ae29db898bec.tar.gz master-187ad058-9887616a35142165363a2ae41ce8ae29db898bec.tar.bz2 master-187ad058-9887616a35142165363a2ae41ce8ae29db898bec.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>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41873 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel/mac80211/files/lib/wifi')
-rw-r--r-- | package/kernel/mac80211/files/lib/wifi/mac80211.sh | 10 |
1 files changed, 7 insertions, 3 deletions
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')" |