2 append DRIVERS
"mac80211"
6 [ -d /sys
/class
/ieee80211
/$phy ] && return
10 config_get devpath
"$device" path
11 [ -n "$devpath" -a -d "/sys/devices/$devpath/ieee80211" ] && {
12 phy
="$(ls /sys/devices/$devpath/ieee80211 | grep -m 1 phy)"
13 [ -n "$phy" ] && return
16 local macaddr
="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
17 [ -n "$macaddr" ] && {
18 for _phy
in $
(ls /sys
/class
/ieee80211
2>/dev
/null
); do
19 [ "$macaddr" = "$(cat /sys/class/ieee80211/${_phy}/macaddress)" ] ||
continue
31 config_get phy
"$device" phy
33 [ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] ||
{
34 echo "PHY for wifi device $1 not found"
37 config_set
"$device" phy
"$phy"
39 config_get macaddr
"$device" macaddr
40 [ -z "$macaddr" ] && {
41 config_set
"$device" macaddr
"$(cat /sys/class/ieee80211/${phy}/macaddress)"
47 check_mac80211_device
() {
48 config_get phy
"$1" phy
50 find_mac80211_phy
"$1" >/dev
/null ||
return 0
51 config_get phy
"$1" phy
53 [ "$phy" = "$dev" ] && found
=1
60 config_get
type "radio$devidx" type
61 [ -n "$type" ] ||
break
62 devidx
=$
(($devidx + 1))
64 for dev
in $
(ls /sys
/class
/ieee80211
); do
66 config_foreach check_mac80211_device wifi-device
67 [ "$found" -gt 0 ] && continue
73 for cap
in $
(iw phy
"$dev" info |
grep 'Capabilities:' | cut
-d: -f2); do
74 ht_cap
="$(($ht_cap | $cap))"
77 [ "$ht_cap" -gt 0 ] && {
79 append ht_capab
" option htmode HT20" "$N"
82 [ "$(($ht_cap & 1))" -eq 1 ] && append ht_capab
"$list LDPC" "$N"
83 [ "$(($ht_cap & 16))" -eq 16 ] && append ht_capab
"$list GF" "$N"
84 [ "$(($ht_cap & 32))" -eq 32 ] && append ht_capab
"$list SHORT-GI-20" "$N"
85 [ "$(($ht_cap & 64))" -eq 64 ] && append ht_capab
"$list SHORT-GI-40" "$N"
86 [ "$(($ht_cap & 128))" -eq 128 ] && append ht_capab
"$list TX-STBC" "$N"
87 [ "$(($ht_cap & 768))" -eq 256 ] && append ht_capab
"$list RX-STBC1" "$N"
88 [ "$(($ht_cap & 768))" -eq 512 ] && append ht_capab
"$list RX-STBC12" "$N"
89 [ "$(($ht_cap & 768))" -eq 768 ] && append ht_capab
"$list RX-STBC123" "$N"
90 [ "$(($ht_cap & 4096))" -eq 4096 ] && append ht_capab
"$list DSSS_CCK-40" "$N"
92 iw phy
"$dev" info |
grep -q '2412 MHz' ||
{ mode_band
="a"; channel
="36"; }
94 if [ -x /usr
/bin
/readlink
]; then
95 path
="$(readlink -f /sys/class/ieee80211/${dev}/device)"
96 path
="${path##/sys/devices/}"
97 dev_id
=" option path '$path'"
99 dev_id
=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
103 config wifi-device radio$devidx
105 option channel ${channel}
106 option hwmode 11${mode_11n}${mode_band}
109 # REMOVE THIS LINE TO ENABLE WIFI:
113 option device radio$devidx
117 option encryption none
120 devidx
=$
(($devidx + 1))