projects
/
librecmc
/
librecmc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
93b4d13
)
mac80211: store the device path as identifier in the config instead of the mac addres...
author
Felix Fietkau
<nbd@openwrt.org>
Thu, 18 Oct 2012 00:09:55 +0000
(
00:09
+0000)
committer
Felix Fietkau
<nbd@openwrt.org>
Thu, 18 Oct 2012 00:09:55 +0000
(
00:09
+0000)
SVN-Revision: 33834
package/mac80211/files/lib/wifi/mac80211.sh
patch
|
blob
|
history
diff --git
a/package/mac80211/files/lib/wifi/mac80211.sh
b/package/mac80211/files/lib/wifi/mac80211.sh
index 1b0bea70ed78109f38bfc0c6e0e9f0980e61984b..d834afea3b1900f22ae32cf69391cbcc57fd3329 100644
(file)
--- a/
package/mac80211/files/lib/wifi/mac80211.sh
+++ b/
package/mac80211/files/lib/wifi/mac80211.sh
@@
-184,26
+184,46
@@
mac80211_start_vif() {
set_wifi_up "$vif" "$ifname"
}
set_wifi_up "$vif" "$ifname"
}
-find_mac80211_phy() {
- local device="$1"
+lookup_phy() {
+ [ -n "$phy" ] && {
+ [ -d /sys/class/ieee80211/phy ] && return
+ }
+
+ local devpath
+ config_get devpath "$device" path
+ [ -n "$devpath" -a -d "/sys/devices/$devpath/ieee80211" ] && {
+ phy="$(ls /sys/devices/$devpath/ieee80211 | grep -m 1 phy)"
+ [ -n "$phy" ] && return
+ }
local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
- config_get phy "$device" phy
- [ -z "$phy" -a -n "$macaddr" ] && {
- for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
- [ "$macaddr" = "$(cat /sys/class/ieee80211/${phy}/macaddress)" ] || continue
- config_set "$device" phy "$phy"
- break
+ [ -n "$macaddr" ] && {
+ for _phy in $(ls /sys/class/ieee80211 2>/dev/null); do
+ [ "$macaddr" = "$(cat /sys/class/ieee80211/${_phy}/macaddress)" ] || continue
+ phy="$_phy"
+ return
done
done
- config_get phy "$device" phy
}
}
+ phy=
+ return
+}
+
+find_mac80211_phy() {
+ local device="$1"
+
+ config_get phy "$device" phy
+ lookup_phy
[ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || {
echo "PHY for wifi device $1 not found"
return 1
}
[ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || {
echo "PHY for wifi device $1 not found"
return 1
}
+ config_set "$device" phy "$phy"
+
+ config_get macaddr "$device" macaddr
[ -z "$macaddr" ] && {
config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)"
}
[ -z "$macaddr" ] && {
config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)"
}
+
return 0
}
return 0
}
@@
-575,12
+595,20
@@
detect_mac80211() {
}
iw phy "$dev" info | grep -q '2412 MHz' || { mode_band="a"; channel="36"; }
}
iw phy "$dev" info | grep -q '2412 MHz' || { mode_band="a"; channel="36"; }
+ if [ -x /usr/bin/readlink ]; then
+ path="$(readlink -f /sys/class/ieee80211/${dev}/device)"
+ path="${path##/sys/devices/}"
+ dev_id=" option path '$path'"
+ else
+ dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
+ fi
+
cat <<EOF
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
cat <<EOF
config wifi-device radio$devidx
option type mac80211
option channel ${channel}
- option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)
option hwmode 11${mode_11n}${mode_band}
option hwmode 11${mode_11n}${mode_band}
+$dev_id
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1
$ht_capab
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1