Skip to content
Snippets Groups Projects
Commit 1c0557cf authored by Jo-Philipp Wich's avatar Jo-Philipp Wich
Browse files

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: default avatarJo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 41873
parent b6153f92
No related branches found
No related tags found
No related merge requests found
...@@ -364,9 +364,13 @@ mac80211_generate_mac() { ...@@ -364,9 +364,13 @@ mac80211_generate_mac() {
find_phy() { find_phy() {
[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
[ -n "$path" -a -d "/sys/devices/$path/ieee80211" ] && { [ -n "$path" ] && {
phy="$(ls /sys/devices/$path/ieee80211 | grep -m 1 phy)" for phy in /sys/devices/$path/ieee80211/phy*; do
[ -n "$phy" ] && return 0 [ -e "$phy" ] && {
phy="${phy##*/}"
return 0
}
done
} }
[ -n "$macaddr" ] && { [ -n "$macaddr" ] && {
for phy in $(ls /sys/class/ieee80211 2>/dev/null); do for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
......
...@@ -8,9 +8,13 @@ lookup_phy() { ...@@ -8,9 +8,13 @@ lookup_phy() {
local devpath local devpath
config_get devpath "$device" path config_get devpath "$device" path
[ -n "$devpath" -a -d "/sys/devices/$devpath/ieee80211" ] && { [ -n "$devpath" ] && {
phy="$(ls /sys/devices/$devpath/ieee80211 | grep -m 1 phy)" for _phy in /sys/devices/$devpath/ieee80211/phy*; do
[ -n "$phy" ] && return [ -e "$_phy" ] && {
phy="${_phy##*/}"
return
}
done
} }
local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')" local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment