diff --git a/lib/gpio/in b/lib/gpio/in index d58957b..cd930fb 100755 --- a/lib/gpio/in +++ b/lib/gpio/in @@ -32,7 +32,7 @@ test -d /sys/class/gpio/gpio$1 || echo $1 > /sys/class/gpio/export; # [4] Set mode to OUT #========================================================# -echo "in" > /sys/class/gpio/gpio$1/direction; +icat /sys/class/gpio/gpio$1/direction | grep -v "in" && echo "in" > /sys/class/gpio/gpio$1/direction; diff --git a/lib/gpio/out b/lib/gpio/out index c4b1948..27e47ce 100755 --- a/lib/gpio/out +++ b/lib/gpio/out @@ -32,7 +32,7 @@ test -d /sys/class/gpio/gpio$1 || echo $1 > /sys/class/gpio/export; # [4] Set mode to OUT #========================================================# -echo "out" > /sys/class/gpio/gpio$1/direction; +icat /sys/class/gpio/gpio$1/direction | grep -v "out" && echo "out" > /sys/class/gpio/gpio$1/direction;