[Top][All Lists]

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

Re: [gpsd-dev] Example code for libgps using shared memory

From: David Huichen Dai
Subject: Re: [gpsd-dev] Example code for libgps using shared memory
Date: Thu, 9 Nov 2017 13:27:06 +0800

Hi Gary,

Thanks for your reply.
I uninstalled the gpsd (3.9) from my computer, which were installed by the sudo apt-get install commands.
Next based on your instructions, I cloned the source code using:
git clone

and install using:
scons && scons check && sudo scons udev-install

Now I have the latest version of gpsd
address@hidden:~$ gpsd -V
gpsd: 3.18~dev (revision release-3.17-21-g7e7c547)

Then I ran xgps, and it got a good fix.
I also captured packets on the loopback interface and found that xgps uses the socket to talk to gpsd because there were traffic to or from port 2947.

Afterwards, I compiled and ran the code you sent to me in your last email.
However, I got nothing at the terminal, not even the "no GPS data available".
I uninstalled and re-installed the gpslib-dev (with sudo apt-get commands), still the same result.

One more strange thing is, when I ran the code using socket to talk to gpsd, 
I could not get the coordinates either.

What do you think is the possible problem?

Thanks a lot~

On Thu, Nov 9, 2017 at 2:46 AM, Gary E. Miller <address@hidden> wrote:
Yo David!

On Wed, 8 Nov 2017 21:12:46 +0800
David Huichen Dai <address@hidden> wrote:

> Below is my code. However, I am unable to obtain the coordinates. How
> do I achieve this?

Your code was corrupted by your emai client.  I cleaned it up, fixed
a warning.  Works for me.  See attached.

My gpsd is built locally from git head.

My gpsd is started this way: gpsd -n /dev/ttyS0

cgps says I have a good fix.

Here is how I built and ran it.  Sorry for the run together:

# gcc test.c -lgps -o test
# ./test
latitude: 44.068688, longitude: -121.314101, speed: 0.392819,
timestamp: 1510166605.000000


Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin

David Huichen Dai, PhD
Research assistant
Lab of Broadband Network Switching Technology and Communication
Dept. of Computer Science and Technology
Tsinghua University, Beijing, P.R. China, 100084
Tel: 86-010-6277-3441
Email: address@hidden; address@hidden

reply via email to

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