VoCore: AP+STA Switch

This blog is used to solve the problem: when we setup AP+STA mode but STA can not connect to host, it will cause AP fails to show itself.

The Reason:
AP+STA, its real name is Bridge Mode, it uses half bandwidth connect to AP and another half to STA. So AP/STA must in same channel. If the driver can not find STA host, it will not get the channel for AP, so AP in VoCore can not show.

Solution:
First, scan STA connection state, if it fails to connect to STA, then force VoCore into AP mode. The benefit is obviously: we do not have to use TTL/ethernet to setup the config anymore, users are able to use wifi to update the configuration now.

The Script:
This script is from Zhuohuan Lee. It uses ubus to scan the STA state every 2~3 seconds. If STA fail, it will turn VoCore to AP mode. A nice script. :)

Download Here: fix_sta_ap.sh

PS: My idea is a script only run once after boot up, if STA do not work, make VoCore to AP mode, so we do not have to check every seconds.

 
Run it at startup.

root@OpenWrt:~# cat /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

/bin/sh /root/fix_sta_ap.sh > /dev/null &

exit 0