Friday, July 3, 2009

bluetooth gps on linux - short howto

Once you paired the gps with your pc, scan for the device to gather the hardware address:

> hcitool scan

Scanning ...
00:0B:0D:6F:F9:C5 SJA GPS

Once the hardware address is found, you can use it to find the channel through which they chat:

> sdptool browse 00:0B:0D:6F:F9:C5

Browsing 00:0B:0D:6F:F9:C5 ...
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

In this case channel seems to be 1. Create a virtual serial port through which to bind the gps through its hardware address and channel to the device rfcomm0:

> rfcomm bind /dev/rfcomm0 00:0B:0D:6F:F9:C5 1

See if it works:

> cat /dev/rfcomm0

If everything went right, now you should see a stream of NMEA sentences coming along your console.

To be able to see it for example by java programs, you need to link it to a virtual port ttySxxxxx:

> sudo ln -s /dev/rfcomm0 /dev/ttyS0007

Post a Comment