gpsd-users
[Top][All Lists]
Advanced

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

Why might everything but the gpsd status be unpacked?


From: Jack Nadelman
Subject: Why might everything but the gpsd status be unpacked?
Date: Thu, 30 Apr 2020 10:46:42 -0400

I originally posted this message here a few days ago: https://stackoverflow.com/questions/61466219/why-might-everything-but-the-gpsd-status-be-unpacked

Using libgps.so.25.0.0 built from gpsd-3.19.tar.gz for aarch64-linux-gnu embedded Linux target, why might everything but the status (DGPS_FIX) be unpacked to (gps_data_t) m_gps_data during the gps_read?

int gps_bytes = gps_read( &m_gps_data, gpsd_msg, MAX_MSG_SIZE );

The status, mode, flags, etc. are visible in the libgps debug output

STATUS: status: 2 (DGPS_FIX)
MODE: mode: 3 (MODE_3D)
libgps: final flags: (0x5377c)
{TIME|TIMERR|LATLON|ALTITUDE|SPEED|CLIMB|STATUS|MODE|HERR|VERR|SPEEDERR|CLIMBERR}
libgps: gps_read() -> 270

and in the message (gpsd_msg) which is printed by my client

{"class":"TPV","device":"/dev/ttyACM0","status":2,"mode":3,"time":"2020-04-27T13:56:5
9.000Z","ept":0.005,"lat":26.343147000,"lon":-80.631992833,"alt":16.300,"epx":2.302,"
epy":2.153,"epv":7.878,"speed":0.004,"climb":0.000,"eps":4.60,"epc":15.76,"eph":3.990
,"sep":7.648}

but the m_gps_data.status (struct gps_data_t) seems to be the only thing that has not been unpacked.

PRINTF_2("gps_bytes %d status %d mode %d lat %g lon %g alt %g\n",
   gps_bytes, m_gps_data.status, m_gps_data.fix.mode, m_gps_data.fix.latitude,
   m_gps_data.fix.longitude, m_gps_data.fix.altitude);

(PRINTF_2 adds FILE, LINE, and func to printf)

nav_thread.cpp:277 (_thread_proc) - gps_bytes 270 status 0 mode 3 lat 26.3431 lon -80.632 alt 16.3

Building like this:

scons minimal=yes shared=True gpsd=False gpsdclients=False socket_export=yes clientdebug=yes
    target='aarch64-linux-gnu'

I am able to work around the issue by parsing the status from the message returned by gps_read and using that to set the gps_data_t status field like this

           if (STATUS_SET == (m_gps_data.set & STATUS_SET))
           {
              if (NULL != strstr(gpsd_msg, "\"status\":1"))
              {
                 PRINTF_("STATUS_FIX\n");
                 m_gps_data.status = STATUS_FIX;
              }
              else if (NULL != strstr(gpsd_msg, "\"status\":2"))
              {
                 PRINTF_("STATUS_DGPS_FIX\n");
                 m_gps_data.status = STATUS_DGPS_FIX;
              }

but this does not fix the root cause

Jack N

Virus-free. www.avg.com

reply via email to

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