gpsd-users
[Top][All Lists]
Advanced

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

Re: [gpsd-users] unknown error on opening gps


From: Carlo Lobrano
Subject: Re: [gpsd-users] unknown error on opening gps
Date: Sun, 20 Sep 2015 16:12:17 +0000

Hi Michael,

I think that you just need to allocate memory for your gpsdata struct.
For this Simple code that will do:

struct gps_data_t gpsdata; // no *

Just remember use the address of gpsdata to the various functions (&gpsdata)

Best regards,
Carlo


Il giorno dom 20 set 2015 07:50 AM Michael Aschauer <address@hidden> ha scritto:

I am trying to re-compile and run an older project on a new system and I
am running into an issue with libgps returning unknown error on opening
the device.
I am on Debian 8.0 with gpsd/libgps 3.11. The same code runs without an
issue on a range of older debian and ubuntu systems.
Also the gpsclient samples (gpsmon, gpslogger) seem to work - at least
open the device - quite fine.

Does anyone have a hint on what could be wrong here?

Here is brief example code snippet

<code>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#include <gps.h>

int main()
{
        struct gps_data_t *gpsdata;

        printf("Opening GPS....\n");

        int ret  = gps_open(NULL,NULL, gpsdata);
        if (ret != 0) {
                printf("gpsopen returned: %d\n",ret);
                printf("errno: %d\n",errno);
                printf("%s\n",gps_errstr(errno));
        } else {
                printf("success\n");
                gps_close(gpsdata);
        }
        return 0;

}
</code>

and this is what it returns for me:

$ ./gps-test
Opening GPS....
gpsopen returned: -1
errno: 0
unknown error


thanks & best regards,
m,-



reply via email to

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