diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c8d6c4f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ioemu"] + path = ioemu + url = https://git.xdrm.io/logauth/ioemu.git diff --git a/ioemu/.gitignore b/ioemu/.gitignore deleted file mode 100644 index 6fe43c5..0000000 --- a/ioemu/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.lock diff --git a/ioemu/com b/ioemu/com deleted file mode 160000 index e84678a..0000000 --- a/ioemu/com +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e84678ac6b9524a2c8a270f2af88a79a59fd2923 diff --git a/ioemu/daemon b/ioemu/daemon deleted file mode 100755 index 15cfdb8..0000000 --- a/ioemu/daemon +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - - -# (1) Primary init. -#--------------------------------------------------------# -# (1) Get absolute folder # -ROOT=$(dirname `realpath $0`); - -# (2) Check required arguments -test $# -lt 1 && echo -e "ERR: Missing argument\n\n\tSATS_IP\tThe ip for the SATS system\n" && exit 1; -SATS_IP=$1; - -# (3) Check lock file # -test -f $ROOT/.lock && echo "Daemon already started ($ROOT/.lock)" && exit 1; -touch $ROOT/.lock; - - - -# (2) Set traps before starting any subproccess -#--------------------------------------------------------# -trap "kill -9 $SERV_PID 2>/dev/null; pkill nc 2>/dev/null; rm $ROOT/.lock 2>/dev/null; exit 1;" INT; -trap "kill -9 $SERV_PID 2>/dev/null; pkill nc 2>/dev/null; rm $ROOT/.lock 2>/dev/null; exit 1;" KILL; - - - -# (3) Wait for trigger to launch server -#--------------------------------------------------------# -# (1) Wait for trigger # -$ROOT/com/trigger 9999; - -# (2) Launch server in background # -$ROOT/com/launch ioemu $SATS_IP 44440 44441; \ No newline at end of file diff --git a/ioemu/src/disp-led b/ioemu/src/disp-led deleted file mode 100755 index b9b4a49..0000000 --- a/ioemu/src/disp-led +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - - -# (1) Declare association state <-> color_id -#--------------------------------------------------------# -# (1) Create associative array # -declare -A COLCODE; - -# (2) States # -COLCODE[0]=90; -COLCODE[R]=31; -COLCODE[G]=32; -COLCODE[B]=34; - -# (2) Check argument + display led -#--------------------------------------------------------# -# (1) Check argument # -test $# -ge 1 && state="$1" || state="0"; - -# (2) Display led # -echo -e "\e[${COLCODE[$state]}m⬤\e[0m"; \ No newline at end of file diff --git a/ioemu/src/disp-relay b/ioemu/src/disp-relay deleted file mode 100755 index 4e76594..0000000 --- a/ioemu/src/disp-relay +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - - -# (1) Declare association state <-> color_id -#--------------------------------------------------------# -# (1) Create associative array # -declare -A COLCODE; - -# (2) States # -COLCODE[0]=90; -COLCODE[1]=32; - -# (2) Check argument + display led -#--------------------------------------------------------# -# (1) Check argument # -test $# -ge 1 && state="$1" || state="0"; - -# (2) Display led # -echo -e "\e[${COLCODE[$state]}m⏺\e[0m"; \ No newline at end of file diff --git a/ioemu/sub-view/gpio b/ioemu/sub-view/gpio deleted file mode 100755 index 084c5ae..0000000 --- a/ioemu/sub-view/gpio +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - - -# (1) Primary init. -#--------------------------------------------------------# -# (1) Get absolute folder # -ROOT=$(dirname `realpath $0`); -ROOT=`dirname $ROOT`; - -# (2) Check lock file # -test ! -f $ROOT/.lock && echo "Daemon not started" && exit 1; - - - -# (2) While viewing loop -#--------------------------------------------------------# -# (1) Initialise vars # -LED="0"; Rx=(0 0 0); # led; relays -SYSTD_TREE=""; # service_log - -# (2) Get BUF_IN # -source $ROOT/com/config_ioemu; - - -while sleep 2; clear; do - - # (3) Get last value from lines beginning by 'GSTA' # - STATE="`cat $BUF_IN | grep -Po "^GPIO(.+)$" | sed 's/^GPIO\(....\)$/\1/g' | tail -n1`"; - - echo "state: $STATE"; - - # (4) Apply to values if not 'x' (means 'ignore' that chip) # - if [ ! -z "$STATE" ]; then - - test "${STATE:0:1}" != "x" && LED="${STATE:0:1}"; # if set to 'x', ignore - test "${STATE:1:1}" != "x" && Rx[1]="${STATE:1:1}"; # if set to 'x', ignore - test "${STATE:2:1}" != "x" && Rx[2]="${STATE:2:1}"; # if set to 'x', ignore - test "${STATE:3:1}" != "x" && Rx[3]="${STATE:3:1}"; # if set to 'x', ignore - - fi; - - # (5) Display led # - echo -n "LED: "; $ROOT/src/disp-led $LED; - - # (6) Display relays # - echo -n "R1: "; $ROOT/src/disp-relay ${Rx[1]}; - echo -n "R2: "; $ROOT/src/disp-relay ${Rx[2]}; - echo -n "R3: "; $ROOT/src/disp-relay ${Rx[3]}; - -done; \ No newline at end of file diff --git a/ioemu/view b/ioemu/view deleted file mode 100755 index c7488d7..0000000 --- a/ioemu/view +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - - -# (1) Primary init. -#--------------------------------------------------------# -# (1) Get absolute folder # -ROOT=$(dirname `realpath $0`); - -# (2) Check lock file # -test ! -f $ROOT/.lock && echo "Daemon not started" && exit 1; - -# (3) Check argument # -test $# -lt 1 && echo -e "ERR: Missing argument\n\n\tgpio\tGPIO real-time view\n\tsystemd\tSystemd real-time dependency tree\n\tlogs\tLogs real-time view\n" && exit 1; - -# (4) Check argument binds to an actual file # -test ! -f $ROOT/sub-view/$1 && echo -e "ERR: No such value for argument" && exit 1; - - -# (2) Start sub-view -#--------------------------------------------------------# -$ROOT/sub-view/$1; \ No newline at end of file