RFC: Change "Wireless" Switch Behavior - ath79 (Archer C7 v2)

With the change to ath79 "requiring" an edit of at least wireless config, it seems like a potentially "not too bad time" to look at how the Wireless On/Off switch is handled in 19.??

At least for me, the current behavior is annoying for a couple reasons:

  • The switch is backwards compared to the label
  • It doesn't "work" to switch it when the device isn't running
  • The changes are written through UCI, meaning that
    • You can't get back to what you had by flipping it if you had one or more radios off (it enables everything)
    • It rewrites /etc/config/wireless which
      • Can cause "false diffs" with a VCS
      • Loses any comments in your file

I've been hesitant to make a change to this, as it means going to the physical device to flip the switch to the position that agrees with the label (yours is probably at "Off" right now).

Are there any strong objections to working on a patch to "fix" this so that:

  • "On" is on for radios enabled in /etc/config/wireless
  • "Off" disables the radios, without modifying the config
  • The switch is position sensitive, so it can be switched while the system is not running and impact the system at boot

Older threads on the topic

I am occasionally seeing problems which may be caused by what you described. Sometimes, when switching to on, wireless starts and stops a couple of seconds thereafter. I had to turn it off/on in LuCI to get it working (can't remember the correct sequence, tried several).

In short, I would also prefer if the config file is modified by only one action which should be the "software switch".

Maybe related, I had the 5Ghz disabled (disconnected from the physical interface in LuCI) and recently wanted to re-enable it. It does not work. The LED on the device indicates it is running, but it is "not connected to any physical device". Maybe your proposed patch will solve this, too?