blob: 5c69011bb94a1914fcade24824e0b559058d93f9 [file] [log] [blame]
#!/bin/bash
set_gpio()
{
local NET_NAME=$1
local OUT_VAL=$2
mapfile -t -d " " GPIO_INFO < <(gpiofind "$NET_NAME")
if [ "${#GPIO_INFO[@]}" -ne 2 ]; then
echo "set_gpio: can not find gpio, $NET_NAME"
return 1
fi
echo -n "set_gpio: set $NET_NAME = $OUT_VAL"
if ! gpioset "${GPIO_INFO[0]}" "${GPIO_INFO[1]%$'\n'}"="$OUT_VAL"; then
echo " failed"
return 1
fi
echo " success"
return 0
}
check_nuvoton_board()
{
set +e
grep nuvoton /sys/firmware/devicetree/base/compatible
return 0
}