Created
December 20, 2013 02:19
-
-
Save worldeater/8049555 to your computer and use it in GitHub Desktop.
This script allows to use an Ericsson F5521gw mobile broadband module (aka Dell DW5500 or Hewlett-Packard HS2340) with gpsd 3.9 under FreeBSD.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
# This script allows to use an Ericsson F5521gw mobile broadband module (aka | |
# Dell DW5500 or Hewlett-Packard HS2340) with gpsd 3.9 under FreeBSD. | |
# | |
# Source: hxxp://wiki.volution.ro/CiprianDorinCraciun/Notes/Public/F5521gw | |
# Requires: astro/gpsd, net/socat | |
# Usage: gps_on [interval] [tempfile] | |
interval="${1:-10}" # update interval in seconds (default: 10) | |
tempfile="${2:-/tmp/gps.data}" # a pty the GPS data is redirected to | |
# Set up the card for GPS usage and stream the GPS data to a temporary pty | |
# NOTE: socat's "echo=0" prevents gpsd from using 100% CPU time | |
( | |
exec <>/dev/cuaU2 >&0 && \ | |
chat -s -S -t5 -- \ | |
"*EMRDY: 1" "AT" \ | |
"OK" "AT+CFUN=1" \ | |
"OK" "AT*E2GPSCTL=1,$interval" \ | |
"OK" "AT*E2GPSNPD" \ | |
"OK" "" && \ | |
exec socat \ | |
STDIO,echo=0 \ | |
PTY,echo=0,link="$tempfile" | |
) & | |
# Run gpsd in read-only mode and have it take the GPS data from the pty | |
gpsd -b "$tempfile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment