Reply
Thread Tools
Posts: 6 | Thanked: 2 times | Joined on Jun 2008
#1
Hello,

I was wondering if it is possible to use the n810 as a bluetooth gps module. I just bought Nokia E51 phone and it has some interesting apllications that would benefit from gps connection (such as sports tracker). I would like to use n810's gps so I wouldn't have to buy a separate bluetooth gps module. Does anyone know if this is possible and, if it is, how?
 

The Following User Says Thank You to ledimies For This Useful Post:
Posts: 18 | Thanked: 6 times | Joined on Dec 2007 @ Warsaw, Poland
#2
It is definitely doable, but probably not out of the box - you need to make n810 to open service over SPP profile on BT and feed there internal GPS data. Probably it can be done in a simple bash script, but you have two problems:
1. n810 GPS device is just... not the best (especially taking into account time-to-fix)
2. n810 battery might die quite fast
I really think, that buying ANY bluetooth GPS receiver (they are really cheap now) might be just better choice.
 

The Following 3 Users Say Thank You to jakubd For This Useful Post:
Posts: 6 | Thanked: 2 times | Joined on Jun 2008
#3
Great! I don't care about the long time-to-fix, once the fix is aquired it is reliable. I also don't care about the possible battery life problems.

I am sure someone has already done this so I am sure that that someone could shed some details about how this was done.

Thanks!
 
speculatrix's Avatar
Posts: 880 | Thanked: 264 times | Joined on Feb 2007 @ Cambridge, UK
#4
I would guess that you need to do the following (I don't have an n810 or anything similar)

basically, make a script that "listens" to rfcomm on the tablet and then reads from /dev/gps writing to the bluetooth virtual serial device.. something like this

rfcomm listen 0 "cat /dev/gps > /dev/rfcomm0"


you might need to put the "cat" command into a shell script, e.g.
Code:
$ cat > gps_to_rfcomm
#!/bin/bash
cat /dev/gps > /dev/rfcomm0
^D
$ chmod ugo+x gps_to_rfcomm
$ rfcomm listen 0 gps_to_rfcomm
 

The Following User Says Thank You to speculatrix For This Useful Post:
Posts: 78 | Thanked: 32 times | Joined on May 2008
#5
I would absolutly love to have this ability too.

So, my fingers are crossed that someone skillful will come up with a solution.

Cheers!
 
locusf's Avatar
Posts: 159 | Thanked: 341 times | Joined on Dec 2007 @ Helsinki, Finland
#6
Originally Posted by speculatrix View Post
I would guess that you need to do the following (I don't have an n810 or anything similar)

basically, make a script that "listens" to rfcomm on the tablet and then reads from /dev/gps writing to the bluetooth virtual serial device.. something like this

rfcomm listen 0 "cat /dev/gps > /dev/rfcomm0"


you might need to put the "cat" command into a shell script, e.g.
Code:
$ cat > gps_to_rfcomm
#!/bin/bash
cat /dev/gps > /dev/rfcomm0
^D
$ chmod ugo+x gps_to_rfcomm
$ rfcomm listen 0 gps_to_rfcomm
Device /dev/gps doesn't exist but /dev/pgps does, I changed it and tried Nokia Maps 2.0 on my E51 but no avail .

It seems that the channel needs to be specified as well, does anyone know what is the common channel for this service?

Better yet if someone would post the SDP record for the GPS service on some device so that the UUID of this service could be registered on a certain port and a phone or whatever would find it .

So theoretically its possible.
__________________
Regards,
LoCusF
http://locusf.blogspot.com
 
tz1's Avatar
Posts: 716 | Thanked: 236 times | Joined on Dec 2007
#7
The internal GPS is off by default. You need to send a "P 3" to the control socket to power it up.

The following code (sending "P 3\n") turns it on, P 0 turns it off

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);
        }
    }
}
That will turn the GPS on. You can do it manually with echo "P 3" | socat unix:/var/lib... stdio ## if you have socat.

The next problem is the far endpoint probably doesn't have a serial port, so the "rfcomm connect rfcomm0 11:22:33:44:55:66" will fail, and I don't know how to make the Nokia use an inbound rfcomm off the top of my head (time for google).

If the second obstacle is overcome, "cat /dev/pgps >/dev/rfcomm0" will work.
 

The Following 3 Users Say Thank You to tz1 For This Useful Post:
tz1's Avatar
Posts: 716 | Thanked: 236 times | Joined on Dec 2007
#8
Note: I tried a few things, mainly rfcomm from another linux box and they seemed to require a /etc/bluetooth/pin, but it still would not open a serial port across bluetooth. If someone can get rfcomm going so I can do ls >/dev/rfcomm0 on one computer (or the windows/mac equivalent) and cat /dev/rfcomm0 on the tablet (or vice versa) it would help greatly.

I suspect there is no serial port profile (SPP) at one or both ends.
 
tz1's Avatar
Posts: 716 | Thanked: 236 times | Joined on Dec 2007
#9
progress of a sort, on the Nokia:

rfcomm -i hci0 listen 0 "cat /dev/pgps >/dev/rfcomm0"

It listens and connects (and I've paired the devices), but I think I need to change the "cat..." into a shell script. I also need to do a pgps control program.
 
tz1's Avatar
Posts: 716 | Thanked: 236 times | Joined on Dec 2007
#10
Success!

First, create a script to launch the navicore gps control program (make sure it is set to the internal and not a BT gps via the control panel). and make it executable (I call it gpson):

Code:
#!/bin/sh
exec /usr/libexec/navicore-gpsd-helper >$1
Then, make sure you've paired with the other device (in the BT devices list).

(UPDATE!) Advertise a serial port service

Code:
sdptool add SP
Then run:

Code:
rfcomm -i hci0 listen 2 1 ./gpson {}
and then connect from a remote device. You might want to put it into an infinite loop, and or background. Also you might want to try "rfcomm -r -i hci0..." to put it in raw mode.

The navicore-gpsd-helper turns the internal GPS on (if it is selected) and emits NMEA to stdout.

Note: my linux laptop works with rfcomm connect... & cat /dev/rfcommX. I had to tweak my Mac (control panel, bluetooth, edit serial port). I will try Windows later, but adding the service above should make things work.

Last edited by tz1; 2008-06-18 at 23:36. Reason: Missing link
 

The Following 3 Users Say Thank You to tz1 For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 01:52.