https://dev.openwrt.org/ticket/5256 is quite different.

To toggle script they used:

| elif [ -z "$(cat /var/state/wireless)" ]; then
|  # empty state file signals deactivated wireless
|  $(logcmd) "WLAN is OFF. Switch ON and set LEDS accordingly."
|  wifi up
|  set_leds ON
| else
|  $(logcmd) "WLAN is ON. Switch OFF and set LEDS accordingly."
|  wifi down
|  set_leds OFF
| fi

I checked the trunk version of "wifi" and calling "wifi up" or just
"wifi" is the same. This means that this script can't enable
connection that have the wifi disabled at the config file. Also that
is impossible to use a default off on power up.

I use the following script:

| load_wireless() {
|         uci set "wireless.${1}.disabled=$disabled"
| }
|
| setwifi() {
|         setled
|
|         config_load wireless
|         config_foreach load_wireless wifi-device
|         wifi
| }

So it iterates over every wifi-device at /etc/config/wireless and
disable/enable it.
So I think it's also generic for whatever you want.


There is still a little issue that I don't know if it's real an issue.
And it is about checking the current toggle state. I use:

| if [ "$(uci get wireless.wifi0.disabled)" = "1" ]

So the question is: is possible to have more than on wifi-device?
If so all solutions that I see have...more issues.

--
\ Nuno Gonçalves
/
\ Bugs? Features!
/
\ nuno...@gmail.com
/ PORTUGAL
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to