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 for device in ${2:-$DEVICES}; do (
40 config_get iftype "$device" type
41 if eval "type enable_$iftype" 2>/dev/null >/dev/null; then
42 eval "scan_$iftype '$device'"
43 eval "enable_$iftype '$device'" || echo "$device($iftype): Setup failed"
45 echo "$device($iftype): Interface type not supported"
51 for device in ${2:-$DEVICES}; do (
52 config_get iftype "$device" type
53 if eval "type disable_$iftype" 2>/dev/null >/dev/null; then
54 eval "scan_$iftype '$device'"
55 eval "disable_$iftype '$device'" || echo "$device($iftype): Disable failed"
57 echo "$device($iftype): Interface type not supported"
63 for driver in ${2:-$DRIVERS}; do (
64 if eval "type detect_$driver" 2>/dev/null >/dev/null; then
65 eval "detect_$driver" || echo "$driver: Detect failed" >&2
67 echo "$driver: Hardware detection not supported" >&2
78 setup_interface "$1" "$2"
83 config_get "$1" "$2" "$3"
86 1|on|enabled) eval "$1=1";;
87 0|off|disabled) eval "$1=0";;
88 *) eval "$1=${4:-0}";;
93 config_get TYPE "$CONFIG_SECTION" TYPE
96 append DEVICES "$CONFIG_SECTION"
99 config_get device "$CONFIG_SECTION" device
100 config_get vifs "$device" vifs
101 append vifs "$CONFIG_SECTION"
102 config_set "$device" vifs "$vifs"
113 down) wifi_down "$2";;
114 detect) wifi_detect "$2";;