-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatalogger.sh
executable file
·66 lines (61 loc) · 1.47 KB
/
datalogger.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
for devbyid in /dev/serial/by-id/usb-*
do
dev=`ls -lah $devbyid | tail -c 8` #e.g. ttyUSB0 or ttyACM0
dev=/dev/$dev
#switch datalogger depending on device
# echo $devbyid
##Arduino #UNO
if((`echo $devbyid | grep Arduino | wc -l`>0))
then
echo $dev" is Arduino #UNO"
datalogger=./datalogger_UNO.py
fi
##Prolific #DYLOS
if((`echo $devbyid | grep Prolific | wc -l`>0))
then
echo $dev" is Prolific #DYLOS"
datalogger=./datalogger_DYLOS.py
fi
##AM01 #AlphaSense CO2
if((`echo $devbyid | grep AM01 | wc -l`>0))
then
echo $dev" is AlphaSense CO2"
datalogger=./datalogger_CO2.py
fi
##A9021 #WaspMote
if((`echo $devbyid | grep A9021 | wc -l`>0))
then
echo $dev" is WaspMote"
datalogger=./datalogger_wasp.py
fi
##A?00 #MX3cK/ADC
if((`echo $devbyid | grep A.00 | wc -l`>0))
then
echo $dev" is PC2A,MX3cK/ADC 6x"
datalogger=./datalogger_ADC_6.py
fi
##A?00 #MX3cK/ADC 2 sensors
if((`echo $devbyid | grep A.00 | grep -e TR7 -e ZOC | wc -l`>0))
then
echo $dev" is PC2A,MX3cK/ADC 2x"
datalogger=./datalogger_ADC_2.py
fi
##A?00 #MX3cK/ADC 4 sensors
if((`echo $devbyid | grep A.00 | grep 4cv | wc -l`>0))
then
echo $dev" is PC2A,MX3cK/ADC 4x"
datalogger=./datalogger_ADC_4.py
fi
#start datalogger
echo 'start logging '$dev'.'
nohup $datalogger --device $dev &
sleep 1
echo
done
#wait
sleep 2
#check
ps aux | grep '.py' | grep datalogger --color
exit
ls -lah /dev/serial/by-id/usb-*