usage() {
cat <<EOF
-Usage: $0 [down|detect|reload|status]
-enables (default), disables or detects a wifi configuration.
+Usage: $0 [config|up|down|reconf|reload|status]
+enables (default), disables or configures devices not yet configured.
EOF
exit 1
}
case "$hwmode" in
11bg) hwmode=bg;;
11a) hwmode=a;;
+ 11ad) hwmode=ad;;
11b) hwmode=b;;
11g) hwmode=g;;
11n*)
_wifi_updown() {
for device in ${2:-$DEVICES}; do (
config_get disabled "$device" disabled
- [ 1 == "$disabled" ] && {
+ [ "$disabled" = "1" ] && {
echo "'$device' is disabled"
set disable
}
[ enable = "$1" ] && {
_wifi_updown disable "$2"
ubus_wifi_cmd "$cmd" "$2"
+ ubus call network reload
scan_wifi
cmd=up
}
+ [ reconf = "$1" ] && {
+ ubus call network reload
+ scan_wifi
+ cmd=reconf
+ }
ubus_wifi_cmd "$cmd" "$2"
_wifi_updown "$@"
}
wifi_reload_legacy
}
-wifi_detect() {
- for driver in ${2:-$DRIVERS}; do (
+wifi_detect_notice() {
+ >&2 echo "WARNING: Wifi detect is deprecated. Use wifi config instead"
+ >&2 echo "For more information, see commit 5f8f8a366136a07df661e31decce2458357c167a"
+ exit 1
+}
+
+wifi_config() {
+ [ ! -f /etc/config/wireless ] && touch /etc/config/wireless
+
+ for driver in $DRIVERS; do (
if eval "type detect_$driver" 2>/dev/null >/dev/null; then
eval "detect_$driver" || echo "$driver: Detect failed" >&2
else
case "$1" in
down) wifi_updown "disable" "$2";;
- detect) wifi_detect "$2";;
+ detect) wifi_detect_notice ;;
+ config) wifi_config ;;
status) ubus_wifi_cmd "status" "$2";;
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
- *) ubus call network reload; wifi_updown "enable" "$2";;
+ reconf) wifi_updown "reconf" "$2";;
+ ''|up) wifi_updown "enable" "$2";;
+ *) usage; exit 1;;
esac