Fix enabling/disabling POE and USB power (#1399)

This commit is contained in:
Tim Wilkinson 2024-08-25 16:35:02 -07:00 committed by GitHub
parent 1ba610c6d1
commit ebe5cd0586
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View File

@ -138,7 +138,9 @@ local changes = {
tunnels = false,
wireless = false,
localservices = false,
wpad = false
wpad = false,
poe = false,
pou = false
}
function valid_config(config)
@ -1296,7 +1298,9 @@ local config_special = {
wifi_mode_0 = c:get("wireless", "@wifi-iface[0]", "mode"),
wifi_mode_1 = c:get("wireless", "@wifi-iface[1]", "mode"),
wifi_channel_0 = c:get("wireless", "@wifi-device[0]", "channel"),
wifi_channel_1 = c:get("wireless", "@wifi-device[1]", "channel")
wifi_channel_1 = c:get("wireless", "@wifi-device[1]", "channel"),
power_eth = c:get("aredn", "@poe[0]", "passthrough"),
power_usb = c:get("aredn", "@usb[0]", "passthrough")
}
local nfiles = {}
for file in nixio.fs.glob("/tmp/new_config/*")
@ -1345,6 +1349,12 @@ do
if oc:get("aredn", "@wan[0]", "web_access") ~= config_special.web_access or oc:get("aredn", "@wan[0]", "ssh_access") ~= config_special.ssh_access or oc:get("aredn", "@wan[0]", "telnet_access") ~= config_special.telnet_access then
changes.firewall = true
end
if oc:get("aredn", "@poe[0]", "passthrough") ~= config_special.power_eth then
change.poe = true;
end
if oc:get("aredn", "@usb[0]", "passthrough") ~= config_special.power_usb then
change.pou = true;
end
elseif file == "network" then
changes.network = true
changes.tunnels = true -- restarting network devices requires tunnels to restart

View File

@ -74,6 +74,10 @@ do
/sbin/wifi reload > /dev/null 2>&1
elif [ $srv = "localservices" ]; then
/etc/local/services > /dev/null 2>&1
elif [ $srv = "poe" ]; then
/usr/local/bin/poe_passthrough $(/sbin/uci -q get aredn.@poe[0].passthrough) > /dev/null 2>&1
elif [ $srv = "pou" ]; then
/usr/local/bin/usb_passthrough $(/sbin/uci -q get aredn.@usb[0].passthrough) > /dev/null 2>&1
elif [ -x /etc/init.d/$srv ]; then
/etc/init.d/$srv restart > /dev/null 2>&1
fi