%# updateFW.htm -%> <% local fs = require "nixio.fs" local path = luci.dispatcher.context.requestpath local utl = require "luci.util" local mUtl = require "luci.moreUtils" local cl = path[1] or "" ------- check if master ---------------------- local sn = mUtl.get_serialnumber() local master = mUtl.identify_pseudo_maestre(path[3] or sn) local method, uci_method if master == true then method = "webmanager.network" uci_method = "uci" else method = path[3].."/webmanager.network" uci_method = path[3].."/uci" end -------Pick interface and device info------------- local mode = path[6] local device = utl.ubus(uci_method, "get", {config = "wireless", type = "wifi-device"}) local device_enabled = "Enable" local button local channel local iface = utl.ubus(method, "wifi_overview") local dev_name = iface.device for k , v in pairs (iface) do if type(v) == "table" and k == path[6] then iface = v end end if iface and iface.disabled == 1 then iface.disabled = true else iface.disabled = false end for k , v in pairs (device.values ) do for z , t in pairs (v) do if z == "disabled" then if t == "1" then device_enabled = "Enable" button = "reload" elseif t == "0" then device_enabled = "Disable" button = "reset" end end if z == "channel" then channel = t end end end -%> <%+header%>