GPS on the Neo 1973

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Strange effects)
(-cat)
 
(14 intermediate revisions by 6 users not shown)
Line 5: Line 5:
 
All purchased phones do not include the GPS binary driver.  [http://lists.openmoko.org/pipermail/community/2007-July/008466.html]  
 
All purchased phones do not include the GPS binary driver.  [http://lists.openmoko.org/pipermail/community/2007-July/008466.html]  
 
But finally, as described in [[November_29%2C_2007_Community_Update]], the binary driver is available to the community now.
 
But finally, as described in [[November_29%2C_2007_Community_Update]], the binary driver is available to the community now.
 
In the very early shipment to 50 Phase 1 developers, a binary-only program for talking to the the GPS was accidentally included
 
in /home/root/DM2/gps, (and presumably, the same binary would function on a P0 device).
 
  
 
There is an ongoing effort to write a Free Software
 
There is an ongoing effort to write a Free Software
Line 13: Line 10:
 
[[Hammerhead/Protocol]] for details and the latest status.
 
[[Hammerhead/Protocol]] for details and the latest status.
  
== Binary Daemon GLLIN ==
+
== Quick test (driver output to console) on Neo1973 Phase 1 ==
 +
''Main article: [[Getting GPS console output with gllin]]''
  
For those few with the binary driver in the meantime, Pavel Machek
+
To get the output of this driver, read the file /tmp/nmeaNP (it is actually a pipe, not a file). The simplest way is to open another ssh connection to the phone and use cat:
[http://pavelmachek.livejournal.com/39229.html provides] the
+
cat /tmp/nmeaNP
following script for recording an NMEA stream from the binary program.
+
  
#!/bin/sh
+
This way it is possible to see the first results very easily.
echo 1 > /sys/class/leds/gta01\:vibrator/brightness
+
killall gllin cat
+
sleep 1
+
echo 0 > /sys/class/leds/gta01\:vibrator/brightness
+
mknod /tmp/nmeaNP p
+
cat /tmp/nmeaNP >> /tmp/gps.nmea &
+
/home/root/DM2/gps/gllin -low 5
+
/home/root/DM2/gps/gllin -periodic 3
+
  
The binary program was compiled to OABI format which now is obsolete as OM2007.2 builds are in EABI format. You can still run the binary with ''chroot''. [[user:Zdanek|Bartek Zdanowski]] wrote an [http://www.openmoko.org.pl/node/55 aticle] how to run GPS receiver. Alternativly ld-linux can be used to do the trick:
+
== The "GPS Sight" program with graphic interface ==
 +
''Main article: [[GPS Sight]]''
  
==The ld-linux trick==
+
There is also a working open source GPS preview program to get the gllin output to the graphical environment. It can immediately show the location, altitude, speed and curved distance from selected point. This program can also draw the covered path (no background map).
  
you need the following files:
+
== The old program in /home/root/DM2/gps ==
 +
''Main article - [[Phase 1 GPS driver]]''
  
bin/gllin
+
In the very early shipment to 50 Phase 1 developers, a binary-only program for talking to the the GPS was accidentally included
bin/gllin.sh
+
in /home/root/DM2/gps, (and presumably, the same binary would function on a P0 device). It was compiled to OABI format which now is obsolete as OM2007.2 builds are in EABI format, but developers suggested tricks to run it with ''chroot''. These approaches seem now obsolete and the old binary seems even no longer easily available.
lib/ld-linux.so.2
+
lib/libc.so.6
+
lib/libgcc_s.so.1
+
lib/libm.so.6
+
lib/libnss_dns.so.2
+
lib/libnss_files.so.2
+
lib/libpthread.so.0
+
lib/libresolv.so.2
+
lib/librt.so.1
+
lib/libstdc++.so.6
+
lib/libutil.so.1
+
 
+
the file bin/gllin.sh contains:
+
 
+
#!/bin/sh
+
`pwd`/lib/ld-linux.so.2 --library-path `pwd`/lib `pwd`/bin/gllin -low 5
+
test -p /tmp/nmeaNP || ( rm -f /tmp/nmeaNP && mknod /tmp/nmeaNP p )
+
`pwd`/lib/ld-linux.so.2 --library-path `pwd`/lib `pwd`/bin/gllin -periodic 3
+
 
+
be shure to start at least a `cat /tmp/nmeaNP` somewhere.
+
 
+
another aproach (chroot) is described in [[Gllin]] - here is also a link to a archive with all needed shared libraries in the right format.
+
 
+
==Strange effects==
+
 
+
the message
+
 
+
Stack size 8864 bytes (9 KB)
+
 
+
means, nobody is reading on the pipe /tmp/nmeaNP, you probably forgot to start the `cat ...`.
+
 
+
the message
+
 
+
gllin: early exit(3) in halInit()/681
+
 
+
is issued by the low-level hardware test but gllin works fine afterwords.
+
 
+
do not use the option
+
 
+
+daemon
+
 
+
because gllin writes all files to /tmp then which is a bad idea. because /tmp is ram it is lost. because ram is limited the logfile will eat up your memmory.
+
  
 
== Bluetooth GPS ==
 
== Bluetooth GPS ==
Line 115: Line 64:
 
gllin sends a udp packet per nmea sentence on port 6000. this is a much cleaner aproach because using files will fill up memory or rootfs (the latter will result in the need for reflashing).
 
gllin sends a udp packet per nmea sentence on port 6000. this is a much cleaner aproach because using files will fill up memory or rootfs (the latter will result in the need for reflashing).
  
i switch off writing to /tmp/nmeaNP with
+
i switch off writing to /tmp/nmeaNP and logging to log/... with
  
 
  -np
 
  -np
 +
-nmea
  
the following python script reads the nmea sentences:
+
the help says that -nmea is the default, fact is that gllin logs nmea sentences into ./log/<date> wich will fill up mem or rootfs for long running tests. the following python script reads the nmea sentences (you need to have python-io installed to get the socket module):
  
 +
#!/usr/bin/python
 +
import sys
 
  import socket
 
  import socket
 
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Line 126: Line 78:
 
  while True:
 
  while True:
 
     line = s.recv(1024)
 
     line = s.recv(1024)
     print line
+
     sys.stdout.write(line)
 +
    sys.stdout.flush()
  
 
the program just prints those to stdout but other methods are possible (i feed them into a NMEA parser).
 
the program just prints those to stdout but other methods are possible (i feed them into a NMEA parser).
  
benefits are that both programs can be started and stopped at will. none needs the other. gllin will not terminate if /tmp/nmeaNP is not there or not read from. the `cat /tmp/nmeaNP | gzip > gps.gz` is a useless idea any because the files in log/ (current directory) contains the NMEA data already.
+
benefits are that both programs can be started and stopped at will. none needs the other. gllin will not terminate if /tmp/nmeaNP is not there or not read from. the `cat /tmp/nmeaNP | gzip > gps.gz` is a useless idea anyway because the files in log/ (current directory) contains the NMEA data already.
  
 
== NMEA ==
 
== NMEA ==
Line 136: Line 89:
  
 
Some information about it is available at [http://gpsinformation.org/dale/nmea.htm gpsinformation.org] and on [http://en.wikipedia.org/wiki/NMEA Wikipedia].
 
Some information about it is available at [http://gpsinformation.org/dale/nmea.htm gpsinformation.org] and on [http://en.wikipedia.org/wiki/NMEA Wikipedia].
 
  
 
[[Category:GPS]]
 
[[Category:GPS]]

Latest revision as of 08:14, 19 July 2009

The Neo1973 device contains an integrated GPS. The particular device is marketed as an AGPS, and there is some discussion available as to what significance that "A" might have.

All purchased phones do not include the GPS binary driver. [1] But finally, as described in November_29,_2007_Community_Update, the binary driver is available to the community now.

There is an ongoing effort to write a Free Software program that could be used instead of this binary-only program. See Hammerhead/Protocol for details and the latest status.

Contents

[edit] Quick test (driver output to console) on Neo1973 Phase 1

Main article: Getting GPS console output with gllin

To get the output of this driver, read the file /tmp/nmeaNP (it is actually a pipe, not a file). The simplest way is to open another ssh connection to the phone and use cat:

cat /tmp/nmeaNP

This way it is possible to see the first results very easily.

[edit] The "GPS Sight" program with graphic interface

Main article: GPS Sight

There is also a working open source GPS preview program to get the gllin output to the graphical environment. It can immediately show the location, altitude, speed and curved distance from selected point. This program can also draw the covered path (no background map).

[edit] The old program in /home/root/DM2/gps

Main article - Phase 1 GPS driver

In the very early shipment to 50 Phase 1 developers, a binary-only program for talking to the the GPS was accidentally included in /home/root/DM2/gps, (and presumably, the same binary would function on a P0 device). It was compiled to OABI format which now is obsolete as OM2007.2 builds are in EABI format, but developers suggested tricks to run it with chroot. These approaches seem now obsolete and the old binary seems even no longer easily available.

[edit] Bluetooth GPS

He also succeeded at getting the Neo1973 to act like a bluetooth GPS with the following script: (Note that this script has bad problems if you run it more than once. You can get a "time traveling GPS" effect, with the GPS showing you your past position).

#!/bin/sh
killall rfcomm tail
mknod /dev/rfcomm0 c 216 0
echo 1 > /sys/devices/platform/s3c2410-i2c/i2c-0/0-0008/gta01-pm-bt.0/power_on
sleep 1
hciconfig hci0 up name linuxgps
sleep 1
sdpd
sleep 1
sdptool add SP
(
        while true; do
        rfcomm listen /dev/rfcomm0 1
        sleep 1
        done
) &
(
        while true; do
            tail -f /tmp/gps.nmea > /dev/rfcomm0
            echo 1 > /sys/class/leds/gta01\:vibrator/brightness
            sleep 1
            echo 0 > /sys/class/leds/gta01\:vibrator/brightness
        done
) &

[edit] Using UDP

gllin sends a udp packet per nmea sentence on port 6000. this is a much cleaner aproach because using files will fill up memory or rootfs (the latter will result in the need for reflashing).

i switch off writing to /tmp/nmeaNP and logging to log/... with

-np
-nmea

the help says that -nmea is the default, fact is that gllin logs nmea sentences into ./log/<date> wich will fill up mem or rootfs for long running tests. the following python script reads the nmea sentences (you need to have python-io installed to get the socket module):

#!/usr/bin/python
import sys
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('127.0.0.1', 6000))
while True:
    line = s.recv(1024)
    sys.stdout.write(line)
    sys.stdout.flush()

the program just prints those to stdout but other methods are possible (i feed them into a NMEA parser).

benefits are that both programs can be started and stopped at will. none needs the other. gllin will not terminate if /tmp/nmeaNP is not there or not read from. the `cat /tmp/nmeaNP | gzip > gps.gz` is a useless idea anyway because the files in log/ (current directory) contains the NMEA data already.

[edit] NMEA

The ouput from the binary driver seems to follow the NMEA standard.

Some information about it is available at gpsinformation.org and on Wikipedia.

Personal tools

The Neo1973 device contains an integrated GPS. The particular device is marketed as an AGPS, and there is some discussion available as to what significance that "A" might have.

All purchased phones do not include the GPS binary driver. [1] But finally, as described in November_29,_2007_Community_Update, the binary driver is available to the community now.

In the very early shipment to 50 Phase 1 developers, a binary-only program for talking to the the GPS was accidentally included in /home/root/DM2/gps, (and presumably, the same binary would function on a P0 device).

There is an ongoing effort to write a Free Software program that could be used instead of this binary-only program. See Hammerhead/Protocol for details and the latest status.

Binary Daemon GLLIN

For those few with the binary driver in the meantime, Pavel Machek provides the following script for recording an NMEA stream from the binary program.

#!/bin/sh
echo 1 > /sys/class/leds/gta01\:vibrator/brightness
killall gllin cat
sleep 1
echo 0 > /sys/class/leds/gta01\:vibrator/brightness
mknod /tmp/nmeaNP p
cat /tmp/nmeaNP >> /tmp/gps.nmea &
/home/root/DM2/gps/gllin -low 5
/home/root/DM2/gps/gllin -periodic 3

The binary program was compiled to OABI format which now is obsolete as OM2007.2 builds are in EABI format. You can still run the binary with chroot. Bartek Zdanowski wrote an aticle how to run GPS receiver. Alternativly ld-linux can be used to do the trick:

The ld-linux trick

you need the following files:

bin/gllin
bin/gllin.sh
lib/ld-linux.so.2
lib/libc.so.6
lib/libgcc_s.so.1
lib/libm.so.6
lib/libnss_dns.so.2
lib/libnss_files.so.2
lib/libpthread.so.0
lib/libresolv.so.2
lib/librt.so.1
lib/libstdc++.so.6
lib/libutil.so.1

the file bin/gllin.sh contains:

#!/bin/sh
`pwd`/lib/ld-linux.so.2 --library-path `pwd`/lib `pwd`/bin/gllin -low 5
test -p /tmp/nmeaNP || ( rm -f /tmp/nmeaNP && mknod /tmp/nmeaNP p )
`pwd`/lib/ld-linux.so.2 --library-path `pwd`/lib `pwd`/bin/gllin -periodic 3

be shure to start at least a `cat /tmp/nmeaNP` somewhere.

another aproach (chroot) is described in Gllin - here is also a link to a archive with all needed shared libraries in the right format.

Strange effects

the message

Stack size 8864 bytes (9 KB)

means, nobody is reading on the pipe /tmp/nmeaNP, you probably forgot to start the `cat ...`.

the message

gllin: early exit(3) in halInit()/681

is issued by the low-level hardware test but gllin works fine afterwords.

do not use the option

+daemon

because gllin writes all files to /tmp then which is a bad idea. because /tmp is ram it is lost. because ram is limited the logfile will eat up your memmory.

Bluetooth GPS

He also succeeded at getting the Neo1973 to act like a bluetooth GPS with the following script: (Note that this script has bad problems if you run it more than once. You can get a "time traveling GPS" effect, with the GPS showing you your past position).

#!/bin/sh
killall rfcomm tail
mknod /dev/rfcomm0 c 216 0
echo 1 > /sys/devices/platform/s3c2410-i2c/i2c-0/0-0008/gta01-pm-bt.0/power_on
sleep 1
hciconfig hci0 up name linuxgps
sleep 1
sdpd
sleep 1
sdptool add SP
(
        while true; do
        rfcomm listen /dev/rfcomm0 1
        sleep 1
        done
) &
(
        while true; do
            tail -f /tmp/gps.nmea > /dev/rfcomm0
            echo 1 > /sys/class/leds/gta01\:vibrator/brightness
            sleep 1
            echo 0 > /sys/class/leds/gta01\:vibrator/brightness
        done
) &

Using UDP

gllin sends a udp packet per nmea sentence on port 6000. this is a much cleaner aproach because using files will fill up memory or rootfs (the latter will result in the need for reflashing).

i switch off writing to /tmp/nmeaNP with

-np

the following python script reads the nmea sentences:

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('127.0.0.1', 6000))
while True:
    line = s.recv(1024)
    print line

the program just prints those to stdout but other methods are possible (i feed them into a NMEA parser).

benefits are that both programs can be started and stopped at will. none needs the other. gllin will not terminate if /tmp/nmeaNP is not there or not read from. the `cat /tmp/nmeaNP | gzip > gps.gz` is a useless idea any because the files in log/ (current directory) contains the NMEA data already.

NMEA

The ouput from the binary driver seems to follow the NMEA standard.

Some information about it is available at gpsinformation.org and on Wikipedia.