Skip to content
Snippets Groups Projects
Commit b0671dd7 authored by David Bauer's avatar David Bauer
Browse files

gluon-web-network: support handling of active-low PoE passthrough


The Aruba AP-303H offers a switchable PSE output on ETH3. The power
state is controlled using a GPIO pin like seen on CPE210 and Nanostation
alike.

However, the PSE state is active low, which the current code handles as
"Enable PoE Passthrough disable". This is not intuitive, thus support
the active low case in the Gluon Web-UI.

Signed-off-by: default avatarDavid Bauer <mail@david-bauer.net>
parent a475b191
No related branches found
No related tags found
No related merge requests found
...@@ -102,15 +102,28 @@ uci:foreach("system", "gpio_switch", function(si) ...@@ -102,15 +102,28 @@ uci:foreach("system", "gpio_switch", function(si)
end end
local texts = { local texts = {
["^PoE Power Port(%d*)$"] = function(m) return translatef("Enable PoE Power Port %s", m[1]) end, ["^PoE Power Port(%d*)$"] = {
["^PoE Passthrough$"] = function() return translate("Enable PoE Passthrough") end, get_title = function(m) return translatef("Enable PoE Power Port %s", m[1]) end,
active_low = false,
},
["^PoE Passthrough$"] = {
get_title = function() return translate("Enable PoE Passthrough") end,
active_low = false,
},
-- Typo in AP-303H (ipq40xx-generic)
["^POE passtrough disable$"] = {
get_title = function() return translate("Enable PoE Passthrough") end,
active_low = true,
},
} }
local name local name
for pattern, func in pairs(texts) do local active_low = false
for pattern, text_obj in pairs(texts) do
local match = {si.name:match(pattern)} local match = {si.name:match(pattern)}
if match[1] then if match[1] then
name = func(match) name = text_obj.get_title(match)
active_low = text_obj.active_low
break break
end end
end end
...@@ -120,9 +133,17 @@ uci:foreach("system", "gpio_switch", function(si) ...@@ -120,9 +133,17 @@ uci:foreach("system", "gpio_switch", function(si)
local poe = section:option(Flag, si[".name"], name) local poe = section:option(Flag, si[".name"], name)
poe.default = uci:get_bool("system", si[".name"], "value") poe.default = uci:get_bool("system", si[".name"], "value")
if active_low then
poe.default = not poe.default
end
function poe:write(data) function poe:write(data)
uci:set("system", si[".name"], "value", data) local write_value = data
if active_low then
write_value = not write_value
end
uci:set("system", si[".name"], "value", write_value)
end end
end end
end) end)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment