#!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/files/gpsd.init,v 1.6 2007/06/11 03:04:29 nerdboy Exp $ # You can use this init script to manage a serial port GPS or other # non-hotplug device (or any device for that matter). By design, # USB devices should use the hotplug script instead. source /etc/conf.d/f3507g 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/gpsd." return 1 fi } start() { checkconfig || return 1 ebegin "Starting gpsd" touch /var/run/gpsd.pid /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" /usr/sbin/gpsd ${GPSD_OPTS} ${GPS_DEV} eend $? "Failed to start gpsd" } stop() { ebegin "Stopping gpsd" killall -q gpsd >/dev/null eend $? "Failed to stop gpsd" /usr/sbin/chat -v "" "AT*E2GPSCTL=0,1,0" "OK" > $CONTROL_DEV < $CONTROL_DEV eend $? "Failed to turn gps off" rm -f /var/run/gpsd.pid }