Using a Bluetooth GPS device with Gentoo Linux

Daniel Bernhardt

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Germany License

Abstract

This manual explains how to connect the Bluetooth GPS Device EMTAC BTGPS 222222 151740 to a Linux PC running Gentoo Linux. Any other Bluetooth GPS Device may be connected in the same way.

If you have any comments or questions contact me at .


Revision History
Revision 1.02009-08-29Daniel Bernhardt
initial manual release

Introduction

You need Bluetooth support in your kernel and a recent version of the Bluetooth Tools and System Daemons for Linux installed on your system. At the point of writing bluez-4.39 was the latest version available. If not yet happened, install bluez now.

Setting up the device

Start your Bluetooth subsystem with /etc/init.d/bluetooth start. Running hciconfig -a as root should give you an output like this:

hci0:   Type: USB
        BD Address: 00:14:A4:FD:47:BA ACL MTU: 1017:8 SCO MTU: 64:8
        UP RUNNING PSCAN
        RX bytes:22454 acl:1052 sco:0 events:165 errors:0
        TX bytes:2486 acl:116 sco:0 commands:98 errors:0
        Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: 'falke-0'
        Class: 0x4a010c
        Service Classes: Networking, Capturing, Telephony
        Device Class: Computer, Laptop
        HCI Ver: 2.0 (0x3) HCI Rev: 0x2049 LMP Ver: 2.0 (0x3) LMP Subver: 0x4127
        Manufacturer: Broadcom Corporation (15)			
		

The important line in this output is UP RUNNING PSCAN. If you don't see something like this check if the Bluetooth daemon is really running and no external switch is preventing operation of the Bluetooth module.

Now it's time to scan for the device. Turn your GPS device on. A hcitool scan will scan for any Bluetooth enabled devices.

# hcitool scan
Scanning ...
        00:02:C7:15:17:40       EMTAC BTGPS 222222 151740
		

The GPS device has been found. Copy the MAC address of the device as we use it later on.

Edit the file /etc/bluetooth/rfcomm.conf so it looks like this:

rfcomm1 {
        bind yes;
        device 00:02:C7:15:17:40;
        channel 1;
        comment "GPS Device";
}
		

Replace the MAC address with the one of your device.

To connect the device issue the command rfcomm connect 1. The 1 stands for the device id. If you'd specified rfcomm0 in /etc/bluetooth/rfcomm.conf you had to use 0 as the device parameter.

# rfcomm connect 1
Connected /dev/rfcomm1 to 00:02:C7:15:17:40 on channel 1
Press CTRL-C for hangup
		

You can use CTRL+C or rfcomm release 1 to end the connection. To test if everything is working use cat /dev/rfcomm1. You should see the NMEA output of the GPS device.

Using the device

One way to visualize the operation of your GPS device is to use gpsd and the helper programs that come with it.

Install a recent version of gpsd. The stable version in portage (as of now) gpsd-2.32 did not correctly work with my GPS device. Unmask gpsd-2.39 and compile it.

gpsd

As root start gpsd with gpsd /dev/rfcomm1. It will go into background and listen for connections on TCP port 2947.

gpsd bluetooth

gpsd brings its own tool (gpsd-connect-bluetooth.sh) for connecting a bluetooth GPS device. Unfortunately I couldn't get it to recognize my device as a GPS device. Just use the manual aproach described at the beginning of this manual for connecting your device.

xgps

xgps is a graphical program that connects to gpsd and displays your current GPS information like your position and visible satellites.

xgps showing recieved GPS data from gpsd.