The Following User Says Thank You to For This Useful Post: | ||
![]() |
2009-08-15
, 04:51
|
Posts: 3 |
Thanked: 0 times |
Joined on Feb 2009
|
#32
|
![]() |
2010-05-14
, 00:16
|
Posts: 47 |
Thanked: 6 times |
Joined on Aug 2009
|
#33
|
![]() |
2010-05-14
, 08:23
|
Posts: 17 |
Thanked: 1 time |
Joined on Jul 2009
|
#34
|
I felt the need to update this. There is an application that has been around for at least a few months called minigpsd. You have to start it manually every time you want to use it but I know that it can stream gps info over http and tcpip not sure about bluetooth but it does seem that you can. I ve had great success using it as a gps receiver for my laptop using ubuntu, blueman, and minigpsd over a created adhoc network.
![]() |
2010-07-17
, 20:33
|
Posts: 60 |
Thanked: 33 times |
Joined on Apr 2010
|
#37
|
Code:static void sendnokgps(char *cmd) { int n, len; struct sockaddr_un igps; n = socket(AF_UNIX, SOCK_STREAM, 0); if (n >= 0) { igps.sun_family = AF_UNIX; strcpy(igps.sun_path, "/var/lib/gps/gps_driver_ctrl"); len = strlen(igps.sun_path) + sizeof(igps.sun_family); if (connect(n, (struct sockaddr *) &igps, len) != -1) { char buf[4]; if (!fork()) { // this can take a while write(n, cmd, strlen(cmd)); read(n, buf, 4); close(n); exit(0); } close(n); } } }
![]() |
2010-10-22
, 23:20
|
Posts: 47 |
Thanked: 6 times |
Joined on Aug 2009
|
#38
|
![]() |
2010-10-23
, 22:02
|
Posts: 47 |
Thanked: 6 times |
Joined on Aug 2009
|
#39
|
First you have to shut down obexsrv:
/etc/init.d/obexsrv stop
I believe obexsrv is a program for sharing files over bluetooth, but I never do that anyway. The problem is that obexsrv insists on listening on channel 1, and my E51 insists on connecting to channel 1 to obtain GPS data. There seems to be no way to configure either of them to use a different channel.
With that taken care of, we can start announing that we have a serial port profile on channel one:
sdptool add --channel=1 SP
And now the magic moment, connect gpspipe to the bluetooth channel:
rfcomm watch 0 1 sh -c "gpspipe -r > /dev/rfcomm0"
Some of the convoluted examples given elsewhere are probably because the rfcomm watch command is fairly new and people had to find other ways of achieving this behaviour.
Now you should see something like "Waiting for connection on channel 1". If you get "Can't bind RFCOMM socket: Address already in use", that means something else is already listening on channel 1. Did you remember to shut down obexsrv?
You need to make sure the GPS keeps running. I tend to use GPSJinni for this if I don't have any other need for the GPS, but MaemoMapper, GPXView or practically any other GPS program would work as well. Does anyone know a way to keep the GPS running without having a foreground application open?
With that done, you should now be able to connect to the channel. You can test this from another Linux system like this:
rfcomm bind /dev/rfcomm0 <bluetooth-address-of-your-n810> 1
cat /dev/rfcomm0
You should now see the line "GPSD,R=1" appear, followed by loads of GPS data. On the n810 side, you should see "Connection from xx:xx:xx:xx:xx:xx to /dev/rfcomm0".
You can find the bluetooth MAC address by typing hciconfig.
The commands sdptool, hciconfig and rfcomm are available in the package bluez-utils-test. Don't ask me where I got the package from, but I think it was in one of the official Maemo repositories.