|
From: | Hans Kurscheidt |
Subject: | GPSD Service: open SHM data only after cgps start |
Date: | Thu, 4 Feb 2021 19:59:51 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
Hi@All,
I'm Hans, German Engineer, retired, living in France. This is my 1st post, here.
Running GPSD 3.16 on an SunxI H2+ OrangePi-Zero under Debian
Jessie. Couldn't get anything newer for this distribution.
I use a CPP thread to open and collect GPS data via the gpsd.service.
-------------------
void *gps_get(void *threadid) {
struct gps_data_t gps_data;
if ((gps_open(GPSD_SHARED_MEMORY, NULL,
&gps_data)) == -1) {
printf("code: %d, reason: %s\n", errno,
gps_errstr(errno));
exit(-1);
}
while (1) {
if ((gps_read(&gps_data)) == -1) {
printf("error occured reading gps data. code:
%d, reason: %s\n", errno, gps_errstr(errno));
}
else {
if ((gps_data.status == STATUS_FIX) &&
gps_data.fix.mode == MODE_3D) {
... read data from gps_data
}
else {
printf("no GPS data available\n");
}
}
sleep(1);
}
gps_close(&gps_data);
-------------------------
Everything works fine, as long as I start e.g. cgps before my
application;( Once opened, I can close it). If I don't start cgps,
the open statement in my app executes w/out error, but the
subsequent gps_read fails w/ Error 88 "unknown Error" forever. It
looks like the open statement does not really open the device?? It
also works, when I start cgps, while my app is already running for
a while. As soon as cgps runs, my app receives data too.
Any suggestions?
Best Regards
hk
[Prev in Thread] | Current Thread | [Next in Thread] |