bugfix: POE passthough fails on NS XM devices

the Nanostation XM devices require setting the gpio
port direction unlike some other devices
This commit is contained in:
Joe Ayers 2018-11-27 18:07:23 -08:00
parent a59fe2524a
commit 264c32a61d
1 changed files with 8 additions and 5 deletions

View File

@ -45,10 +45,13 @@ if [ -z "$pinnum" ]; then
echo "There are NO PoE Passthrough ports defined for this device"
exit 1
else
export pin="gpio${pinnum}"
if [ ! -d "/sys/class/gpio/$pin" ]; then
echo "${pinnum}" > /sys/class/gpio/export
fi
echo ${newval} > /sys/class/gpio/${pin}/value
export pin="gpio${pinnum}"
if [ ! -d "/sys/class/gpio/${pin}" ]; then
echo "${pinnum}" > /sys/class/gpio/export
fi
if [ -e "/sys/class/gpio/${pin}/direction" ]; then
echo "out" > /sys/class/gpio/${pin}/direction
fi
echo "${newval}" > /sys/class/gpio/${pin}/value
exit 0
fi