Multiple gpsd deamons on linux

View: New views
3 Messages — Rating Filter:   Alert me  

Multiple gpsd deamons on linux

by mkessler_sw :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am running gpsd 2.25 on a Linux 2.6.10 embedded system.  I start the deamon with "gpsd -D 255 -p /dev/ttyS1".  I have a 'C' application

        gpsdata = gps_open(server, port);
        rc = gps_query(gpsdata, "i\n");
        rc = gps_query(gpsdata, "o\n");
        if (rc == 0)
        {
            printf("latitude = %lf, long = %lf, alt = %lf, time = %lf, speed = %lf, mode = %d\n",
                   gpsdata->fix.latitude, gpsdata->fix.longitude, gpsdata->fix.altitude,
                   gpsdata->fix.time, gpsdata->fix.speed, gpsdata->fix.mode);
         }
         gps_close(gpsdata);

Every time I execute this function I get another deamon process running.  Does anyone know why this happens and how to prevent it?  You can see the multiple processes below.

1262 root       1652 S   /bin/bash --login
 1266 root        512 S   /sbin/dhcpcd-bin -h (none) -Y -N -R -t 200
 1352 root        540 S   telnetd -l /bin/autologin
 1353 root        636 S   /bin/sh /bin/autologin
 1354 root       1516 S   /bin/bash --login
 2396 nobody      988 S < gpsd -D 255 -p /dev/ttyS1
 2397 root        800 S   ./ControlApp
 2402 root        800 S   ./ControlApp
 2403 root        800 S   ./ControlApp
 2405 root        704 S   telnet localhost 8081
 2406 root       1060 S   ./ControlApp
 2407 nobody      988 S < gpsd -D 255 -p /dev/ttyS1
 2408 nobody      988 S < gpsd -D 255 -p /dev/ttyS1
 2410 nobody      988 S < gpsd -D 255 -p /dev/ttyS1
 2411 root        776 R   ps



Re: Multiple gpsd deamons on linux

by Gary E. Miller :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yo
Yo mkessler_sw!

On Fri, 6 Nov 2009, mkessler_sw wrote:

> I am running gpsd 2.25 on a Linux 2.6.10 embedded system.  I start the deamon
> with "gpsd -D 255 -p /dev/ttyS1".  I have a 'C' application

gpsd 2.25 is from 2005!  gpsd 2.39 is current.  Try a modern version.

RGDS
GARY
- ---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
        gem@...  Tel:+1(541)382-8588

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFK9LKuBmnRqz71OvMRArNiAJwM0gH3Nm4E90CMZs+GLD1jZUX6lACfW/Xq
nuNj3VMyoI8T3WxIzd5399M=
=bDCn
-----END PGP SIGNATURE-----

_______________________________________________
Gpsd-users mailing list
Gpsd-users@...
https://lists.berlios.de/mailman/listinfo/gpsd-users

Re: Multiple gpsd deamons on linux

by Eric S. Raymond-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

mkessler_sw <michael.kessler@...>:

>
> I am running gpsd 2.25 on a Linux 2.6.10 embedded system.  I start the deamon
> with "gpsd -D 255 -p /dev/ttyS1".  I have a 'C' application
>
>         gpsdata = gps_open(server, port);
>         rc = gps_query(gpsdata, "i\n");
>         rc = gps_query(gpsdata, "o\n");
>         if (rc == 0)
>         {
>             printf("latitude = %lf, long = %lf, alt = %lf, time = %lf, speed
> = %lf, mode = %d\n",
>                    gpsdata->fix.latitude, gpsdata->fix.longitude,
> gpsdata->fix.altitude,
>                    gpsdata->fix.time, gpsdata->fix.speed,
> gpsdata->fix.mode);
>          }
>          gps_close(gpsdata);
>
> Every time I execute this function I get another deamon process running.

I don't know why you're spawning a daemon each time, but this code
is wrong in at least two ways and dubious in another.  

You shouldn't be using gps_query() at all, and you especially
shouldn't be using it ship old-style commands like 'i' and 'o'.  Here
are the problems:

1. 'i' and 'o' are obsolete. They'll still be supported in the upcoming 2.40
and for a couple of releases after, but you're setting yourself up for trouble
when we drop the old wire protocol.

2. Even if they weren't obsolete, they make you vulnerable to a race condition.
The device may not be initialized or have acquired satellite lock by the time
those command arrive, in which case you'll get a spuriously empty response

3. Using gps_query() exposes your code to the wire protocol and is a bad idea.

What you should do is grab a copy of trunk and rewrite using libgps and,
in particular, the gps_stream() function.
--
                <a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
_______________________________________________
Gpsd-users mailing list
Gpsd-users@...
https://lists.berlios.de/mailman/listinfo/gpsd-users