This avoids inconsistencies from having multiple implementations do the same thing
Signed-off-by: Felix Fietkau <nbd@nbd.name>
define KernelPackage/cfg80211/install
$(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
$(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
- $(INSTALL_DATA) ./files/lib/netifd/mac80211.sh $(1)/lib/netifd
$(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
$(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
$(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect
+++ /dev/null
-mac80211_phy_to_path() {
- local phy="$1"
-
- [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${phy} ] || return
-
- local path="$(readlink -f /sys/class/ieee80211/${phy}/device)"
- [ -n "$path" ] || return
-
- path="${path##/sys/devices/}"
- case "$path" in
- platform*/pci*) path="${path##platform/}";;
- esac
-
- local p
- local seq=""
- for p in $(ls /sys/class/ieee80211/$phy/device/ieee80211); do
- [ "$p" = "$phy" ] && {
- echo "$path${seq:++$seq}"
- break
- }
-
- seq=$((${seq:-0} + 1))
- done
-}
-
-mac80211_path_to_phy() {
- local path="$1"
-
- local p
- for p in $(ls /sys/class/ieee80211); do
- local cur="$(mac80211_phy_to_path "$p")"
- case "$cur" in
- *$path) echo "$p"; return;;
- esac
- done
-}
#!/bin/sh
. /lib/netifd/netifd-wireless.sh
. /lib/netifd/hostapd.sh
-. /lib/netifd/mac80211.sh
init_wireless_driver "$@"
find_phy() {
[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
[ -n "$path" ] && {
- phy="$(mac80211_path_to_phy "$path")"
+ phy="$(iwinfo nl80211 phyname "path=$path")"
[ -n "$phy" ] && return 0
}
[ -n "$macaddr" ] && {
#!/bin/sh
-. /lib/netifd/mac80211.sh
append DRIVERS "mac80211"
local devpath
config_get devpath "$device" path
[ -n "$devpath" ] && {
- phy="$(mac80211_path_to_phy "$devpath")"
+ phy="$(iwinfo nl80211 phyname "path=$devpath")"
[ -n "$phy" ] && return
}
get_band_defaults "$dev"
- path="$(mac80211_phy_to_path "$dev")"
+ path="$(iwinfo nl80211 path "$dev")"
if [ -n "$path" ]; then
dev_id="set wireless.radio${devidx}.path='$path'"
else