mirror of https://github.com/OpenIPC/composer.git
23 lines
314 B
Bash
Executable File
23 lines
314 B
Bash
Executable File
#!/bin/sh
|
|
|
|
AT="AT+BTV"
|
|
SLEEP=0;
|
|
TTY=/dev/ttyUSB0
|
|
RESULT="";
|
|
while [[ -z "$RESULT" ]]
|
|
do
|
|
RESULT=$(cat $TTY & echo -ne "$AT\n" > $TTY; sleep $SLEEP; killall cat)
|
|
if [[ "$RESULT" == *"ommand"* ]]; then
|
|
RESULT="";
|
|
sleep 1;
|
|
fi
|
|
if [[ -z "$RESULT" ]]; then
|
|
sleep 0.1;
|
|
fi
|
|
done
|
|
r=${RESULT:4}
|
|
#echo $r;
|
|
r=${r::-2}
|
|
echo $r;
|
|
|