AW: gpsd and as-needed patches

Vlatko Kosturjak kost at
Thu Jul 21 08:31:24 UTC 2011

Hello Andreas!

On 07/21/2011 09:54 AM, Andreas.Eversberg wrote:
> hi vlatko,
> thanx for your patches. i don't have knowledge about gpsd api. before i
> can apply them, i need to know about gps_waiting() function.
> the osmo_gpsd_cb() function in common/gps.c is called when there is data
> to be read from gpsd. this function (like any other function) may not
> delay or block. (except for the CPU processing time of the function.) if
> no data is available from gpsd, the function must continue with "goto
> gps_not_ready;" immidately.
> what will gps_waiting() do in case there is no (complete) information
> available?

Understand. What I found in the documentation is following:
"...gps_waiting() can be used to check whether there is data from the
daemon. The second argument is the maximum amount of time to wait (in
microseconds) on input before returning. It returns true if there input
waiting, false on timeout (no data waiting) or error condition. This
function is a convenience wrapper around a select(2) call, and zeros
errno on entry; you can test errno after exit to get more information
about error conditions. Note that choosing a wait timeout of less than
twice the cycle time of your device will be hazardous, as the receiver
probably will not supply input often enough to prevent a spurious error
indication. For the typical 1-second cycle time of GPSes this implies a
minimum 2-second timeout..."

Since they recommend minimum of 2-second timeout, I have done this way.
Since they did not define "hazardous", I experimented with lower
timeouts and it's possible to set it without any "hazardous?" effects.
Still I don't know what happens if timeout is set to 0 and documentation
doesn't say anything (as I understand 0 will be desired). Will try to
make small test program and let you know.


More information about the baseband-devel mailing list