add a simple /sbin/wifi script with support for the new broadcom driver (incomplete...
[openwrt.git] / package / base-files / default / sbin / wifi
1 #!/bin/sh
2 . /etc/functions.sh
3
4 config_get_bool() {
5 local _tmp
6 config_get "$1" "$2" "$3"
7 eval "_tmp=\$$1"
8 case "$_tmp" in
9 1|on|enabled) eval "$1=1";;
10 0|off|disabled) eval "$1=0";;
11 *) eval "$1=${4:-0}";;
12 esac
13 }
14
15 config_cb() {
16 config_get TYPE "$CONFIG_SECTION" TYPE
17 case "$TYPE" in
18 wifi-device)
19 append DEVICES "$CONFIG_SECTION"
20 ;;
21 wifi-iface)
22 config_get device "$CONFIG_SECTION" device
23 config_get vifs "$device" vifs
24 append vifs "$CONFIG_SECTION"
25 config_set "$device" vifs "$vifs"
26 ;;
27 esac
28 }
29
30 config_load wireless
31
32 [ -d /lib/wifi -a -n "$(ls /lib/wifi/*.sh 2>&-)" ] && {
33 for script in /lib/wifi/*.sh; do
34 . $script
35 done
36 }
37
38 for device in $DEVICES; do (
39 config_get type "$device" type
40 eval "type setup_$type 2>&- >&-" && {
41 eval "scan_$type '$device'"
42 eval "setup_$type '$device'" && {
43 # TODO: set up network settings
44 /bin/true
45 } || echo "$device($type): Setup failed" || true
46 } || echo "$device($type): Interface type not supported"
47 ); done
This page took 0.049413 seconds and 5 git commands to generate.