硬件的GPIO读取与写入
在哪里每一秒检测GPIO?
其中AP模式切换和mesh开关脚本如下:
#/bin/sh
meshswitch()
{
old_mesh_switch=$(tcapi get Mesh_EnableConf EasyMeshEnable)
op_relay_flag=$(mdlcfg -o op_relay)
if [ "$1" = "on" -a $old_mesh_switch = 0 ] ; then
echo "mesh hello"
tcapi set Mesh_EnableConf EasyMeshEnable 1
ssid4_switch=$(tcapi get Wlan_Entry3 EnableSSID)
ssid8_switch=$(tcapi get Wlan11ac_Entry3 EnableSSID)
if [ $ssid4_switch = 0 ] ; then
tcapi set Wlan_Entry3 EnableSSID 1
tcapi commit Wlan_Entry3
fi
if [ $ssid8_switch = 0 ] ; then
tcapi set Wlan11ac_Entry3 EnableSSID 1
tcapi commit Wlan11ac_Entry3
fi
tcapi set Mesh_common SteerEnable 1
tcapi set Mesh_common ReinitWifiFlag 1
tcapi set APCli_Common StartConn 0
if [ $op_relay_flag = 1 ] ; then
tcapi set Mesh_dat MapEnable 1
tcapi set Mesh_dat MAP_Turnkey 1
else
tcapi commit Mesh_dat
fi
tcapi save
fi
if [ "$1" = "off" -a $old_mesh_switch = 1 ] ; then
echo "mesh byebye"
tcapi set Mesh_EnableConf EasyMeshEnable 0
ssid4_switch=$(tcapi get Wlan_Entry3 EnableSSID)
ssid8_switch=$(tcapi get Wlan11ac_Entry3 EnableSSID)
if [ $ssid4_switch = 1 ] ; then
tcapi set Wlan_Entry3 EnableSSID 0
tcapi commit Wlan_Entry3
fi
if [ $ssid8_switch = 1 ] ; then
tcapi set Wlan11ac_Entry3 EnableSSID 0
tcapi commit Wlan11ac_Entry3
fi
tcapi commit Mesh_dat
tcapi save
fi
}
modeswitch()
{
old_mode=$(tcapi get APWanInfo_Common FixedAPMode)
if [ "$1" = "route" -a "$old_mode" != "Route" ] ; then
echo "route hello"
/usr/script/relay_net.sh OFF &
tcapi set WanInfo_WanPVC Action Modify
tcapi set APWanInfo_Common FixedAPMode Route
tcapi set WanInfo_WanPVC VLANID 4096
tcapi set WanInfo_WanPVC DOT1P 0
tcapi set WanInfo_WanPVC VLANMode UNTAG
tcapi set WanInfo_WanPVC ENCAP "1483 Bridged IP LLC"
tcapi set WanInfo_WanIF ISP 0
tcapi set WanInfo_WanIF Active Yes
tcapi set APWanInfo_Common FixedAPMode Route
tcapi set WanInfo_WanIF ServiceList INTERNET
tcapi set WanInfo_WanIF BandActive N/A
tcapi set WanInfo_WanIF LAN1 No
tcapi set WanInfo_WanIF WanMode Route
tcapi set WanInfo_WanIF LinkMode linkIP
tcapi set WanInfo_WanIF VLANMode UNTAG
tcapi set WanInfo_WanIF dot1q No
tcapi set WanInfo_WanIF dot1p No
tcapi set WanInfo_WanIF NATENABLE Enable
tcapi set WanInfo_WanIF IGMPproxy No
tcapi set WanInfo_WanIF DHCPEnable 1
tcapi set WanInfo_WanIF GW6_Manual No
tcapi set WanInfo_WanIF PDOrigin None
tcapi set WanInfo_WanIF PD_enable No
tcapi set WanInfo_WanIF IFIdx 1
tcapi set WanInfo_WanIF IPVERSION IPv4
tcapi set WanInfo_WanIF MTU 1500
tcapi save
/usr/script/reset_eth_lan.sh &
tcapi commit WanInfo_WanPVC
fi
if [ "$1" = "bridge" -a "$old_mode" != "Bridge" ] ; then
echo "bridge hello"
tcapi set APWanInfo_Common FixedAPMode Bridge
tcapi set Account_Entry1 Logged 0
/usr/script/dnsmasq_init.sh 1 &
tcapi commit APWanInfo_Common
fi
}
if [ "$1" = "mesh" -a -n $2 ] ; then
meshswitch $2
elif [ "$1" = "mode" -a -n $2 ] ; then
modeswitch $2
else
echo "usage:tz_hwchannel.sh mesh on"
fi