summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/model
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-11-10 14:36:38 +0100
committerJo-Philipp Wich <jo@mein.io>2017-11-10 14:36:38 +0100
commit084d8b120a3267ba9fb6b87a68dfcb86aed072fd (patch)
tree983b91ba42e17391270753cec73254fba30dc86f /modules/luci-mod-admin-full/luasrc/model
parent932bae98738746e11d8b1b0bd9ac86009dd34452 (diff)
luci-mod-admin-full: restrict DSL xfer_mode and line_mode options to VDSL modems
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/model')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua27
1 files changed, 18 insertions, 9 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua
index 22f7c5f70..bd01bda9f 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua
@@ -3,14 +3,21 @@
-- Licensed to the public under the Apache License 2.0.
local fs = require "nixio.fs"
+local json = require "luci.jsonc"
m = Map("network", translate("Interfaces"))
m.pageaction = false
m:section(SimpleSection).template = "admin_network/iface_overview"
if fs.access("/etc/init.d/dsl_control") then
- dsl = m:section(TypedSection, "dsl", translate("DSL"))
+ local ok, boarddata = pcall(json.parse, fs.readfile("/etc/board.json"))
+ local modemtype = (ok == true)
+ and (type(boarddata) == "table")
+ and (type(boarddata.dsl) == "table")
+ and (type(boarddata.dsl.modem) == "table")
+ and boarddata.dsl.modem.type
+ dsl = m:section(TypedSection, "dsl", translate("DSL"))
dsl.anonymous = true
annex = dsl:option(ListValue, "annex", translate("Annex"))
@@ -37,15 +44,17 @@ if fs.access("/etc/init.d/dsl_control") then
tone:value("b", translate("B43 + B43C"))
tone:value("bv", translate("B43 + B43C + V43"))
- xfer_mode = dsl:option(ListValue, "xfer_mode", translate("Encapsulation mode"))
- xfer_mode:value("", translate("auto"))
- xfer_mode:value("atm", translate("ATM (Asynchronous Transfer Mode)"))
- xfer_mode:value("ptm", translate("PTM/EFM (Packet Transfer Mode)"))
+ if modemtype == "vdsl" then
+ xfer_mode = dsl:option(ListValue, "xfer_mode", translate("Encapsulation mode"))
+ xfer_mode:value("", translate("auto"))
+ xfer_mode:value("atm", translate("ATM (Asynchronous Transfer Mode)"))
+ xfer_mode:value("ptm", translate("PTM/EFM (Packet Transfer Mode)"))
- line_mode = dsl:option(ListValue, "line_mode", translate("DSL line mode"))
- line_mode:value("", translate("auto"))
- line_mode:value("adsl", translate("ADSL"))
- line_mode:value("vdsl", translate("VDSL"))
+ line_mode = dsl:option(ListValue, "line_mode", translate("DSL line mode"))
+ line_mode:value("", translate("auto"))
+ line_mode:value("adsl", translate("ADSL"))
+ line_mode:value("vdsl", translate("VDSL"))
+ end
firmware = dsl:option(Value, "firmware", translate("Firmware File"))