2 # Copyright (C) 2006 OpenWrt.org
11 config_get cfg "$vif" network
17 config_get ifname "$vif" ifname
19 cfg="$(find_config "$ifname")"
21 [ -z "$cfg" ] && return 0
28 [ -z "$cfg" ] && return 0
33 config_get iftype "$cfg" type
34 [ "$iftype" = bridge ] && config_get "$cfg" ifname
40 local hwmode hwmode_11n
42 config_get channel "$device" channel
43 config_get hwmode "$device" hwmode
50 hwmode_11n="${hwmode##11n}"
53 default) hwmode_11n="$default"
55 config_set "$device" hwmode_11n "$hwmode_11n"
59 if [ "${channel:-0}" -gt 0 ]; then
60 if [ "${channel:-0}" -gt 14 ]; then
70 config_set "$device" hwmode "$hwmode"
74 [ enable = "$1" ] && wifi_updown disable "$2"
75 for device in ${2:-$DEVICES}; do (
76 config_get disabled "$device" disabled
77 [ 1 == "$disabled" ] && {
78 echo "'$device' is disabled"
81 config_get iftype "$device" type
82 if eval "type ${1}_$iftype" 2>/dev/null >/dev/null; then
83 eval "scan_$iftype '$device'"
84 eval "${1}_$iftype '$device'" || echo "$device($iftype): ${1} failed"
86 echo "$device($iftype): Interface type not supported"
92 for driver in ${2:-$DRIVERS}; do (
93 if eval "type detect_$driver" 2>/dev/null >/dev/null; then
94 eval "detect_$driver" || echo "$driver: Detect failed" >&2
96 echo "$driver: Hardware detection not supported" >&2
106 [ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev/null
109 setup_interface "$iface" "$config" "" "$vifmac"
115 uci_set_state wireless "$cfg" up 1
116 uci_set_state wireless "$cfg" ifname "$ifname"
121 local vifs vif vifstr
123 [ -f "/var/run/wifi-${cfg}.pid" ] &&
124 kill "$(cat "/var/run/wifi-${cfg}.pid")"
125 uci_revert_state wireless "$cfg"
126 config_get vifs "$cfg" vifs
128 uci_revert_state wireless "$vif"
135 config_get TYPE "$CONFIG_SECTION" TYPE
138 append DEVICES "$CONFIG_SECTION"
141 config_get device "$CONFIG_SECTION" device
142 config_get vifs "$device" vifs
143 append vifs "$CONFIG_SECTION"
144 config_set "$device" vifs "$vifs"
148 config_load "${cfgfile:-wireless}"
157 down) wifi_updown "disable" "$2";;
158 detect) wifi_detect "$2";;
159 *) wifi_updown "enable" "$2";;