Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-07 Thread Karl Palsson

Jo-Philipp Wich  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 <

signature.html
Description: OpenPGP Digital Signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-07 Thread Jo-Philipp Wich
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?

~ Jo



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-07 Thread Kevin Darbyshire-Bryant


> On 6 Aug 2018, at 15:49, Karl Palsson  wrote:
> 
> Signed PGP part
> 
> John Crispin  wrote:
>> 
>> 
>> On 03/08/18 18:18, Thibaut VARÈNE wrote:
>>> Avoid having /sbin/wifi silently ignore unknown keywords and execute
>>> "enable"; instead display the help message and exit with an error.
>>> 
>>> Signed-off-by: Thibaut VARÈNE 
>>> ---
>>>  package/base-files/files/sbin/wifi | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/package/base-files/files/sbin/wifi 
>>> b/package/base-files/files/sbin/wifi
>>> index 83befc0d6f..09e483ec55 100755
>>> --- a/package/base-files/files/sbin/wifi
>>> +++ b/package/base-files/files/sbin/wifi
>>> @@ -241,5 +241,5 @@ case "$1" in
>>> reload) wifi_reload "$2";;
>>> reload_legacy) wifi_reload_legacy "$2";;
>>> --help|help) usage;;
>>> -   *) ubus call network reload; wifi_updown "enable" "$2";;
>>> +   *) usage; exit 1;;
>>>  esac
>> 
>> NAK, this changes expected behaviour. i regularly call "wifi"
>> to resync my config with runstate.
>> John
> 
> 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?
> 
> Do we _reallly_ have to keep it's behaviour this way?
> 
> What this patch _is_ missing, is a new command to replace the old
> "anything but the other commands".
> 
> ie, the one that does "ubus call network reload; wifi_updown
> "enable" "$2""
> 
> Sincerely,
> Karl Palsson
> 

+1
Nicely written and argued.  ‘wifi’ is incredibly obtuse and unfriendly.  I hate 
running it.  Does ‘magic’ no idea what, it doesn’t say.



Cheers,

Kevin D-B

012C ACB2 28C6 C53E 9775  9123 B3A2 389B 9DE2 334A



signature.asc
Description: Message signed with OpenPGP
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-06 Thread Karl Palsson

John Crispin  wrote:
> 
> 
> On 03/08/18 18:18, Thibaut VARÈNE wrote:
> > Avoid having /sbin/wifi silently ignore unknown keywords and execute
> > "enable"; instead display the help message and exit with an error.
> >
> > Signed-off-by: Thibaut VARÈNE 
> > ---
> >   package/base-files/files/sbin/wifi | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/package/base-files/files/sbin/wifi 
> > b/package/base-files/files/sbin/wifi
> > index 83befc0d6f..09e483ec55 100755
> > --- a/package/base-files/files/sbin/wifi
> > +++ b/package/base-files/files/sbin/wifi
> > @@ -241,5 +241,5 @@ case "$1" in
> > reload) wifi_reload "$2";;
> > reload_legacy) wifi_reload_legacy "$2";;
> > --help|help) usage;;
> > -   *) ubus call network reload; wifi_updown "enable" "$2";;
> > +   *) usage; exit 1;;
> >   esac
> 
> NAK, this changes expected behaviour. i regularly call "wifi"
> to resync my config with runstate.
>      John

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?  

Do we _reallly_ have to keep it's behaviour this way? 

What this patch _is_ missing, is a new command to replace the old
"anything but the other commands".

ie, the one that does "ubus call network reload; wifi_updown
"enable" "$2""

Sincerely,
Karl Palsson

signature.html
Description: OpenPGP Digital Signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-06 Thread Alberto Bursi



On 06/08/2018 07:20, John Crispin wrote:



On 03/08/18 18:18, Thibaut VARÈNE wrote:

Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Signed-off-by: Thibaut VARÈNE 
---
  package/base-files/files/sbin/wifi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi

index 83befc0d6f..09e483ec55 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,5 @@ case "$1" in
  reload) wifi_reload "$2";;
  reload_legacy) wifi_reload_legacy "$2";;
  --help|help) usage;;
-    *) ubus call network reload; wifi_updown "enable" "$2";;
+    *) usage; exit 1;;
  esac


NAK, this changes expected behaviour. i regularly call "wifi" to 
resync my config with runstate.

    John



There are also scripts in packages (like wifitoggle) that expect to call 
"wifi" without arguments to do a status refresh.


Please make it print an error only if "wifi" is actually called with an 
unknown (=wrong) argument, calling "wifi" with no argument is ok.


-Alberto

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-06 Thread Thibaut VARÈNE
Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Also preserve the implicit assumption that runing /sbin/wifi without
argument performs network reload and "enable".

Signed-off-by: Thibaut VARÈNE 
---
 package/base-files/files/sbin/wifi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi
index 83befc0d6f..13c91c2919 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,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";;
+   '') ubus call network reload; wifi_updown "enable";;
+   *) usage; exit 1;;
 esac
-- 
2.13.6 (Apple Git-96)


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-05 Thread John Crispin



On 03/08/18 18:18, Thibaut VARÈNE wrote:

Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Signed-off-by: Thibaut VARÈNE 
---
  package/base-files/files/sbin/wifi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi
index 83befc0d6f..09e483ec55 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,5 @@ case "$1" in
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
-   *) ubus call network reload; wifi_updown "enable" "$2";;
+   *) usage; exit 1;;
  esac


NAK, this changes expected behaviour. i regularly call "wifi" to resync 
my config with runstate.

    John

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-03 Thread Thibaut VARÈNE
Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Signed-off-by: Thibaut VARÈNE 
---
 package/base-files/files/sbin/wifi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi
index 83befc0d6f..09e483ec55 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,5 @@ case "$1" in
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
-   *) ubus call network reload; wifi_updown "enable" "$2";;
+   *) usage; exit 1;;
 esac
-- 
2.13.6 (Apple Git-96)


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel