gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

open SHM data only after cgps start


From: Hans Kurscheidt
Subject: open SHM data only after cgps start
Date: Fri, 5 Feb 2021 11:33:50 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

update,

OK I'm back to my original problem.

Just to be clear, here the systemctl outputs:

gpsd.service - GPS (Global Positioning System) Daemon
   Loaded: loaded (/etc/systemd/system/gpsd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-02-05 10:43:42 CET; 43min ago
 Main PID: 2873 (gpsd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/gpsd.service
           └─2873 /usr/sbin/gpsd -N /dev/ttyACM0

Feb 05 10:43:42 orangepizero systemd[1]: Started GPS (Global Positioning System) Daemon.
hk@orangepizero:~$ systemctl status gpsd.socket
● gpsd.socket - GPS (Global Positioning System) Daemon Sockets
   Loaded: loaded (/etc/systemd/system/gpsd.socket; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-02-05 10:27:18 CET; 59min ago
   Listen: /run/gpsd.sock (Stream)
           [::1]:2947 (Stream)
           127.0.0.1:2947 (Stream)

And here the code I'm using:

if ((gps_open(GPSD_SHARED_MEMORY, NULL, &gps_data)) == -1) {
        printf("code: %d, reason: %s\n", errno, gps_errstr(errno));
        exit(-1);
    }
    while (1) {
        int rv = gps_read(&gps_data, NULL, 0);
            if (rv == -1)
            {
                printf("error occured reading gps data. code: %d, reason: %s\n", errno, gps_errstr(errno));
            }
            else {
                if ((gps_data.fix.status == STATUS_FIX) && gps_data.fix.mode == MODE_3D) {

                    sens_buf.SoG = (gps_data.fix.speed > 10) ? gps_data.fix.speed * 3.6 : 0;
   ...etc
                }
                else {
                    printf("no GPS data available\n");
                    sens_buf.gps_avail = 0;
                }
            }
        sleep(1);
    }

There's no data, no error and rv from gps_read is always 0.

The difference from 3.16 is, that running cgps from command line in parallel does not help.

RGDS

hk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]