Hi all,

I have a router with multiple wireless networks, and wanted wifitoggle to
disable only one wireless network, instead of disabling the radio
completely.
my solution only changes 2 lines, and adds a third one on
/etc/hotplug.d/button/50-wifitoggle.

the default behaviour stays the same as before (disable radio device).
To disable ssids, /etc/config/wifitoggle needs to have two new options
explicitly, 'wifi_type' and 'device'.

It also requires that the "config wifi-iface" entries on
/etc/config/wireless have a name.

example:
/etc/config/wireless
config 'wifi-device' 'radio0'
 option 'type' 'mac80211'
option 'macaddr' 'f8:d1:11:24:ae:10'
 option 'hwmode' '11ng'
list 'ht_capab' 'SHORT-GI-40'
 list 'ht_capab' 'DSSS_CCK-40'
option 'country' 'PT'
 option 'channel' '6'
option 'htmode' 'HT40-'
 option 'disabled' '0'

config 'wifi-iface' *'guestsnetwork'*
option 'device' 'radio0'
 option 'network' 'lan'
option 'mode' 'ap'
 option 'ssid' 'guests'
option 'encryption' 'psk2'
 option 'key' 'somepassword'
option 'disabled' '0'

config 'wifi-iface' 'homenetwork'
option 'device' 'radio0'
 option 'network' 'lan'
option 'mode' 'ap'
 option 'ssid' 'home'
option 'encryption' 'psk2'
 option 'key' 'someotherpassword'
option 'disabled' '0'

/etc/config/wifitoggle
config 'wifitoggle'
        option 'led_enable_trigger' 'timer'
        option 'button' 'wps'
        option 'persistent' '1'
        option 'led_sysfs' 'tp-link:green:qss'
        option 'led_enable_delayon' '2000'
        option 'led_disable_default' '1'
        option 'led_enable_delayoff' '3000'
        option 'timer' '0'
        *option 'wifi_type' 'iface'*
 *option 'device' 'guestsnetwork'*

Keep up the good work,

Signed-off-by: Bruno Silva <[email protected]>

patch:
--- files/wifitoggle.hotplug.ori        2012-02-11 15:21:42.637259964 +0000
+++ files/wifitoggle.hotplug    2012-02-11 15:25:05.168970488 +0000
@@ -37,7 +37,7 @@

         config_load wireless
        mode="$(uci get wifitoggle.mode)"
-        config_foreach save_wireless wifi-device
+        config_foreach save_wireless wifi-$wifi_type
         wifi
 }

@@ -141,6 +141,7 @@
        config_get_bool led_disable_default $1 led_disable_default "0"
        config_get led_disable_delayon $1 led_disable_delayon
        config_get led_disable_delayoff $1 led_disable_delayoff
+       config_get wifi_type $1 wifi_type "device"

         [ "$ACTION" = "$action" -a "$BUTTON" = "$button" ] && {

@@ -149,7 +150,7 @@
                if [ "$device" = "all" ]
                then
                        config_load wireless
-                       config_foreach load_wireless wifi-device
+                       config_foreach load_wireless wifi-$wifi_type
                else
                        disabled="$(uci get wireless."$device".disabled)"
                fi
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to