bugfix: correct initial values for poe and usb passthrough (#271)

* bugfix: correct initial values for poe and usb passthrough

* correct a few shellcheck errors
This commit is contained in:
dman776 2018-11-16 22:41:58 -06:00 committed by GitHub
parent a997ef9545
commit 854afdb32d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 4 deletions

View File

@ -51,9 +51,26 @@ boot() {
[ -x /etc/local/services ] && /etc/local/services [ -x /etc/local/services ] && /etc/local/services
# set POE passthrough if available # set POE passthrough if available
local poevalue=$(uci get aredn.@poe[0].passthrough) local poevalue=$(uci -q get aredn.@poe[0].passthrough)
if [ -z $poevalue]; then if [ -z "$poevalue" ]; then
poevalue=0 local dpval=$(jsonfilter -e '@.gpioswitch.poe_passthrough.default' < /etc/board.json)
if [ ! -z "$dpval" ]; then
uci -q add aredn poe
uci -q set aredn.@poe[0].passthrough="$dpval"
uci -q commit aredn
poevalue=$dpval
fi fi
/usr/local/bin/poe_passthrough ${poevalue} fi
/usr/local/bin/poe_passthrough "${poevalue}"
# set USB passthrough if available
local usbvalue=$(uci -q get aredn.@usb[0].passthrough)
if [ -z "$usbvalue" ]; then
local duval=$(jsonfilter -e '@.gpioswitch.usb_power_switch.default' < /etc/board.json)
uci -q add aredn usb
uci -q set aredn.@usb[0].passthrough="$duval"
uci -q commit aredn
usbvalue=$duval
fi
/usr/local/bin/poe_passthrough "${usbvalue}"
} }