summaryrefslogtreecommitdiff
path: root/www/faq.html
blob: dcee3c0fd3e2869987c5b4fd7f4721bff8d11fe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="Eric S. Raymond">
   <meta name="Description" content="GPSD Frequently Asked Questions">
   <meta name="Keywords" content="GPS, translator, GIS">
   <link rel="stylesheet" href="main.css" type="text/css"/>
   <title>GPSD FAQ</title>
</head>
<body>

<div id="Header">
GPSD Frequently Asked Questions
</div>

<div id="Menu">
    <img src="gpsd-logo-small.png"/><br />
    <a href="index.html">Home</a><br/>
    <a href="index.html#news">News</a><br/>
    <a href="index.html#downloads">Downloads</a><br/>
    <a href="index.html#mailing-lists">Mailing lists</a><br/>
    <a href="index.html#documentation">Documentation</a><br/>
    FAQ<br/>
    <a href="xgps-sample.html">Screenshots</a><br/>
    <a href="index.html#recipes">Recipes</a><br/>
    <a href="index.html#others">Other GPSDs</a><br/>
    <a href="hardware.html">Hardware</a><br/>
    <a href="for-vendors.html">For GPS Vendors</a><br/>
    <a href="wishlist.html">Wish List</a><br/>
    <a href="hall-of-shame.html">Hall of Shame</a><br/>
    <a href="hacking.html">Hacker's Guide</a><br/>
    <a href="protocol-transition.html">Application Compatibility</a>
    <a href="references.html">References</a><br/>
    <a href="history.html">History</a><br/>
    <a href="future.html">Future</a><br/>

    <div>&nbsp;</div>

    <a href='http://www.catb.org/hacker-emblem/'><img
    src='http://www.catb.org/hacker-emblem/glider.png'
    alt='hacker emblem' /></a><br />

    <script type="text/javascript" src="http://www.ohloh.net/p/3944/widgets/project_thin_badge.js"></script>

    <hr/>
    <script type="text/javascript"><!--
    google_ad_client = "pub-1458586455084261";
    google_ad_width = 160;
    google_ad_height = 600;
    google_ad_format = "160x600_as";
    google_ad_type = "text";
    google_ad_channel = "";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    <hr/>

    <a href="http://validator.w3.org/check/referer"><img
          src="http://www.w3.org/Icons/valid-xhtml10"
          alt="Valid XHTML 1.0!" height="31" width="88" /></a>
</div>

<div id="Content">

<ul>
<li><a href='#bug-reporting'>How do I report bugs in GPSD?</a><br/>
<li><a href='#nodata'>I get no data from my GPS</a></h1>
<li><a href='#timelag'>Why does GPS time lag wall time by 11-15 seconds?</a></li>
<li><a href='#speed'>Why does my receiver report wildly fluctuating speed?</a><br/>
<li><a href='#gpsdrive'>Why do I get implausibly low speeds when using gpsdrive?</a><br/>
<li><a href='#kismet'>Why do I get no results when I try to use <code>gpsd</code> with Kismet?</a><br/>
<li><a href='#bluetooth'>Why do I have to restart <code>gpsd</code> whenever I power-cycle my Bluetooth device?</a><br/>
<li><a href='#lockup'>My <code>gpsd</code> sometimes stops responding overnight</a><br/>
<li><a href='#why_not_parse_nmea'>Why use the <code>gpsd</code> protocol rather than parsing raw NMEA?</a><br/>
<li><a href='#interfacing'>How should  I interface my application with <code>gpsd</code>?</a><br/>
<li><a href='#agps'>Can GPSD work use Assisted GPS data from cellphone networks?</code>?</a><br/>
<li><a href='#accuracy'>How can I improve fix accuracy from my GPS?</a><br/>
<li><a href='#time'>How can I improve time reference accuracy from my GPS?</a><br/>
<li><a href='#sleep'>Why does my GPS get lost when I sleep/wake my laptop?</a><br/>
<li><a href='#web'>How do I get gpsd data into a web page?</a><br/>
</ul>

<h1 id='bug-reporting'>How do I report bugs in GPSD?</h1>
<blockquote>
<p>When you have a problem with gpsd, here are some steps you can take to
help get your bug resolved as quickly as possible.</p>

<h3>1. Read this whole FAQ first</h3>

<p>First, read this whole FAQ before reporting apparent misbehavior as a
bug.  You may find a solution here.</p>

<h3>2. Make sure it's not a problem with your toolchain or OS</h3>

<p>See our page on <a href='upstream-bugs.html'>upstream bugs</a>.</p>

<h3>3. Make sure it's not a problem in your client software</h3>

<p>Make sure it is a real gpsd bug and not a problem with
your client software.  A good way to do this is to run your client and
the gpsd test client (xgps) side by side.  If xgps seems to report
good numbers but your client does not, you have a client problem.
If xgps reports the same sort of bad numbers as your client, you
have a real <code>gpsd</code> bug.</p>

<h3>4. Check the latest version of <code>gpsd</code> for the bug.</h3>

<p>If you are using an old version of <code>gpsd</code>, it is
possible your bug has already been fixed.  Download the latest public
version from the <a
href='http://developer.berlios.de/projects/gpsd/'>project page</a> and
test it.  To be really helpful, check out the <a
href='https://developer.berlios.de/git/?group_id=2116'>git
head</a> and test that.  We don't mind getting bug reports that say 
"I saw version foo had the following bug, but you've fixed it."</p>

<h3>5. Capture a log that triggers the problem</h3>

<p>If we can reproduce your gpsd problem, we can usually fix it very
rapidly.  If we can't reproduce it, you might get lucky or you might
not &mdash; and we try hard, but all too often the result is 'not'.</p>

<p>Therefore the most important step you can take is to capture a log
of some receiver output that reproduces the bug; <code>gpscat</code> will
help you.</p>

<h3>6. Trim the capture log that reproduces the problem</h3>

<p>Your next step should be to feed the log you just captured to a
<code>gpsd</code> instance through <code>gpsfake</code> to verify that
the log does in fact reproduce the bug.</p>

<p>Once you have the log, trim it to the smallest span of data that
reproduces the bug.  A systematic way to do this is to cut the log in
half at the middle and test each half.  If one half doesn't reproduce
the bug but the other does, throw away the half that doesn't.  Repeat
this procedure on each half that tickles the bug until you can't make
it any smaller.  Then send us that.</p>

<p>If possible, use the -l option of gpsfake to pin down the sentence
or packet that produces the bug, and tell us that.</p>

<h3>7. Look at <code>gpsd</code> log output to see if it gives you a clue</h3>

<p>You may get a better handle on your problem by running gpsd in
foreground (-N option) with the -D option set to a high level (-D 5 is
often good).  If the transcript has anything that looks like a clue
in it, send it along with your bug report.  When in doubt about
whether it holds a clue, send it.</p>

<p>One of the things this should tell you, if the chip reports it at
all, is the firmware version.  You will want that for your report.</p>

<h3 id="logformat">8. Annotate the capture log and send us a copy</h3>

<!-- Note: his is also linked on the hardware page -->
<p>We'll describe the annotation steps here for completeness, but the
easiest way to do this is with <a
href="https://www.mainframe.cx/cgi-bin/gps_report.cgi">our web
form</a>

<p>A logfile should consist of an identifying header followed by a
straight unencoded dump of receiver data, whether NMEA or binary. The
header should consist of text lines beginning with # and ending with LF.
Here is the beginning of one log file I already have:</p>

<pre>
# Name: Magellan eXplorist 210
# Chipset: unknown
# Submitted-by: "Paul B van den Berg" <paulberg@wanadoo.nl>
# Date: 20 May 2006
# Location: Groningen, NL, 53.2N 6.6E
#
# mode V2.1 GSA
# Lines up to but not including the first GPGLL are
# `cat /dev/ttyACM0` at startup 
# Following lines are
# `cat /dev/ttyACM0` stationary
$GPGSV,3,1,00,,,,,,,,,,,,,,,,*7B
$GPGSV,3,2,00,,,,,,,,,,,,,,,,*78
$GPGSV,3,3,00,,,,,,,,,,,,,,,,*79
$PMGNST,01.75,3,F,816,11.1,+00000,20*5E
$GPGSV,3,1,00,,,,,,,,,,,,,,,,*7B
$GPGSV,3,2,00,,,,,,,,,,,,,,,,*78
$GPGSV,3,3,00,,,,,,,,,,,,,,,,*79
$PMGNST,01.75,3,F,816,11.1,+00000,20*5E
$GPGSV,3,1,00,,,,,,,,,,,,,,,,*7B
$GPGSV,3,2,00,,,,,,,,,,,,,,,,*78
$GPGSV,3,3,00,,,,,,,,,,,,,,,,*79
$PMGNST,01.75,3,F,822,11.2,+00000,20*5A
$GPGSV,3,1,00,,,,,,,,,,,,,,,,*7B
$GPGSV,3,2,00,,,,,,,,,,,,,,,,*78
$GPGSV,3,3,00,,,,,,,,,,,,,,,,*79
$PMGNST,01.75,3,F,822,11.2,+00000,20*5A
$GPGSV,3,1,12,09,76,287,,17,38,073,36,26,34,163,,05,33,230,*72
$GPGSV,3,2,12,29,27,161,,18,24,256,,22,24,299,,28,11,055,*73
$GPGSV,3,3,12,14,08,319,,11,03,017,,30,02,232,,24,00,084,*71
$PMGNST,01.75,3,F,822,11.2,-00673,20*5E
$GPGLL,5313.2228,N,00634.4228,E,200619.295,A*35
$GPGGA,200619.30,5313.2228,N,00634.4228,E,1,05,2.6,00000,M,,,,*2C
$GPRMC,200619.30,A,5313.2228,N,00634.4228,E,00.0,000.0,200506,00,W*59
$GPGSA,A,3,26,05,22,09,18,,,,,,,,05.1,02.6,04.4*03
$GPGSV,3,1,10,09,78,288,39,17,38,071,,05,34,230,45,26,33,163,39*77
$GPGSV,3,2,10,29,26,162,,18,24,255,42,22,24,298,44,28,10,056,*75
$GPGSV,3,3,10,14,09,319,,11,03,016,,136,27,157,,124,28,162,*71
</pre>

<p>The way to fill in the Name, Submitted-by, and Date
headers should be pretty obvious.</p>

<p>Chipset should include the name and (if possible) model and/or
firmware revision  of the chipset in the GPS.</p>

<p>Please also include a Location header giving your city,
state/province, country code, and a rough latitude/longitude.</p>

<p>A log file is most useful when it contains (a) some sentences 
generated when the GPS has no fix, (b) some sentences representing
a fix with the GPS stationary, and (c) some sentences representing
a fix with the GPS moving.</p>

<p>If you have notes or comments on the logfile or the GPS, or any
additional information you think might be helpful, add them as
additional # comments (not containing a colon) after these headers.
The test machinery that interprets the headers will ignore these and
any empty comment lines.</p>

<h3>9. If it's a dual-mode GPS, see if the problem reproduces in NMEA mode</h3>

<p>If you're using a SiRF, Evermore, iTalk or u-blox GPS in binary mode
(which you can tell from the -D 4 output), switch back to NMEA mode
using the N command (or a vendor-provided tool) and see if the bug is
still reproduceable.</p>

<h3>10. If your bug core-dumps gpsd, send us a stack trace.</h3>

<p>Though it happens seldom (and we had 2 report since about mid-2005),
badly-formed input from a device with poor standards compliance has been
known to core-dump gpsd.  If your gpsd has core-dumped, try to use gdb
or whatever your local symbolic debugger is to generate a stack trace
("bt full") of the crash, and send us that.</p>

<h3>11. Try to determine what release introduced the bug</h3>

<p>If you have upgraded from a previous version of <code>gpsd</code>,
and the upgrade broke something that was working previously, the
most useful thing you can do is pin down the release in which the
bug was introduced.</p>

<p>How efficiently you can do this depends on whether or not you have
a client for the the git version control system.  If you don't, all
you can do is download and test named releases.  If you do, you can
pin down the exact change that introduced the bug.  The latter is
far more helpful to us and will get your bug fixed faster, so we'll
describe that procedure here.</p>

<ol>
<li><p>Follow <a
href='http://developer.berlios.de/git/?group_id=2116'>these
instructions</a> to check out a copy of the software.</p></li>

<li><p>Use <a
href="http://www.kernel.org/pub/software/scm/git/docs/git-bisect.html">git
bisect</a> to locate the exact revision that introduced your bug.
This will happen very quickly, as the number of tests required will be
the log to the base 2 of the number of revisions in your original
span.  Even if there are (say) 500 revisions in the span you should
only require 9 tests to nail down the exact change in
question.</p></li>
</ol>

<h3>12. Include the vendor, mode, and firmware version in your report.</h3>

<p>Always include with your bug report the receiver vendor and model.  Try
to include the firmware version as well.  This should be in your xgps
display if your device makes it available; in a form field before
2.35, or as the window title in 2.35 and later.  If the ID string is
too long to fit, let the daemon run for a few minutes and issue an "I"
command to it.  Alternatively, running the daemon at -D 4 may reveal
the version.</p>
</blockquote>

<h1 id="nodata">I get no data from my GPS</h1>

<p>This answer may apply if you have followed the Quick Start
procedure on the manual page but <code>gpsd</code> reports no data.</p>

<p>Check for the obvious thing &mdash; a disconnected or loose cable<
&mdash; first. Make sure you specified the device your GPS is
actually plugged into.</p>

<p>A good test to try is to run <b>gpscat(1)</b> on the device with
speed set to 4800, then 9600. Most devices will report NMEA text 
at one of these speeds; a few will report binary spewage. Either
is a good sign.  If yours reports no data at all, you probably
have some low-level system problem with serial or USB that you'll
need to fix before <code>gpsd</code> will operate.</p>

<para>USB GPSes actually emulate RS232 serial using converter chips.
Under Linux, the usbserial kernel module must be loaded for correct
operation of this class of device. Normally this module load should
happen automatically when the device activates, but if you don't
receive data check for it with <b>lsmod(1)</b>.</p>

<p>On Linux systems with module autoloading disabled or misconfigured,
it is possible you may need to load the module manually with a command
such as <code>sudo modprobe usbserial vendor=0×1a86
product=0×7523</code>.  Do not copy those hex numbers slavishly, they
are examples.  To get the right numbers, you will need to dig up the
vendor and product ID of your USB-serial converter device.</p>

<h1 id="timelag">Why does GPS time lag wall time by 11-15 seconds?</h1>

<p>Your GPS may have dropped its leap-second offset.  You can tell you
have this problem if your sentence timestamps look wrong at startup.
Wait 20 minutes or so; the lag should go away.</p>

<p>GPS satellites broadcast time using a clock without a leap-second
correction. They broadcast a leap-second correction once each complete
reporting cycle along with the satellite ephemerides; it's up to the
GPS firmware to add that correction to the time it puts in reports.
If your GPS has forgotten the current correction, you'll have to wait
until the next ephemerides message for it.</p>

<p>GPSes are supposed to retain the leap-second correction along with
the last fix in NVRAM when they power down, but we've observed that
many seem prone to occasionally drop this information. All you can do
is wait for the problem to resolve itself.</p>

<p>SiRF-based GPSes have a more specific timelag problem. 4800 is just
a bit too slow for SiRF binary at full flood; the device can actually
fail to ship all its reports before the next once-per-second fix,
producing an accumulating stall.  The symptom of this is sentence times that
look right at startup but gradually fall behind clock time.  To fix
this, bump your speed to 9600 or higher.</p>

<h1 id='speed'>Why does my receiver report wildly fluctuating speed?</h1>

<p>If your problem is wildly fluctuating speed reports on a SiRF,
switching on static navigation mode using <code>gpsmon</code>. Static
navigation mode will freeze your position if your speed is below 1.2
m/s for three seconds, and will begin updating your position again
when speed exceeds 1.4 m/s. This prevents multipath, weak signals, or
poor constellation geometry from dragging your solutions around too
much. Other receivers may suffer the same problem and may have a
similar solution.</p>

<h1 id='gpsdrive'>Why do I get implausibly low speeds when using gpsdrive?</h1>

<p>This is a gpsdrive bug, as you can verify by running
<code>xgps</code> alongside it.</p>

<h1 id='kismet'>Why do I get no results when I try to use <code>gpsd</code> with Kismet?</h1>

<p>Your Kismet configuration has to include the setting
"gps=true"  This is s a surprisingly easy detail to forget.</p>

<h1 id='bluetooth'>Why do I have to restart <code>gpsd</code> whenever I power-cycle my Bluetooth device?</h1>

<p>The Bluetooth stack returns 0 for a read from a missing device,
rather than -1, and doesn't set errno.  This is wrong and needs to be
fixed at OS level.</p>

<h1 id='lockup'>My <code>gpsd</code> sometimes stops responding overnight</h1>

<p>At one point in the development of <code>gpsd</code> we got a
report of the daemon ceasing to respond to queries when run for
more than a day or so; the user, quite reasonably, suspected some sort
of resource leak in the daemon.  On the other hand, other users reported
good operation over much longer periods with the same version of
the software. That suggests a bug at the level of the user's operating 
system or local site configuration.</p>

<p>Nevertheless, the possibility of a resource-leak bug alarmed us
enough that after 2.26 one of us (ESR) built an entire test framework
for auditing the code's dynamic behavior and used it to apply <a
href="http://valgrind.org">Valgrind</a>.  You can look at the
resulting script, valgrind-audit, in the source distribution.  This
turned up a couple of minor leaks, but nothing sufficient to explain
the report.</p>

<p>One of our senior developers, Rob Janssen, has seen
<code>gpsd</code> interact badly with overnight backups, pushing the
system load average through the roof.  He says: "when you copy many
gigabytes of data from disk to disk, the [Linux] kernel's buffer
management goes completely haywire. [...]  I think this is caused both
by allocation of many buffers for reading files, and by accumulation
of many dirty buffers that still have to be written.  At some point,
programs like gpsd (but also all interactive programs and the X
display manager) come to a complete standstill while the system is
swapping like mad."</p>

<p>If Rob's analysis is correct, <code>gpsd</code> is a canary in a
coal mine.  If your <code>gpsd</code> locks up after a long period of
operation, you should look at your logs and see if you can connect the
point at which it stopped responding to some kind of resource crisis 
brought on by lots of I/O activity.</p>

<p>Another thing to try is running <code>gpsd</code> under Valgrind overnight 
and seeing if it reports any leaks.</p>

<h1 id='why_not_parse_nmea'>Why use the <code>gpsd</code> protocol rather than parsing raw NMEA?</h1>

<p>Some applications that use <code>gpsd</code> start raw mode
and parse the NMEA directly.  This is not a good idea.</p>

<p>One problem with raw mode is that NMEA is a poorly specified
standard.  There are, for example, two different and incompatible
variants of GPVTG.  Another issue is that implementations vary as to
whether they leave fields they don't supply empty or fill them in with
a special value such as 0.0.  Interpretation of the different NMEA
status fields is a black art.</p>

<p>It is all too easy to write an NMEA parser that works well on one
variant but breaks on another, delivering subtly incorrect results or
even crashing your application.  Because <code>gpsd</code> specializes
in the job, we collect knowledge on all variants and do parsing that
is much less likely to get tripped up.</p>

<p>Another issue is that some of the reports your application would
like to have are not generated by all GPSes.  Estimated position error
in meters is the most obvious example; climb/sink is another.  When a GPS
doesn't supply these, <code>gpsd</code> can fill them in using the
same sorts of computation that more capable GPSes use.</p>

<h1 id='interfacing'>How should  I interface my application with <code>gpsd</code>?</h1>

<p>The <code>gpsd</code> package provides two ways for C code to get
data from a GPS or AIS receiver.  Both go through the libgps.a library,
which supports two sets of entry points. The <a
href="libgpsd.html">low-level interface</a> talks directly to the GPS.
The <a href="libgps.html">high-level interface</a> communicates with
an instance of <code>gpsd</code>, which uses its own copy of libgps.a
to talk to the device.</p>

<p>A third way would be to open a socket to <code>gpsd</code> and
interpret <code>gpsd</code> protocol or raw NMEA in your application.
Before 2.0, all <code>gpsd</code>-aware applications had to do this
because libgps.a didn't exist.  Now that it does, the exercise is
rather pointless.  Using libgps.a will probably simplify your code a
lot.</p>

<p>You will almost always want to use the high-level interface and go
through the daemon; among other things, this means more than one
application will be able to query the GPS without causing confusion.
The only exception will be in very space-constrained single-user
scenarios, perhaps on embedded systems or PDAs. On those it may be
appropriate to use the low-level interface directly, probably with a
build from source that conditions out all but one of the drivers.</p>

<p>For Python programmers, there is a gps.py module the high-level
interface.  It exports a class that encapsulates a GPS session.</p>

<h1 id='agps'>Can GPSD use Assisted GPS data from cellphone networks?</h1>

<p>Sadly, no. There are both hardware and software barriers to this.</p>

<p>Using AGPS would requires picking up and interpreting information
broadcast by cellphone towers, so it would at minimum need another
receiver (separate from the GPS mouse) operating in those frequency
bands. Of course, a cellphone has one of those built in. Standalone
GPS sensors don't.</p>

<p>There's another level of the problem, too. Supposing we had the
right sort of receiver, AGPS systems are carrier-dependent.  As far as
we know there aren't any published standards for the format of the
corrections.  So even if we had the signals, GPSD couldn't know what to
do with them.</p>

<h1 id='accuracy'>How can I improve fix accuracy from my GPS?</h1>

<p>Use an antenna, and place the sensor (and/or antenna) properly.</p>

<p>A real antenna can help, especially if you're using PPS as a time
reference. It should be particularly helpful for reducing timing
jitter.</p>

<p>One common error is to place the GPS or antenna as high as
possible.  This will increase <a
href="http://en.wikipedia.org/wiki/Global_Positioning_System#Multipath_effects">multipath
effects</a> due to signal bounce from the ground or water, which can
cause the GPS to mistake its position and the time signal.  The
correct location for a boat GPS antenna is on the gunwale rail or
pushpit rail, close to the water and as far from the mast as possible
(to reduce signal bounce from the mast). If
you're outside or in a fixed location, put the GPS antenna as far from
buildings as possible, and on the ground. If you're in a car, don't
put the GPS antenna on the roof, put it on the towbar or similar.</p>

<p>If you're driving in a heavily built up area, you're going to get
signal bounce off buildings and and reduced accuracy. That's just how
the physics works. Note, however, that as your velocity goes up it
becomes easier for the convergence filters in your GPS to spot
and discard delayed signal, so multipath effects are proprtionately
less important in fast-moving vehicles.</p>

<p>If you're using <tt>gpsd</tt> with software that plots your
position on a map, and you seem to be getting latitude/longitude that
is at a fixed offset from reality, it is possible the base datum of
the map is something other than the WGS84 GPS uses. A
frequently-occuring case of this is older maps in the United States
based on NAD27 (e.g., USGS topo maps); you may see a displacement of
as much as 100-150m with respect to WGS84.  While modern datums (e.g.,
NAD83) are almost all very close to WGS84, typically each area of
world has an older datum that only agrees at the 100m level.</p>

<h1 id='time'>How can I improve time reference accuracy from my GPS?</h1>

<p>All the measures you'd take to improve <a href="#accuracy">fix
accuracy</a> will help. Time referencing at accuracies below 
0.01sec has its own set of issues related to latency in your
sensor and computer.</p>

<p>In particular, USB transport is not suited for anything
time-related that requires sub-millisecond accuracy. If a
USB-connected GPS unit wants to tell the computer it's 12:23:45, it
will have to wait for the computer to poll it. This polling happens
1000 times per second, introducing variable latency averaging a
half-millisecond.  Furthermore, the USB chip might run at anything
close to 1000 Hz. If it runs at 1000.1 Hz, every 10th second the next
time-report will come 1 whole millisecond earlier. This will have NTP
observing something like a 1 ms high sawtooth in the time-reports.</p>

<p>For accurate time reference, use a PPS line over RS232 triggering an
interrupt. Serial bus interrupt latencies on modern hardware on the
order of 10 microseconds, roughly a hundred-fold impovement over
USB.</p>

<p>Don't confuse PPS with conventianal, non-PPS data transport over RS232;
the latency on that is much higher. At one character per ten bits
(counting framing at stopbits) a 9600-bps serial link introduces
about a millisecond of latency <em>per character</em>; both USB and
RS232 will incur that overhead.</p>

<h1 id='sleep'>Why does my GPS get lost when I sleep/wake my laptop?</h1>

<p>This is not a GPSD problem, but a result of the way Linux handles
USB serial devices.  In a default Linux configuration, USB serial
device name do not depend on which physical port you plug the
USB/serial adaptor, but on what order you plug devices in: 1st device
gets /dev/ttyUSB0, 2nd gets /dev/ttyUSB1, etc....

<p>This collides with what happens during a suspend/resume. If you
suspensd while <tt>gpsd</tt> has a device active, it will hold the
device open while your laptop is asleep - but, meanwhile, the suspend
logic is shutting down hotpluggable devices to be recreated at
resume time. On resume, Linux will see that the old device is open
<em>and recreate one with a different name</em>, leaving <tt>gpsd</tt>
kooking at a bad file descriptor.</p>

<p>There is a solution to this problem: create a stable gps-usb device
that is actually a symlink which gets modified by hotplug events, and
give <tt>gpsd</tt> that device when you invoke it.  You'll need <a
href="70-persistent-usb-gps.rules">these replacement udev rules</a>,
and the experience required to patch them so the vendor ID in the last
one matches your GPS hardware (look in your lsusb output).

<h1 id='web'>How do I get gpsd data into a web page?</h1>

<p>The <code>gpsd</code> source-code distribution now includes a PHP
script that makes this easy.  The script shows current fix data, a 
satellite view, and can even incorporate a Google Maps display
if you have a Google API key. Look at the end of the file INSTALL for
instructions.</p>

<p>Another way is to use a perl CGI script that leverages
Net::GPSD like this...</p>

<code><pre>
#!/usr/bin/perl -w
use strict;
use Net::GPSD;

my $g=new Net::GPSD;
my $p=$g->get;

print qq{
&lt;?xml version='1.0'?&gt;
&lt;Report xmlns:gml="http://www.opengis.net/gml"&gt;
  &lt;items&gt;
    &lt;Item&gt;
      &lt;ID&gt;35643563245&lt;/ID&gt;
      &lt;position&gt;
        &lt;gml:Point srsDimension="2"
srsName="urn:ogc:def:crs:EPSG:6.6:4326"&gt;
          &lt;gml:pos&gt;}. $p-&gt;lat. " ". $p-&gt;lon. q{&lt;/gml:pos&gt;
        &lt;/gml:Point&gt;
      &lt;/position&gt;
    &lt;/Item&gt;
  &lt;/items&gt;
&lt;/Report&gt;
};
&lt;/code&gt;
</pre></code>

<p>This will return something like:</p>

<code><pre>
&lt;?xml version='1.0'?&gt;
&lt;Report xmlns:gml="http://www.opengis.net/gml"&gt;
  &lt;items&gt;
    &lt;Item&gt;
      &lt;ID&gt;35643563245&lt;/ID&gt;
      &lt;position&gt;
        &lt;gml:Point srsDimension="2" srsName="urn:ogc:def:crs:EPSG:6.6:4326"&gt;
          &lt;gml:pos&gt;38.865960 -77.108624&lt;/gml:pos&gt;
        &lt;/gml:Point&gt;
      &lt;/position&gt;
    &lt;/Item&gt;
  &lt;/items&gt;
&lt;/Report&gt;
</pre></code>

</div>
<hr/>
<script language="JavaScript" src="datestamp.js" type='text/javascript'></script>
</body>
</html>
<!--
Local Variables:
compile-command: "(scp faq.html shell.berlios.de:/home/groups/gpsd/htdocs)"
End:
-->