====== Installing Navit on the EeePC ======
**[[http://navit.sourceforge.net/|Navit]]** is a car navigation system with routing engine. As it is free software, it runs on Linux, it can use the maps from **[[http://www.openstreetmap.org/|OpenStreetMap]]**, I definitivelly want to give it a try.
Obviously the platform of choice was the new Asus EeePC, where I installed a shining Debian Testing (Lenny).
===== Compiling and installing Navit with Debian =====
{{ .:gps:navit_snapshot1.png?300|}}
The package entered Debian Squeeze.
At present (2009-11) you can easily backport it to Debian Lenny, just download the three file **.dsc**, **.orig.tar.gz** and **.diff.gz** from the [[http://packages.debian.org/source/navit|Debian]] site and do:
dpkg-source -x navit_0.2.0~svn2663+dfsg.1-1.dsc
cd navit-0.2.0~svn2663+dfsg.1
dpkg-buildpackage -rfakeroot
... obviusly all the build dependencies must be installed before. The results are seven .deb packages that you can install with **''dpkg -i''**.
===== Getting the map from OpenStreetMap =====
It is possible to load the map of entire Italy. I downloaded **italy.osm.bz2** from **[[http://download.geofabrik.de/osm/europe/|download.geofabrik.de]]**; converting the file into Navit format I got a **4.7 Mb** file:
bzcat italy.osm.bz2 | osm2navit /usr/local/share/navit/maps/italy.bin
I had to tell Navit to load this map editing the file **''/usr/local/share/navit/navit.xml''**, adding a ''mapset'' section:
===== Installing gpsd, the GPS daemon =====
This was tested on Debian Squeeze 6.0.
Before starting Navit the **gpsd** should be up and running. Install the gpsd package and configure it, this is the relevant part of **''/etc/default/gpsd''** file:
START_DAEMON="true"
DAEMON_OPTS=""
DEVICES="/dev/gps0"
USBAUTO="true"
This will start **''gpsd''** at bootstrap, it will wait for the GPS to be connected to the USB port. **Note:** when the USB is connected, ''udev'' will not start ''gpsd'' if it is not already running (i.e. when ''START_DAEMON="false"'').
**''udev''** will handle the automatic connection of the GPS via USB, there is a script **''/lib/udev/rules.d/60-gpsd.rules''** in Debian Squeeze which includes the **[[gps_logger_i_blue_747|i-Blue 747 USB GPS logger]]**.
For previous Debian releases just add the following line to the file **''/etc/udev/rules.d/z60_gpsd.rules''** and restart ''udev'':
# i-Blue 747 USB GPS datalogger
SYSFS{idVendor}=="10c4", SYSFS{idProduct}=="ea60", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper"
When the GPS is plugged into the USB port, ''udev'' creates the **''/dev/gps0''** device, when the GPS is unplugged the Unix device is removed and the daemon remains running.
A simple test to check that gpsd is working, is to run **''gpspipe -r''** (provided by the ''gpsd-clients'' package), it should print out the NMEA messages recevied from the GPS:
gpspipe -r
GPSD,R=1
$GPGGA,112813.000,4353.5310,N,01106.1005,E,0,3,,102.4,M,47.6,M,,*4E
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,2,1,08,20,76,331,39,11,64,162,30,23,54,197,31,17,37,288,16*74
$GPGSV,2,2,08,31,25,070,25,32,18,072,27,13,16,209,24,04,05,308,*7E
$GPRMC,112813.000,V,4353.5310,N,01106.1005,E,0.08,349.33,040408,,,N*74
$PMTK001,-1,0*1F
$PMTK001,-1,0*1F
$GPGGA,112814.000,4353.5310,N,01106.0969,E,0,3,,102.4,M,47.6,M,,*4B
==== Problem #1: plug/unplug ====
When a gps client opens a connection with gpsd, it starts receiving data. If GPS device is unplugged and plugged again, the connection does not restart automatically. A workaround is to execute **''gpspipe -r n1''** into another terminal to force device re-opening.
I hacked **''/lib/udev/gpsd.hotplug''**, adding the execution of that command when the device is re-added. This is the patch:
--- gpsd.hotplug.orig 2010-06-02 23:03:02.000000000 +0200
+++ gpsd.hotplug 2011-04-22 12:44:32.000000000 +0200
@@ -114,6 +114,9 @@
hotplug(os.getenv("ACTION"), os.getenv("DEVPATH"))
else: # Called by hand for testing
gpsd_control(sys.argv[1], sys.argv[2])
+ if sys.argv[1] == 'add':
+ # Wake-up all the listening clients.
+ os.system("/usr/bin/gpspipe -r -n1 &")
except:
(exc_type, exc_value, exc_traceback) = sys.exc_info()
syslog.syslog("gpsd.hotplug: exception %s yields %s" % (exc_type, exc_value))
==== Problem #2: permissions ====
With Debian Lenny there is a **permission problem**: if gpsd starts with no GPS connected, it switches to group **nobody**. When a GPS is connected, udev add the ''/dev/ttyUSB'' device as **root:dialout** and ''/lib/udev/gpsd.hotplug'' assigns mode **0660**. In this scenario gpsd cannot read the device.
A workaround is to create a node for ''/dev/ttyS0'' owned by group dialout at boot time, even if no such device is present. Per default ''gpsd'' will read the group of this device and switches to that group.
It should be possibile to create such a static device into **''/lib/udev/devices/''**, udev will copy it under ''/dev/'' at boot time:
mknod -m 0660 /lib/udev/devices/ttyS0 c 4 64
chown root:dialout /lib/udev/devices/ttyS0
===== Navigation =====
{{.:gps:navit_snapshot2.png?320 |}}I did not tried it extensively, but I was quite impressed: the EeePC's screen size (800x480) is acceptable, panning and zooming are quick.
Turn-by-turn routing is working: point the map, right-click and **Set as destination**!
===== Speech =====
You can have **turn-by-turn speech** indications by installing the **speech-dispatcher-festival** package. It will install the speech daemon plus the **festival** speech synthesis system. I installed also the Italian voice module. This is the list of Debian Lenny packages:
* speech-dispatcher-festival
* festvox-kallpc8k
* festvox-italp16k
* festvox-itapc16k
To verify that your text-to-speech system is working, try this:
echo "Ti ho nel cuore ma ti vĂ² nel culo" | iconv -f UTF-8 -t ISO-8859-1 | festival --language italian --tts
To let Navit use text to speech, add the following line in **''navit.xml''** config file:
If Italian is not your default locale, you can start Navit just after setting it:
export LANG=it_IT.UTF-8
navit