From 7762f3d4c80420986214eb969131453f1c3cebf6 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 20 Feb 2017 23:22:17 +0100 Subject: [PATCH] in/out /lib/gpio optimization (not if already good mode) --- lib/gpio/in | 2 +- lib/gpio/out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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;