I have a Linksys WRT3200ACM with the primary partition being the most recent Linksys firmware and the latest OpenWRT on the alternate. Working good but I had an idea to make it better. In OpenWRT my radios(0/1) contain the main network and a disabled guest network to match the schema I'm trying to make. That leaves a button that was meant for WPS, but no thank you. I have a good feeling that it can be reprogrammed to toggle two WiFi networks on/off.
Any questions, comments or inspiring ideas are always welcomed.
From what I can tell, that command takes the entire WiFi on/offline, I'm trying to pinpoint two non-default networks on separate radios.
Radio0.network0 is a 5Ghz a/c for the primary network
Radio0.network1 is my guest network that I want to have toggled via hardware button
Radio1.network0 is a 2Ghz b/g/n for smart home devices
Radio1.network1 is also a guest network for older devices that I want toggled simultaneously
That is correct. At this time, all SSIDs and all radios get "reset" when there is a change, such as with wifi reload. There is some work afoot on being able to manage individual SSIDs without restarting the others on master, but I haven't kept up with it.
To manage a single SSID, you can use uci to set its disabled option to 1, uci commit, and then reload. If you name your wifi-iface sections, it may be easier to reference the "right" SSIDs.
OKOKOK!! Sooo, the wifi-iface can be renamed to a "user friendly" name? Is that the option on the Web console->Network->Wireless->Interface Configuration->Advanced->Interface Name? Then how do I reference it using uci?
X=$(uci get wireless.@wifi-iface[3].disabled)
Y=$(uci get wireless.@wifi-iface[4].disabled)
if [ ${BUTTON} = 'wps' ] && [ ${ACTION} = 'pressed' ] ; then
if [ $X = 1 ] || [ $Y = 1 ] ; then
logger Starting Guest Networks.....
uci set wireless.@wifi-iface[3].disabled=0
uci set wireless.@wifi-iface[4].disabled=0
uci commit wireless
sync
logger Guest Networks Started
else
logger Stopping Guest Networks.....
uci set wireless.@wifi-iface[3].disabled=1
uci set wireless.@wifi-iface[4].disabled=1
uci commit wireless
sync
logger Guest Networks Stopped
fi
fi
Anybody have experience with WPS LED both amber and white. I would like to have it amber while only one guest network is active and white when both are.
#> uci show system | grep '@led'
system.@led[0]=led
system.@led[0].default='0'
system.@led[0].sysfs='bcm53xx:green:wps'
system.@led[0].trigger='phy0radio'
you can then use the above values ( or similar ) in your hotplug script to toggle trigger > none... or whichever settings you desire... ( take care with any alternate access to the same led via loaded modules or conflicting config )
That was a lot of good information but it's hard for me to decipher what to use. Here's what turned up and I believe that using a case statement inside the file that controls the WPS LED will work. Problem: file location? I'll start work on the code to verify the light functions work according to plan.
just use uci set... to toggle the values you got using luci and uci show... why complicate things?
(example using my led[num] )
uci -q set system.@led[0].trigger='default-on'
uci -q set system.@led[0].trigger='none'
( double up and invert trigger for two leds i.e. green off > orange on )
this is your wps ( did you write the script above? because I assumed you were comfortable with uci based on it )
system.@led[4].sysfs='pca963x:rango:amber:wps'
and you might try toggling this instead of trigger or as a base setting ( i'm not testing any of this and some devices may have the default set to off or incorrect ) play with luci... get to know whats right... then do the script side.
uci -q set system.@led[4].default='0'
uci -q set system.@led[4].default='1'
you'll want code more like this to achieve your goal of having one on at a time...
#!/bin/sh
X=$(uci get wireless.radio0.disabled)
Y=$(uci get wireless.radio1.disabled)
Z=$(expr $X + $Y)
echo "X: $X"
echo "Y: $Y"
echo "Z: $Z"
case "$Z" in
0) #set 2 ghz on
echo "setting 2ghz on"
uci -q set system.@led[4].default='1'; uci -q set system.@led[5].default='0'
;;
1) #if 2ghz is on invert with 5 ghz ... if 5Ghz is on set both on
if [ "$X" -eq 1 ]; then
echo "switching 2ghz for 5 ghz"
else
echo "setting both 2ghz + 5 ghz on"
uci -q set system.@led[4].default='0'; uci -q set system.@led[5].default='1'
fi
;;
2) #both were on toggle both off
echo "setting both off"
uci -q set system.@led[4].default='0'; uci -q set system.@led[5].default='0'
;;
esac
I'm comfortable using UCI and I'm in the middle of reading the Linux Scripting Bible. So I'm almost up to speed and looking at your examples, I'm inspired!
The X+Y=Z correlating to:
0=BothOff (NoLED)
1=OneOn (AmberLED) *indicating an error (Not required)
2=BothOn (WhiteLED)
Your case template is excatly what I needed to build the configuration. Thank you so much.