I wanted something simple, reliable, and fast to load and stop. So I cooked up a couple of shell scripts and desktop shortcuts to allow me to just press a button and get the Neo to log the GPS track on a file. The scripts take care of turning on the GPS receiver, avoiding suspension during logging, and putting the data in the right place. Enjoy, cut up, mash up, and otherwise use at will. :)
Requirements: gpspipe (opkg install gps-utils) *** Desktop file to turn on (/usr/share/applications/GpsLogOn.desktop): [Desktop Entry] Name=LogGps:1 Comment=Start GPS logging Encoding=UTF-8 Version=1.0 Type=Application Exec=/home/root/myScripts/log_gps_track.sh Icon=fixme Terminal=true SingleInstance=true StartupNotify=false *** Turn-on script (~myScripts/log_gps_track.sh): #!/bin/sh . $HOME/myScripts/om_suspend_functions.sh dir=$HOME/myData/Gps name=`date +Log_%y%m%d_%H%M%S.nmea` gps_power=/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/neo1973-pm-gps.0/pwron # wake up GPS hardware: echo 1 > $gps_power # tell ompower to keep from suspending while logging: request_power_state $name "keep_on" # automatically allow suspending after exit (no need for switching off GPS, suspend does that): cleanup() { echo "Stopped logging!"; sync; request_power_state $name "may_off"; exit 0; } trap cleanup KILL trap cleanup INT trap cleanup EXIT # start logging to file: echo Logging into $name gpspipe -r > $dir/$name # end. *** Helper function library for power management (~myScripts/om_suspend_functions.sh): #!/bin/sh request_power_state() { requester=$1 state=$2 if [ $state == "keep_on" ]; then echo "$requester is preventing OM from sleeping." dbus-send --system --dest=org.openmoko.Power / org.openmoko.Power.Core.RequestResourceState string:cpu string:$requester string:on elif [ $state == "may_off" ]; then echo "$requester is allowing OM to sleep." dbus-send --system --dest=org.openmoko.Power / org.openmoko.Power.Core.RemoveRequestedResourceState string:cpu string:$requester elif [ $state == "go_off" ]; then echo "$requester is forcing OM to sleep." dbus-send --system --dest=org.openmoko.Power / org.openmoko.Power.Core.RequestResourceState string:cpu string:$requester string:off else echo "Unknown power state requested ('$name', '$state'). Pick 'keep_on', 'may_off', or 'go_off'." fi } *** Desktop file to turn off: [Desktop Entry] Name=LogGps:0 Comment=Stop GPS logging Encoding=UTF-8 Version=1.0 Type=Application Exec=killall gpspipe Icon=fixme Terminal=true SingleInstance=true StartupNotify=false ******************************************** _______________________________________________ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community