bugfix: correct poe functions in adv cfg (#250)

* bugfix: correct poe functions in adv cfg

cleanup shellcheck errors

* avoid unnecessary shell
This commit is contained in:
dman776 2018-10-27 11:37:45 -05:00 committed by GitHub
parent e8b3520ec7
commit 9a47ff800a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -40,16 +40,15 @@ if [ -z "$newval" ]; then
exit 2
fi
export pinnum=`cat /etc/board.json|jsonfilter -e '@.gpioswitch.poe_passthrough.pin'`
export pinnum=$(jsonfilter -e '@.gpioswitch.poe_passthrough.pin' < /etc/board.json)
if [ -z "$pinnum" ]; then
echo "There are NO PoE Passthrough ports defined for this device"
exit 1
else
export pin=$(echo "gpio${pinnum}")
if [ ! -d /sys/class/gpio/$pin ]; then
echo ${pinnum} > /sys/class/gpio/export
export pin="gpio${pinnum}"
if [ ! -d "/sys/class/gpio/$pin" ]; then
echo "${pinnum}" > /sys/class/gpio/export
fi
echo out > /sys/class/gpio/${pin}/direction
echo ${newval} > /sys/class/gpio/${pin}/value
exit 0
fi

View File

@ -81,7 +81,7 @@ push @setting, {
# ----- CONDITIONS ----------
sub hasPOE()
{
$pin=`cat /etc/board.json|jsonfilter -e '@.gpioswitch.usb_power_switch.pin'`;
$pin=`cat /etc/board.json|jsonfilter -e '@.gpioswitch.poe_passthrough.pin'`;
chomp($pin);
return $pin ? return 1 : return 0;
}