-   Linux - Hardware (
-   -   Bluetooth GPS (

Slokunshialgo 01-24-2009 07:53 PM

Bluetooth GPS
Well, this one is a two part problem: Connecting, and using. I have a bluetooth GPS device for use with my palm pilot, that I was hoping I would be able to put to use with my laptop. Specifically, it's a Garmin Mobile 10, if that is of any help here.

The first problem is being able to link the two devices up over Bluetooth. When I try connecting to it using Gnome's Bluetooth Applet, the laptop sends out the usual four-digit number that needs to be returned as a security precaution. Problem is, it chooses a random four digits, and the GPS is designed to return only 1234. Since I don't want to try up to a statistical 8999 attempts, here's the first question: Is there any way of forcing the number 1234 to be sent, rather than a random number?

I know I could go, grab the source code, modify this little part of it, compile, launch, connect, have it added to the known list, then go back to using the normal version, but this is a bit more than I'd like the do.

The second part is actually using it, and since I need the first solved, I've yet to be able to even try this. I've used a serial GPS connected via serial-USB adapter, and have it work in GPSDrive, pretty sure by pointing the interface to /dev/ttyUSB0. Not 100% sure on this, seeing as I grabbed it from dmesg at the time. Now, if I was somehow able to get the GPS connected to the laptop, what interface/device should I enter, since it would be through BT? Can it even be done?

Any help on either of these problems is much appreciated.

MS3FGX 01-24-2009 08:41 PM

Well I can't say that I have any idea how you would configure any of this through a GUI, let alone GNOME's interface. But you can certainly use a Bluetooth GPS receiver. You need to setup RFCOMM, which essentially gives you a virtual serial port over BT. Once this is done, the GPS device would work just like the wired one you used previously.

To set the default PIN on your machine, you would edit the file "/etc/bluetooth/hcid.conf". Look for a line that says "passkey:" and change whatever is there to "1234".

Then you would find the device's BT MAC (assuming you don't already know it). For this you just run "hcitool scan" when the device is in discoverable mode.

To setup a permanent RFCOMM connection you need to edit the file "/etc/bluetooth/rfcomm.conf". You would edit it something like this (the only thing you would really need to add would be the BT MAC):


# RFCOMM configuration file.

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

        # Bluetooth address of the device
        device aa:bb:cc:dd:ee:ff;

        # RFCOMM channel for the connection
        channel        1;

        # Description of the connection
        comment "Bluetooth GPS Receiver";

At this point you need to restart BlueZ. You didn't say which distribution you were using so I couldn't say specifically how to restart the service in your case; so you could simply reboot.

After that you should just need to enable the RFCOMM link with a command like:


sudo rfcomm bind /dev/rfcomm0 aa:bb:cc:dd:ee:ff
This will bind the BT GPS to the device /dev/rfcomm0, which you can then give to your GPS software as if it was a USB or serial GPS receiver. The software shouldn't need to know anything more than that, as it will appear as a normal serial port.


This all assumes you are using BlueZ 3.x, which is still the standard. If your distribution has switched over to the newer and less supported BlueZ 4.x, then disregard basically everything I just said. Then hope somebody has used a GPS under BlueZ 4.x and can walk you through it, because it is much harder to work with than the 3.x series.

Fitch 02-07-2012 03:34 PM

Hi there!

I've done the above, and actually got somewhere!

I also did:

$ hcitool scan
Scanning ...
00:0B:0D:6E:15:38 BT-GPS

$ sdptool browse 00:0B:0D:6E:15:38
Browsing 00:0B:0D:6E:15:38 ...
Service Name: SPP slave
Service Description: Bluetooth SPP V1.01
Service RecHandle: 0x10000
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100

gpsd /dev/rfcomm0
alistair@alistair ~ $ ls -l /dev/rfcom*
crw-rw---- 1 root dialout 216, 0 2012-02-07 21:19 /dev/rfcomm0

$ sudo telnet localhost 2947
Connected to localhost.
Escape character is '^]'.


And that's it. No data stream.

If I do:
$ cat /dev/rfcomm0

It just hangs there until I do a Control C.

When running xgps, all I get is the "{"class":"VERSION","release":"2. blah blah" you see 9 or 10 lines above this line. in the Responses box.
So it sees the GPS alright, but doesn't get any GPS data from it. I've been trying to get this thing working for three months now, and I know I'm close....

All times are GMT -5. The time now is 12:25 PM.