-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_imu_gps.sh
executable file
·36 lines (31 loc) · 1.09 KB
/
read_imu_gps.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
#!/bin/bash
#Wait 3 minutes before starting
sleep 1s
#Kills all processes logging data that are running
pkill -f str2str
#Goes to home folder
cd ~
#Obtaining the time of the output
collect_time=$(date +%y-%m-%d-%H-%M-%S)
#Reads devices plugged in the USB ports
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
(
syspath="${sysdevpath%/dev}"
devname="$(udevadm info -q name -p $syspath)"
[[ "$devname" == "bus/"* ]] && continue
eval "$(udevadm info -q property --export -p $syspath)"
[[ -z "$ID_SERIAL" ]] && continue
echo "/dev/$devname - $ID_SERIAL"
case $ID_SERIAL in
Prolific_Technology_Inc._USB-Serial_Controller_D)
nohup ./str2str -in serial://${devname}:115200:8:none:none#stq -out file://${collect_time}-gps${devname:-1}.stq &
;;
1a86_USB2.0-Serial)
nohup ./str2str -in serial://${devname}:115200:8:none:none# -out file://${collect_time}-imu.nmea &
;;
*)
echo .
;;
esac
)
done