mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Merge pull request #62 from Doodle3D/feature/button-switch-wificonfig
Feature/button switch wificonfig
This commit is contained in:
commit
ae036af172
5
Makefile
5
Makefile
@ -101,6 +101,10 @@ define Package/wifibox/install
|
||||
#$(INSTALL_DIR) $(1)/www
|
||||
$(INSTALL_DIR) $(1)/www/cgi-bin
|
||||
|
||||
#copy wps button script to procd folder
|
||||
$(INSTALL_DIR) $(1)/etc/rc.button/
|
||||
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifi-switch-netconfig.sh $(1)/etc/rc.button/wps
|
||||
|
||||
### create all files in /usr/share/lua/autowifi (autowifi)
|
||||
|
||||
$(CP) $(WIFIBOX_BASE_DIR)/opkg.conf $(1)/$(TGT_LUA_DIR_SUFFIX)/
|
||||
@ -118,6 +122,7 @@ define Package/wifibox/install
|
||||
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifibox_init $(1)/etc/init.d/wifibox
|
||||
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/dhcpcheck_init $(1)/etc/init.d/dhcpcheck
|
||||
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3dapi $(1)/$(TGT_LUA_DIR_SUFFIX)/script
|
||||
$(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/d3dapi $(1)/bin/d3dapi
|
||||
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/signin.sh $(1)/$(TGT_LUA_DIR_SUFFIX)/script
|
||||
$(CP) $(WIFIBOX_BASE_DIR)/script/logrotate-wifibox.conf $(1)/etc/logrotate.d/wifibox.conf
|
||||
|
||||
|
@ -55,7 +55,6 @@ if [ $? -gt 0 ]; then
|
||||
cat <<-\EOM >> $IPKG_INSTROOT/root/.profile
|
||||
# DO NOT MODIFY - this block of lines has been added by the wifibox package.
|
||||
alias d='ls -la'
|
||||
alias d3dapi='/usr/share/lua/wifibox/script/d3dapi'
|
||||
alias encore='ulimit -c unlimited'
|
||||
alias wopkg='opkg -f /usr/share/lua/wifibox/opkg.conf'
|
||||
|
||||
|
@ -218,4 +218,17 @@ function M.alive(request, response)
|
||||
response:setSuccess("alive")
|
||||
end
|
||||
|
||||
function M.reset_POST(request, response)
|
||||
response:setSuccess("Resetting networks")
|
||||
|
||||
log:info(MOD_ABBR, "Resetting networks")
|
||||
for _, net in ipairs(wifi.getConfigs()) do
|
||||
wifi.removeConfig(net.ssid)
|
||||
end
|
||||
|
||||
local ssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
|
||||
netconf.setupAccessPoint(ssid)
|
||||
netconf.enableAccessPoint(ssid)
|
||||
end
|
||||
|
||||
return M
|
||||
|
12
src/script/wifi-switch-netconfig.sh
Executable file
12
src/script/wifi-switch-netconfig.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "${ACTION}" = "released" ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
logger "$BUTTON pressed for $SEEN seconds"
|
||||
if [ "$SEEN" -gt 4 ]
|
||||
then
|
||||
logger "Resetting Wireless"
|
||||
d3dapi p=/network/reset r=POST
|
||||
fi
|
Loading…
Reference in New Issue
Block a user