Developing lightweight computation at the DSG edge

Commit 638c6ee9 authored by p4u's avatar p4u
Browse files

Fixed issue: if no wireless cards LuCi wireless section crashes. Added new...

Fixed issue: if no wireless cards LuCi wireless section crashes. Added new button to reconfigure wifi devices from web interface.
parent 86c11174
......@@ -35,7 +35,7 @@ search_default_gw() {
qmp_gw_apply
}
apply_wifi() {
configure_wifi() {
qmp_configure_wifi_initial
qmp_configure_wifi
wifi
......@@ -45,7 +45,7 @@ apply_netserver() {
[ "$(qmp_uci_get networks.netserver)" == "1" ] && qmp_enable_netserver || qmp_disable_netserver
}
apply_network() {
configure_network() {
qmp_configure
/etc/init.d/network restart
ifup -a
......@@ -68,8 +68,8 @@ help() {
echo "Available functions:"
echo " offer_default_gw : Offers default gw to the network"
echo " search_default_gw : Search for a default gw in the network"
echo " apply_wifi : Apply current wifi configuration"
echo " apply_network : Apply current network configuration"
echo " configure_wifi : Configure and apply current wifi settings"
echo " configure_network : Configure and apply current network settings"
echo " apply_netserver : Start/stop nerserver depending on qmp configuration"
echo " enable_ns_ppt : Enable POE passtrought from NanoStation M2/5 devices. Be careful with this"
echo ""
......
......@@ -27,19 +27,24 @@ sys = require "luci.sys"
qmpinfo = {}
function qmpinfo.get_modes(dev)
local modes = {}
local iw = iwinfo[iwinfo.type(dev)]
return iw.hwmodelist(dev)
if iw ~= nil then modes = iw.hwmodelist(dev) end
return modes
end
function qmpinfo.get_txpower(dev)
local iw = iwinfo[iwinfo.type(dev)]
local txp = iw.txpwrlist(dev)
local txpower_supported = {}
for _,v in ipairs(txp) do
table.insert(txpower_supported,v.dbm)
if iw ~= nil then
local txp = iw.txpwrlist(dev)
for _,v in ipairs(txp) do
table.insert(txpower_supported,v.dbm)
end
end
return txpower_supported
end
......
......@@ -40,20 +40,28 @@ end
---------------------------
-- Section Wireless Main --
---------------------------
s_wireless_main = m:section(NamedSection, "wireless", "qmp", "Wireless general options", "")
s_wireless_main = m:section(NamedSection, "wireless", "qmp", translate("Wireless general options"), "")
s_wireless_main.addremove = False
-- Driver selection
driver = s_wireless_main:option(ListValue, "driver", "Driver")
driver = s_wireless_main:option(ListValue, "driver", translate("Driver"))
driver:value("mac80211","mac80211")
driver:value("madwifi","madwifi")
-- Country selection
country = s_wireless_main:option(Value,"country", "Country")
country = s_wireless_main:option(Value,"country", translate("Country"))
-- BSSID
bssid = s_wireless_main:option(Value,"bssid","BSSID")
-- Button Rescan Wifi devices
confwifi = s_wireless_main:option(Button, "_confwifi", translate("Rescan and configure devices"))
function confwifi.write(self, section)
luci.sys.call("qmpcontrol configure_wifi > /tmp/qmp_rescan_wifi_devices.output")
end
-----------------------------
-- Section Wireless Device --
-----------------------------
......@@ -98,8 +106,9 @@ for _,wdev in ipairs(wdevs) do
end
end
function m.on_commit(self,map)
luci.sys.call('/etc/qmp/qmp_control.sh apply_wifi > /tmp/qmp_control_wifi.log &')
luci.sys.call('/etc/qmp/qmp_control.sh configure_wifi > /tmp/qmp_control_wifi.log &')
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment