Skip to content

Instantly share code, notes, and snippets.

@worldeater
Created December 20, 2013 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save worldeater/8049555 to your computer and use it in GitHub Desktop.
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.
#! /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