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 $(ls /sys/class/ieee80211 2>/dev/null); do
23 [ "$macaddr" = "$(cat /sys/class/ieee80211/${_phy}/macaddress)" ] || continue
35 config_get phy "$device" phy
37 [ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || {
38 echo "PHY for wifi device $1 not found"
41 config_set "$device" phy "$phy"
43 config_get macaddr "$device" macaddr
44 [ -z "$macaddr" ] && {
45 config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)"
51 check_mac80211_device() {
52 config_get phy "$1" phy
54 find_mac80211_phy "$1" >/dev/null || return 0
55 config_get phy "$1" phy
57 [ "$phy" = "$dev" ] && found=1
64 config_get type "radio$devidx" type
65 [ -n "$type" ] || break
66 devidx=$(($devidx + 1))
68 for dev in $(ls /sys/class/ieee80211); do
70 config_foreach check_mac80211_device wifi-device
71 [ "$found" -gt 0 ] && continue
78 iw phy "$dev" info | grep -q 'Capabilities:' && htmode=HT20
79 iw phy "$dev" info | grep -q '2412 MHz' || { mode_band="a"; channel="36"; }
81 vht_cap=$(iw phy "$dev" info | grep -c 'VHT Capabilities')
82 [ "$vht_cap" -gt 0 ] && {
88 [ -n $htmode ] && append ht_capab " option htmode $htmode" "$N"
90 if [ -x /usr/bin/readlink ]; then
91 path="$(readlink -f /sys/class/ieee80211/${dev}/device)"
92 path="${path##/sys/devices/}"
93 dev_id=" option path '$path'"
95 dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
99 config wifi-device radio$devidx
101 option channel ${channel}
102 option hwmode 11${mode_band}
105 # REMOVE THIS LINE TO ENABLE WIFI:
109 option device radio$devidx
113 option encryption none
116 devidx=$(($devidx + 1))