Gpredict and GPSD

I’ve gotten the git version of gpredict compiled with gpsd support built in but it’s complaining in the log file

“qth_data_update_init: Unsupported gpsd api major version (6)”

I have gpsd 3.17 and it’s working just fine with my gps.

Is this a user fixable problem i.e can I “fool” it into working or is a code change required.

Thanks

Dave - VE3NNW

Sorry, no. It needs code update.

I have same error and fixed this error for libgps 3.17.
Patch is as floowsa.

Satoshi

*** qth-data.c.org 2020-03-04 14:03:02.340545844 +0900
— qth-data.c 2020-03-05 08:56:45.554185002 +0900
*************** gboolean qth_data_update(qth_t * qth, gd
*** 472,477 ****
— 472,532 ----
}
if (gps_read(qth->gps_data) == 0)
{

  •                 /* handling packet_set inline with
    
  •                    http://gpsd.berlios.de/client-howto.html
    
  •                  */
    
  •                 if (qth->gps_data->set & PACKET_SET)
    
  •                 {
    
  •                     if (qth->gps_data->fix.mode >= MODE_2D)
    
  •                     {
    
  •                         if (qth->lat != qth->gps_data->fix.latitude)
    
  •                         {
    
  •                             qth->lat = qth->gps_data->fix.latitude;
    
  •                             retval = TRUE;
    
  •                         }
    
  •                         if (qth->lon != qth->gps_data->fix.longitude)
    
  •                         {
    
  •                             qth->lon = qth->gps_data->fix.longitude;
    
  •                             retval = TRUE;
    
  •                         }
    
  •                     }
    
  •                     if (qth->gps_data->fix.mode == MODE_3D)
    
  •                     {
    
  •                         if (qth->alt != qth->gps_data->fix.altitude)
    
  •                         {
    
  •                             qth->alt = qth->gps_data->fix.altitude;
    
  •                             retval = TRUE;
    
  •                         }
    
  •                     }
    
  •                     else
    
  •                     {
    
  •                         if (qth->alt != 0)
    
  •                         {
    
  •                             qth->alt = 0;
    
  •                             retval = TRUE;
    
  •                         }
    
  •                     }
    
  •                 }
    
  •             }
    
  •         }
    
  • #endif
  •         break;
    
  •   case 6:
    
  • #if GPSD_API_MAJOR_VERSION==6
  •         while (gps_waiting(qth->gps_data, 0) == 1)
    
  •         {
    
  •             /* see comment from above */
    
  •             /* hopefully not needed but does not hurt anything. */
    
  •             num_loops++;
    
  •             if (num_loops > 1000)
    
  •             {
    
  •                 retval = FALSE;
    
  •                 break;
    
  •             }
    
  •             if (gps_read(qth->gps_data) > 0)
    
  •             {
                    /* handling packet_set inline with
                       http://gpsd.berlios.de/client-howto.html
                     */
    

*************** gboolean qth_data_update_init(qth_t * qt
*** 603,608 ****
— 658,686 ----
g_free(port);
#endif
break;

  • case 6:
    
  • #if GPSD_API_MAJOR_VERSION==6
  •     /* open the connection to gpsd and start the stream */
    
  •     qth->gps_data = g_try_new0(struct gps_data_t, 1);
    
  •     port = g_strdup_printf("%d", qth->gpsd_port);
    
  •     if (gps_open(qth->gpsd_server, port, qth->gps_data) == -1)
    
  •     {
    
  •         free(qth->gps_data);
    
  •         qth->gps_data = NULL;
    
  •         sat_log_log(SAT_LOG_LEVEL_ERROR,
    
  •                     _("%s: Could not open gpsd at  %s:%d"),
    
  •                     __func__, qth->gpsd_server, qth->gpsd_port);
    
  •         retval = FALSE;
    
  •     }
    
  •     else
    
  •     {
    
  •         (void)gps_stream(qth->gps_data, WATCH_ENABLE, NULL);
    
  •         retval = TRUE;
    
  •     }
    
  •     g_free(port);
    
  • #endif
  •     break;
    default:
        sat_log_log(SAT_LOG_LEVEL_ERROR,
                    _("%s: Unsupported gpsd api major version (%d)"),
    

*************** void qth_data_update_stop(qth_t * qth)
*** 639,648 ****
switch (GPSD_API_MAJOR_VERSION)
{
case 4:
! gps_close(qth->gps_data);
! break;
case 5:
gps_close(qth->gps_data);
break;
default:
break;
— 717,735 ----
switch (GPSD_API_MAJOR_VERSION)
{
case 4:
! #if GPSD_API_MAJOR_VERSION==4
! gps_close(qth->gps_data);
! #endif
! break;
case 5:

  • #if GPSD_API_MAJOR_VERSION==5
  •       gps_close(qth->gps_data);
    
  • #endif
  •       break;
    
  •   case 6:
    
  • #if GPSD_API_MAJOR_VERSION==6
    gps_close(qth->gps_data);
  • #endif
    break;
    default:
    break;
2 Likes

If you already have github account (I don’t encourage it), it may be better to open an issue or pull request here: https://github.com/csete/gpredict

No, I do not have github account yet. I will create the account and do it this week end.
But I uploaded “qth-data.c” (need thsi file only) on my web site. Also, I uploaded the executabule binary file (rasbian buster for libgps 3.17).

see
http://www.ariss.jp/software/

Satoshi Yasuda, 7m3tjz

2 Likes

Please use the markdown (MD) code tags when pasting source code. Start a code block with three backtics (`) and end a code block with three of them. Like:

int
main(int argc, char *argv)
{
    return 0;
}

All the best,
Patrick

2 Likes

SatoshYasudai: I tested your patch on a PI4, it works! Thank You!!

I didn’t see a pull request on github from you, so I created one with your modified file:

Hopefully that is OK with you!
Thanks again