Script used to start gpsd and collect NMEA from an Android phone using socat
authorBenoit Papillault <benoit.papillault@free.fr>
Sun, 12 Jun 2011 12:23:59 +0000 (14:23 +0200)
committerBenoit Papillault <benoit.papillault@free.fr>
Sun, 12 Jun 2011 12:23:59 +0000 (14:23 +0200)
script-start-gps [new file with mode: 0755]

diff --git a/script-start-gps b/script-start-gps
new file mode 100755 (executable)
index 0000000..bd5bd54
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+trap "killall $(basename $0)" INT
+
+GPS_IP="192.168.1.1 192.168.1.101"
+
+while true; do
+    for ip in ${GPS_IP}; do
+       # -v -T10
+       socat -T10 TCP:${ip}:4352,connect-timeout=1 PTY,link=/tmp/gps
+    done
+done &
+
+while true; do
+    if [ -c /tmp/gps ]; then
+       ls -la /tmp/gps
+       ls -Llla /tmp/gps
+       # -n -N -D 2
+       # -D 3 for GPS data
+       gpsd -n -N -D 3 /tmp/gps
+       sleep 2
+    fi
+done