diff options
author | Felix Fietkau <nbd@nbd.name> | 2019-10-31 12:36:55 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-11-05 12:09:36 +0100 |
commit | 8b15e7f661b4263a7b9fb6a410a5f58263b72caa (patch) | |
tree | d59c3a68ab5b2004cb42d6d2f77cc4dd51613f82 /package/kernel/mac80211/files/lib/wifi | |
parent | d64daf7026ce47788f12130462a3107bdab8718f (diff) | |
download | upstream-8b15e7f661b4263a7b9fb6a410a5f58263b72caa.tar.gz upstream-8b15e7f661b4263a7b9fb6a410a5f58263b72caa.tar.bz2 upstream-8b15e7f661b4263a7b9fb6a410a5f58263b72caa.zip |
mac80211: add support for multiple wiphys behind a single device
The device path will be the same for the first phy. For all subsequent
phys, the path gets an extra +1, +2, ...
Move the code for converting path to phy and vice versa to a separate
library script shared by config detection code and the netifd wireless
handler script
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/kernel/mac80211/files/lib/wifi')
-rw-r--r-- | package/kernel/mac80211/files/lib/wifi/mac80211.sh | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index 511a9188db..be9c537926 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -1,4 +1,6 @@ #!/bin/sh +. /lib/netifd/mac80211.sh + append DRIVERS "mac80211" lookup_phy() { @@ -9,11 +11,8 @@ lookup_phy() { local devpath config_get devpath "$device" path [ -n "$devpath" ] && { - for phy in $(ls /sys/class/ieee80211 2>/dev/null); do - case "$(readlink -f /sys/class/ieee80211/$phy/device)" in - *$devpath) return;; - esac - done + phy="$(mac80211_path_to_phy "$devpath")" + [ -n "$phy" ] && return } local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')" @@ -91,16 +90,8 @@ detect_mac80211() { [ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode" - if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then - path="$(readlink -f /sys/class/ieee80211/${dev}/device)" - else - path="" - fi + path="$(mac80211_phy_to_path "$dev")" if [ -n "$path" ]; then - path="${path##/sys/devices/}" - case "$path" in - platform*/pci*) path="${path##platform/}";; - esac dev_id="set wireless.radio${devidx}.path='$path'" else dev_id="set wireless.radio${devidx}.macaddr=$(cat /sys/class/ieee80211/${dev}/macaddress)" |