package/base-files: add support for the switch LED trigger
[openwrt.git] / package / base-files / files / sbin / wifi
index bee6c28..5cbf50b 100755 (executable)
@@ -3,6 +3,14 @@
 
 . /etc/functions.sh
 
+usage() {
+       cat <<EOF
+Usage: $0 [down|detect]
+enables (default), disables or detects a wifi configuration.
+EOF
+       exit 1
+}
+
 find_net_config() {(
        local vif="$1"
        local cfg
@@ -32,6 +40,7 @@ bridge_interface() {(
 
        config_get iftype "$cfg" type
        [ "$iftype" = bridge ] && config_get "$cfg" ifname
+       prepare_interface_bridge "$cfg"
 )}
 
 prepare_key_wep() {
@@ -120,9 +129,11 @@ start_net() {(
        local vifmac="$3"
 
        [ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev/null
-       include /lib/network
-       scan_interfaces
-       setup_interface "$iface" "$config" "" "$vifmac"
+       [ -z "$config" ] || {
+               include /lib/network
+               scan_interfaces
+               setup_interface "$iface" "$config" "" "$vifmac"
+       }
 )}
 
 set_wifi_up() {
@@ -183,5 +194,6 @@ scan_wifi
 case "$1" in
        down) wifi_updown "disable" "$2";;
        detect) wifi_detect "$2";;
+       --help|help) usage;;
        *) wifi_updown "enable" "$2";;
 esac
This page took 0.022517 seconds and 4 git commands to generate.