gpsd-users
[Top][All Lists]
Advanced

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

Re: [gpsd-users] Problems getting GPGGA sentences


From: Eric S. Raymond
Subject: Re: [gpsd-users] Problems getting GPGGA sentences
Date: Fri, 18 Jan 2013 08:02:07 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Pablo Rodriguez Monetti <address@hidden>:
> The following is a simpler program that prints the NMEA sentences that are
> received. It works well, with the simulated and even with the real GPS. But
> if I uncomment the usleep() call, which makes the program to check the
> buffer once per second, client data buffer does not give reasonable results.

It's not clear to me why you expected it to do so.  You're not reading data
as fast as GPSD is writing it.  This can only lead to one of two outcomes:
(1) gpsd thinks the client has died and terminates the session, or 
(2) data gets lost because the system's socket buffers or the client-side 
packet buffers (or both) are overstuffed.

It might be possible to analyze in more detail why you're getting
garbage and repeated fragments in the client buffer, but there
wouldn't be much point to trying.  You've set up a no-win situation.
To get reasonable results, you need to either sample faster or reduce
the device's sending data rate.

What I would do in your shoes is perform your gpsd polling loop in a thread
with a mutex lock/release wrapping the read, then use the same mutex
to ensure that you only look at the client buffer while it's
quiescent.  If the PACKET_SET bit is on in gpsdata->set when the
buffer is quiescent, you know you have a whole packet to look at.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>



reply via email to

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