diff options
Diffstat (limited to 'app-laptop/f3507g-initd/files/f3507g-gpsd.initd')
-rw-r--r-- | app-laptop/f3507g-initd/files/f3507g-gpsd.initd | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app-laptop/f3507g-initd/files/f3507g-gpsd.initd b/app-laptop/f3507g-initd/files/f3507g-gpsd.initd new file mode 100644 index 0000000..9b7c0bd --- /dev/null +++ b/app-laptop/f3507g-initd/files/f3507g-gpsd.initd @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +depend() { + after serial hotplug dbus bluetooth + need f3507g + before ntpd +} + +checkconfig() { + if [ -z "${GPS_DEV}" ] || [ -z "${CONTROL_DEV}" ] + then + eerror "You must define GPS_DEV and CONTROL_DEV in /etc/conf.d/f3507g-gpsd." + return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Turning on F3507g gps device" + /usr/sbin/chat -v "" "AT*E2GPSCTL=1,3,1" "OK" > ${CONTROL_DEV} < ${CONTROL_DEV} + /usr/sbin/chat -v "" "AT*E2GPSNPD" "GPGGA" > ${GPS_DEV} < ${GPS_DEV} + eend $? "Failed to turn gps on" + ebegin "Starting gpsd" + start-stop-daemon --start --quiet --exec /usr/sbin/gpsd \ + -- ${GPSD_OPTS} + eend $? "Failed to start gpsd" +} + +stop() { + ebegin "Stopping gpsd" + start-stop-daemon --stop --quiet --pidfile /var/run/gpsd.pid + eend $? "Failed to stop gpsd" + rm -f /var/run/gpsd.pid + ebegin "Turning off F3507g gps device" + /usr/sbin/chat -v "" "AT*E2GPSCTL=0,1,0" "OK" > ${CONTROL_DEV} < ${CONTROL_DEV} + eend $? "Failed to turn gps off" +} |