mac80211: make the path phy lookup more robust regarding config upgrades, allow partial path matching

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48425
This commit is contained in:
Felix Fietkau 2016-01-21 13:28:04 +00:00
parent 59e3a4714a
commit 95965cd813
2 changed files with 7 additions and 9 deletions

View File

@ -394,11 +394,10 @@ mac80211_generate_mac() {
find_phy() {
[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
[ -n "$path" ] && {
for phy in /sys/devices/$path/ieee80211/phy*; do
[ -e "$phy" ] && {
phy="${phy##*/}"
return 0
}
for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
*$path) return 0;;
esac
done
}
[ -n "$macaddr" ] && {

View File

@ -10,10 +10,9 @@ lookup_phy() {
config_get devpath "$device" path
[ -n "$devpath" ] && {
for _phy in /sys/devices/$devpath/ieee80211/phy*; do
[ -e "$_phy" ] && {
phy="${_phy##*/}"
return
}
case "$(readlink -f /sys/class/ieee80211/$_phy/device)" in
*$devpath) return 0;;
esac
done
}