-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun
executable file
·41 lines (35 loc) · 1.2 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR
if [ "$DIR" == "/opt/atol-websocket-kkm" ]; then
git pull 2>&1 1>/tmp/atol-git-update.log
fi
atol=`dmesg | grep ATOL | grep USB | cut -d "]" -f 2 | cut -d ":" -f 1 | cut -d "b" -f 2 | tail -n 1 | xargs`
if [ "$atol" != "" ]; then
port=`dmesg | grep ttyACM | grep "$atol" | cut -d ":" -f 3 | tail -n 2 | head -n 1 | xargs`
fi
disp_mode=""
disp=`dmesg | grep Posiflex | grep usb | cut -d "]" -f 2 | cut -d ":" -f 1 | cut -d "b" -f 2 | tail -n 1 | xargs`
if [ "$disp" != "" ]; then
disp=`dmesg | grep ttyACM | grep "$disp" | cut -d ":" -f 3 | tail -n 1 | xargs`
disp_mode=1
fi
#if [ "$disp" == "" ]; then
# disp=`dmesg | grep pl2303 | grep converter | grep attached | awk '{print $NF}' | tail -n 1 | xargs`
# if [ "$disp" != "" ]; then
# disp_mode=2
# fi
#fi
if [ ! -e "/dev/$disp" ]; then
disp=""
disp_mode=""
fi
if [[ "$atol" != "" && "$port" != "" && -e "/dev/$port" ]]; then
./driver.py $atol $disp $disp_mode
fi