2 append DRIVERS
"mac80211"
6 [ -d /sys
/class
/ieee80211
/$phy ] && return
10 config_get devpath
"$device" path
11 [ -n "$devpath" ] && {
12 for phy
in $
(ls /sys
/class
/ieee80211
2>/dev
/null
); do
13 case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
19 local macaddr
="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
20 [ -n "$macaddr" ] && {
21 for _phy
in /sys
/class
/ieee80211
/*; do
22 [ -e "$_phy" ] ||
continue
24 [ "$macaddr" = "$(cat ${_phy}/macaddress)" ] ||
continue
36 config_get phy
"$device" phy
38 [ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] ||
{
39 echo "PHY for wifi device $1 not found"
42 config_set
"$device" phy
"$phy"
44 config_get macaddr
"$device" macaddr
45 [ -z "$macaddr" ] && {
46 config_set
"$device" macaddr
"$(cat /sys/class/ieee80211/${phy}/macaddress)"
52 check_mac80211_device
() {
53 config_get phy
"$1" phy
55 find_mac80211_phy
"$1" >/dev
/null ||
return 0
56 config_get phy
"$1" phy
58 [ "$phy" = "$dev" ] && found
=1
65 config_get
type "radio$devidx" type
66 [ -n "$type" ] ||
break
67 devidx
=$
(($devidx + 1))
70 for _dev
in /sys
/class
/ieee80211
/*; do
71 [ -e "$_dev" ] ||
continue
76 config_foreach check_mac80211_device wifi-device
77 [ "$found" -gt 0 ] && continue
84 iw phy
"$dev" info |
grep -q 'Capabilities:' && htmode
=HT20
85 iw phy
"$dev" info |
grep -q '2412 MHz' ||
{ mode_band
="a"; channel
="36"; }
87 vht_cap
=$
(iw phy
"$dev" info |
grep -c 'VHT Capabilities')
88 cap_5ghz
=$
(iw phy
"$dev" info |
grep -c "Band 2")
89 [ "$vht_cap" -gt 0 -a "$cap_5ghz" -gt 0 ] && {
95 [ -n $htmode ] && append ht_capab
" option htmode $htmode" "$N"
97 if [ -x /usr
/bin
/readlink
-a -h /sys
/class
/ieee80211
/${dev} ]; then
98 path
="$(readlink -f /sys/class/ieee80211/${dev}/device)"
102 if [ -n "$path" ]; then
103 path
="${path##/sys/devices/}"
105 platform
*/pci
*) path
="${path##platform/}";;
107 dev_id
=" option path '$path'"
109 dev_id
=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
113 config wifi-device radio$devidx
115 option channel ${channel}
116 option hwmode 11${mode_band}
119 # REMOVE THIS LINE TO ENABLE WIFI:
123 option device radio$devidx
127 option encryption none
130 devidx
=$
(($devidx + 1))