2 append DRIVERS "mac80211"
6 [ -d /sys/class/ieee80211/$phy ] && return
10 config_get devpath "$device" path
11 [ -n "$devpath" ] && {
12 for _phy in /sys/devices/$devpath/ieee80211/phy*; do
20 local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
21 [ -n "$macaddr" ] && {
22 for _phy in /sys/class/ieee80211/*; do
23 [ -e "$_phy" ] || continue
25 [ "$macaddr" = "$(cat ${_phy}/macaddress)" ] || continue
37 config_get phy "$device" phy
39 [ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || {
40 echo "PHY for wifi device $1 not found"
43 config_set "$device" phy "$phy"
45 config_get macaddr "$device" macaddr
46 [ -z "$macaddr" ] && {
47 config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)"
53 check_mac80211_device() {
54 config_get phy "$1" phy
56 find_mac80211_phy "$1" >/dev/null || return 0
57 config_get phy "$1" phy
59 [ "$phy" = "$dev" ] && found=1
66 config_get type "radio$devidx" type
67 [ -n "$type" ] || break
68 devidx=$(($devidx + 1))
71 for _dev in /sys/class/ieee80211/*; do
72 [ -e "$_dev" ] || continue
77 config_foreach check_mac80211_device wifi-device
78 [ "$found" -gt 0 ] && continue
85 iw phy "$dev" info | grep -q 'Capabilities:' && htmode=HT20
86 iw phy "$dev" info | grep -q '2412 MHz' || { mode_band="a"; channel="36"; }
88 vht_cap=$(iw phy "$dev" info | grep -c 'VHT Capabilities')
89 5ghz_cap=$(iw phy "$dev" info | grep -c "Band 2")
90 [ "$vht_cap" -gt 0 -a "$5ghz_cap" -gt 0 ] && {
96 [ -n $htmode ] && append ht_capab " option htmode $htmode" "$N"
98 if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then
99 path="$(readlink -f /sys/class/ieee80211/${dev}/device)"
103 if [ -n "$path" ]; then
104 path="${path##/sys/devices/}"
105 dev_id=" option path '$path'"
107 dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
111 config wifi-device radio$devidx
113 option channel ${channel}
114 option hwmode 11${mode_band}
117 # REMOVE THIS LINE TO ENABLE WIFI:
121 option device radio$devidx
125 option encryption none
128 devidx=$(($devidx + 1))