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
39 [ enable = "$1" ] && wifi_updown disable
"$2"
40 for device
in ${2:-$DEVICES}; do (
41 config_get disabled
"$device" disabled
42 [ 1 == "$disabled" ] && {
43 echo "'$device' is disabled"
46 config_get iftype
"$device" type
47 if eval "type ${1}_$iftype" 2>/dev
/null
>/dev
/null
; then
48 eval "scan_$iftype '$device'"
49 eval "${1}_$iftype '$device'" ||
echo "$device($iftype): ${1} failed"
51 echo "$device($iftype): Interface type not supported"
57 for driver
in ${2:-$DRIVERS}; do (
58 if eval "type detect_$driver" 2>/dev
/null
>/dev
/null
; then
59 eval "detect_$driver" ||
echo "$driver: Detect failed" >&2
61 echo "$driver: Hardware detection not supported" >&2
71 [ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev
/null
74 setup_interface
"$iface" "$config" "" "$vifmac"
80 uci_set_state wireless
"$cfg" up
1
81 uci_set_state wireless
"$cfg" ifname
"$ifname"
88 [ -f "/var/run/wifi-${cfg}.pid" ] &&
89 kill "$(cat "/var
/run
/wifi-
${cfg}.pid
")"
90 uci_revert_state wireless
"$cfg"
91 config_get vifs
"$cfg" vifs
93 uci_revert_state wireless
"$vif"
100 config_get TYPE
"$CONFIG_SECTION" TYPE
103 append DEVICES
"$CONFIG_SECTION"
106 config_get device
"$CONFIG_SECTION" device
107 config_get vifs
"$device" vifs
108 append vifs
"$CONFIG_SECTION"
109 config_set
"$device" vifs
"$vifs"
113 config_load
"${cfgfile:-wireless}"
122 down
) wifi_updown
"disable" "$2";;
123 detect
) wifi_detect
"$2";;
124 *) wifi_updown
"enable" "$2";;