[maemo-users] access gps on N810

From: Andrew Daviel advax at triumf.ca
Date: Sat Mar 22 23:15:15 EET 2008
On Tue, 18 Mar 2008, Udayan Kumar wrote:

> Hi Andrew,
> I saw you mail in the maemo mailing list about reading the GPS directly. I am 
> also trying to do the same but i am still not successful. Just wanted to know 
> if you have figured out a way to do it.


#include <gpsbt.h>
#include <errno.h>
int main(int argc, char *argv[]) {
   int t = 0 ; if (argc > 1) sscanf(argv[1],"%d",&t) ;
   char error_buf[100] ; gpsbt_t ctx = {0} ; /* must clear ctx! */
   printf("start GPS..") ;
   if (gpsbt_start(NULL, 0, 0, 0, error_buf, 100, 0,  &ctx) ) {
     perror("gpsbt_start") ; printf("%s\n",error_buf) ;
   if (t>0) {
     printf ("sleep %d..\n",t) ;
     sleep(t) ;
     printf ("stop GPS ..\n") ;
     if (gpsbt_stop( &ctx) ) perror("gpsbt_stop") ;
need these libs :
gcc -g -o gpsonoff -lgpsbt -lgpsmgr -lgps gpsonoff.c

Still tinkering. Seems to leave it running on exit, then I can use cgps.
Or start with the program from howto_connectivity_guide instead of cgps 
(makes a gzipped logfile of position, sped etc.)

> Also in my case /usr/libexec/navicore-*gpsd*-helper is not giving out NMEA 
> sentences. do we need to do something else before navicore-gpsd-helper starts 
> emitting out NMEA?

Hmm, when I try now it doesn't, either. Not sure. Using gpsd is more 
elegant, anyway.

Andrew Daviel, TRIUMF, Canada
Tel. +1 (604) 222-7376  (Pacific Time)
Network Security Manager

More information about the maemo-users mailing list