mirror of https://github.com/aredn/aredn.git
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:
parent
e8b3520ec7
commit
9a47ff800a
|
@ -40,16 +40,15 @@ if [ -z "$newval" ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
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
|
if [ -z "$pinnum" ]; then
|
||||||
echo "There are NO PoE Passthrough ports defined for this device"
|
echo "There are NO PoE Passthrough ports defined for this device"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
export pin=$(echo "gpio${pinnum}")
|
export pin="gpio${pinnum}"
|
||||||
if [ ! -d /sys/class/gpio/$pin ]; then
|
if [ ! -d "/sys/class/gpio/$pin" ]; then
|
||||||
echo ${pinnum} > /sys/class/gpio/export
|
echo "${pinnum}" > /sys/class/gpio/export
|
||||||
fi
|
fi
|
||||||
echo out > /sys/class/gpio/${pin}/direction
|
|
||||||
echo ${newval} > /sys/class/gpio/${pin}/value
|
echo ${newval} > /sys/class/gpio/${pin}/value
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -81,7 +81,7 @@ push @setting, {
|
||||||
# ----- CONDITIONS ----------
|
# ----- CONDITIONS ----------
|
||||||
sub hasPOE()
|
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);
|
chomp($pin);
|
||||||
return $pin ? return 1 : return 0;
|
return $pin ? return 1 : return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue