summaryrefslogtreecommitdiff
path: root/www/bt.html
blob: aad5908e32b5df6172fa7b318ca30a85f2d76ea6 (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
<!DOCTYPE HTML>
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <meta name="Author" content="Eric S. Raymond">
   <meta name="Description" content="Blutooth setup instructions for GPSD">
   <meta name="Keywords" content="GPS, gpsd, bluetooth">
   <meta name="Revised" content="9 April 2015">
   <meta name="robots" content="index,follow">
   <link rel="stylesheet" href="main.css" type="text/css">
   <title>Bluetooth and GPSD</title>
</head>

<body>

<div id="Header">Bluetooth and <code>gpsd</code></div>

<div id="Menu">
    <img src="gpsd-logo-small.png" alt="Small gpsd Logo"><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>
    <a href="faq.html">FAQ</a><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="troubleshooting.html">Troubleshooting Guide</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>

    <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="https://www.openhub.net/p/3944/widgets/project_thin_badge.js"></script>

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

<div id="Content">

<p>Bluetooth connections work with <code>gpsd</code> by leveraging the
rfcomm serial port emulation.  Rfcomm provides a serial port interface
to a BT device and has been designed to allow for automated
connect/disconnect operations over Bluetooth.  The steps below will
allow you to use your BT GPS device automatically whenever it is
powered on and gpsd is running.</p>

<p>Note that you must be logged in as root for most of these steps.</p>

<h2>Installation</h2>

<p>If your system comes with Bluetooth tools preinstalled (look for
<img src="bt.png" alt="Bluetooth icon"> on your status bar) you can
probably skip these steps.</p>

<ol>
<li><p>First, the Bluez protocol stack must be installed.  All the
documentation can be found on <a
href='http://bluez.sourceforge.net/'>http://bluez.sourceforge.net/</a>.</p></li>
<li><p>Install bluetooth for your device with the "rfcomm" module to
allow for serial port emulation.</p></li>

<li><p>Next, load the following modules:</p>
<pre>
	# modprobe hci_xxx (xxx depend on your type of device)
	# modprobe bluez
	# modprobe l2cap
	# modprobe rfcomm
</pre>
</li>

<li><p>If the modules have loaded successfully, type "hciconfig" and you
should see your BT interface listed under the "hci0" name.</p></li>
</ol>

<h2>Configuration</h2>

<ol>
<li><p>Turn on your BT GPS device and scan for remote BT devices:</p>
<pre>
	# hciconfig hci0 up
	# hcitool scan
</pre>
</li>

<li><p>Write down the address of your BT GPS receiver (xx:xx:xx:xx:xx:xx).
At this point, it is quite likely that passing the address to gpsd will work.</p></li>

<li><p>If you're using a smartphone via Bluetooth, you will probably need to
specify a channel other than 1.  Start the GPS app on your phone, altering any
settings needed to make it give NMEA strings over Bluetooth, and then do
something like:

<pre>
  sdptool browse xx:xx:xx:xx:xx:xx
</pre>

<p>You should see something like this in the output:</p>

<pre>
  Service Name: GPS2BT
  Service RecHandle: 0x1000b
  Service Class ID List:
    UUID 128: 00001101-0000-1000-8000-00805f9b34fb
  Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
      Channel: 2
</pre>

<p>The Service name will vary based on the app.  Write down the
channel number and use it in the next step instead of channel 1. The channel
number will likely vary each time the app is started, so you will probably
need some scripting or other additional configuration to fix that. If gpsd or
gpsctl is reporting "connection refused" it is likely that you have the
wrong channel number.</p>
</li>

<li><p>Set up rfcomm.  Edit /etc/bluetooth/rfcomm.conf to reflect your BT
GPS address and to enable binding.</p>
<pre>
	#
	# RFCOMM configuration file.
	#
	# $Id: rfcomm.conf,v 1.1 2002/10/07 05:58:18 maxk Exp $
	#

	rfcomm0 {
	        # Automatically bind the device at startup
	        bind yes;

	        # Bluetooth address of the device
	        device xx:xx:xx:xx:xx:xx;

	        # RFCOMM channel for the connection
	        channel 1;

	        # Description of the connection
	        comment "Your GPS Device Here";
	}
</pre>
</li>

<li><p>Bind rfcomm0 (unless you are planning to reboot, in which case
it will be automatically bound).</p>
<pre>
	# rfcomm bind rfcomm0
</pre>
</li>

<li>
<p>Under most Linux distros, GPSD is by default configured to start gpsd on
a hotplug event announcing a USB GPS. You need to reconfigure the GPSD
installation so the daemon will be started at boot time listening to
/dev/rfcomm0 (it will still work with hotplugged USB GPses after you
do this).</p>

<p>Under Debian and Ubuntu Linux, <code>"dpkg-reconfigure gpsd"</code>
will start a dialog that will reconfigure the device for you. You
will need to reboot for this change to take effect.</p>
</li>
</ol>

<p>At this point, your system should be configured to use gpsd with
your BT GPS device. You should test operation in the normal way
described in the <a href="troubleshooting.html">Troubleshooting Guide</a>.</p>

<h2>Known Issues:</h2>
<ul>
<li><p>On system startup, gpsd starts before rfcomm0 is bound by rfcomm
and fails (at least on some systems) - a workaround for this is to add
a symlink to the gpsd init.d script to a later runlevel.</p>
<pre>
# cd /etc/rcS.d/
# ln -s ../init.d/gpsd S89gpsd
</pre>
</li>
<li>
<p>In February 2009 it was reported that there are some issues with
the Bluetooth stack in Ubuntu Intrepid. <a
href="http://cris.bytesnblades.net/2009/02/20/starting-gpsd-automatically-with-a-bluetooth-gps/">This
report advocates using a different Bluetooth device manager and describes some
additional udev rules.</a></p>
</li>
</ul>

<h2>Contributors:</h2>
<ul>
<li><p>Jean-Michel Bouffard</p></li>
<li><p>Joshua Layne</p></li>
<li><p>Lukasz Stelmach</p></li>
<li><p>Bertolt Loprets</p></li>
<li><p>Rob Shinn</p></li>
<li><p>Tomáš Ebenlendr</p></li>
</ul>

<hr>
<script src="datestamp.js" type='text/javascript'></script>
</div>
</body>
</html>