Debian and Nokia LD-3W GPS Dongle
It is a while now I bought a Nokia LD-3W, my dream was a connection between my notebook and this little GPS receiver.How-To
Connecting the LD-3W is quite simple, if you know how to do it. The only prerequisite is that you have already bluetooth kernel support.PreparationsPackages
Install following package:
apt-get install bluez-utils gpsd gpsd-clients
Use of Bluez-Utils (Find LD-3W)
At first you need to find your LD-3W. To do so execute:
hcitool inq
Output:
Inquiring ... 11:22:33:44:55:66 clock offset: 0x0e82 class: 0x011f00
Then check if the device provides a fitting service. In our case we need a serial port
sdptool search --bdaddr 11:22:33:44:55:66 SP
Output:
Searching for SP on 11:22:33:44:55:66 ...Service Name: Dev BService RecHandle: 0x10000Service Class ID List: "Serial Port" (0x1101)Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1Language Base Attr List: code_ISO639: 0x656e encoding: 0x6a base_offset: 0x100
Please note the line with the property Channel: this is the channel where your GPS device listens for incomming connections (Bluetooth supports only one connection at a time)Setup rfcomm.conf
Edit your rfcomm.conf it should look something like this:
## RFCOMM configuration file.#
rfcomm0 { bind yes; device 11:22:33:44:55:66; channel 1; comment "NOKIA LD-3W";}
The channel 1; you received from the output while probing for the SP (Serial Port). Now you can start your bluetooth services.
/etc/init.d/bluetooth start
Passkey Agent
The next problem we will face is the authentication. Many tutorials concerning the bluez tools, talking about a pin_helper, but actually my version of hcid does not know any option called pin_helper. Running hcid manually tells you something about a missing passkey-agent. The passkey-agent is a simple application connecting hcid through the dbus message bus and provides a key for all requests. There are solutions for gnome (bluez-gnome) and KDE, but you can also use a simple c application provided by bluez-utils.
cd /tmpzcat /usr/share/doc/bluez-utils/examples/passkey-agent.c.gz >passkey-agentcp /usr/share/doc/bluez-utils/examples/Makefile .makecp passkey-agent /usr/local/bin
To start the passkey-agent, just type:
passkey-agent --default 0000 &
The default code of the Nokia LD-3W is ‘0000’, afaik it cannot be changed.Using LD-3W
After your setup is complete you can try out, if it works. To connect your LD-3W and bind it to /dev/rfcomm* you need to run:
rfcomm connect rfcomm0 11:22:33:44:55:66 1
This command will create your tty device node located at /dev/rfcomm0Preparing GPSD
In order to run gpsd you need to configure it.
dpkg-reconfigure gpsd
This command will ask you to enter some options, like the path to the rfcomm device. Just look at your /etc/bluetooth/rfcomm.conf which device is used. (The name before the opening bracket ‘{’, e.g. rfcomm0 will be /dev/rfcomm0 if you use udev)Now you can start gpsd
/etc/init.d/gpsd start
By default gpsd does not open the rfcomm device on start, it waits for at least one client to connect to gpsd. To test gpsd telnet it by using following command:
telnet localhost 2947
You also can run xgps, which is included in the gpsd-clients package.Applications like kismet should also work with gpsd.
It is a while now I bought a Nokia LD-3W, my dream was a connection between my notebook and this little GPS receiver.How-To
Connecting the LD-3W is quite simple, if you know how to do it. The only prerequisite is that you have already bluetooth kernel support.PreparationsPackages
Install following package:
apt-get install bluez-utils gpsd gpsd-clients
Use of Bluez-Utils (Find LD-3W)
At first you need to find your LD-3W. To do so execute:
hcitool inq
Output:
Inquiring ... 11:22:33:44:55:66 clock offset: 0x0e82 class: 0x011f00
Then check if the device provides a fitting service. In our case we need a serial port
sdptool search --bdaddr 11:22:33:44:55:66 SP
Output:
Searching for SP on 11:22:33:44:55:66 ...Service Name: Dev BService RecHandle: 0x10000Service Class ID List: "Serial Port" (0x1101)Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1Language Base Attr List: code_ISO639: 0x656e encoding: 0x6a base_offset: 0x100
Please note the line with the property Channel: this is the channel where your GPS device listens for incomming connections (Bluetooth supports only one connection at a time)Setup rfcomm.conf
Edit your rfcomm.conf it should look something like this:
## RFCOMM configuration file.#
rfcomm0 { bind yes; device 11:22:33:44:55:66; channel 1; comment "NOKIA LD-3W";}
The channel 1; you received from the output while probing for the SP (Serial Port). Now you can start your bluetooth services.
/etc/init.d/bluetooth start
Passkey Agent
The next problem we will face is the authentication. Many tutorials concerning the bluez tools, talking about a pin_helper, but actually my version of hcid does not know any option called pin_helper. Running hcid manually tells you something about a missing passkey-agent. The passkey-agent is a simple application connecting hcid through the dbus message bus and provides a key for all requests. There are solutions for gnome (bluez-gnome) and KDE, but you can also use a simple c application provided by bluez-utils.
cd /tmpzcat /usr/share/doc/bluez-utils/examples/passkey-agent.c.gz >passkey-agentcp /usr/share/doc/bluez-utils/examples/Makefile .makecp passkey-agent /usr/local/bin
To start the passkey-agent, just type:
passkey-agent --default 0000 &
The default code of the Nokia LD-3W is ‘0000’, afaik it cannot be changed.Using LD-3W
After your setup is complete you can try out, if it works. To connect your LD-3W and bind it to /dev/rfcomm* you need to run:
rfcomm connect rfcomm0 11:22:33:44:55:66 1
This command will create your tty device node located at /dev/rfcomm0Preparing GPSD
In order to run gpsd you need to configure it.
dpkg-reconfigure gpsd
This command will ask you to enter some options, like the path to the rfcomm device. Just look at your /etc/bluetooth/rfcomm.conf which device is used. (The name before the opening bracket ‘{’, e.g. rfcomm0 will be /dev/rfcomm0 if you use udev)Now you can start gpsd
/etc/init.d/gpsd start
By default gpsd does not open the rfcomm device on start, it waits for at least one client to connect to gpsd. To test gpsd telnet it by using following command:
telnet localhost 2947
You also can run xgps, which is included in the gpsd-clients package.Applications like kismet should also work with gpsd.