-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mac80211: add support for multiple wiphys behind a single device
backport from openwrt(8b15e7f661b4263a7b9fb6a410a5f58263b72caa), original message: 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 <[email protected]>
- Loading branch information
Showing
4 changed files
with
49 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters