Jo-Philipp Wich <j...@mein.io> wrote: > Hi, > > > respectfully, the behaviour of the "wifi" command is one of the most > > obtuse parts of openwrt's tooling. It does "something" with no > > command output, and responds ~instantly. This is expected > > behaviour for very few people. even "wifi asdfasdfa" returns > > ~instantly, with no warning that it is an unknown command. Does the > > command perhaps not take arguments? What would they be? > > The (implicit) default command could be explicitly spelled out > as "wifi apply" or similar, mentioned in the usage and called > when no argument is provided. > > Is that what you were thinking?
Personally I'd like to see the "apply" (or any other name) added, and the implicit action dropped. Or at the very least, the implicit action only taken when there are no arguments. At present, you get the implicit action with no args, and with any arg that doesn't match some other args. I'd suggest it is more reasonable that unknown args are not treated as some default, which is what the original patch suggested. It was definitely broken however in that the implicit step was no longer available. Something like this say.... This lets "wifi" still do the same as before. This makes "wifi adsfads" print usage arguments This makes "wifi enable interfacename" do the same as "wifi interfacename" did before, if anyone knew about that. The usage text could/should be expanded still, but hoenstly, I don't know the difference between them all. What's the difference between config and detect? should detect be listed in the usage? what's reload_legacy? when would I want it? Should it be listed in the usage? What's the difference between enable and reload? Why is there down but no up? (it's like "enable" but not quite?) Sincerely, Karl Palsson diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi index 83befc0d6f..cbe7e950bd 100755 --- a/package/base-files/files/sbin/wifi +++ b/package/base-files/files/sbin/wifi @@ -6,7 +6,7 @@ usage() { cat <<EOF -Usage: $0 [config|down|reload|status] +Usage: $0 [config|down|enable|reload|status] enables (default), disables or configures devices not yet configured. EOF exit 1 @@ -233,6 +233,13 @@ DRIVERS= include /lib/wifi scan_wifi +[ $# -lt 2 ] && { + echo "Implicitly applying config" + ubus call network reload + wifi_updown "enable" + exit 0 +} + case "$1" in down) wifi_updown "disable" "$2";; detect) wifi_detect_notice ;; @@ -241,5 +248,6 @@ case "$1" in reload) wifi_reload "$2";; reload_legacy) wifi_reload_legacy "$2";; --help|help) usage;; - *) ubus call network reload; wifi_updown "enable" "$2";; + enable) ubus call network reload; wifi_updown "enable" "$2";; + *) usage; exit 1;; esac
signature.html
Description: OpenPGP Digital Signature
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel