Some NOKIA N900 tips and tricks

The N900 page is now history, but I left it as is.

I am using now an android phone, rooted and modified for privacy, since the progress in hardware made N900 obsolete. It is a pity that Nokia was not faster and more aggressively marketing its linux phones and canceled the project in the end. Both the smartphone market and Nokia's stock price could have developed differently...

Turn by turn navigation on Nokia N900 with voice guidance using community extension of OVI maps

N900 users have been neglected in this respect by the company, but fortunately the community developed an improved version of OVI maps for N900 itself, particularly thanks to Blaizzen and CormacB. There was some confusion in the discussion thread, since the two versions posted were not compatible. For some reason I do not know, the HTML5 version does not work on my phone, so I will describe how to install the one by Blaizzen using the python server. There is no distribution package yet at the time of writing this note.

I have made some modifications, particularly to run the python server forever, and let it listen only at the localhost interface, and switching off the "onto street_name" part of voice guidance, since it did not work properly with Czech street names anyway. (Probably it might work if I would switch globally the phone localization to Czech and change the language in the python server, too, but I do not like to do this.)

To install and run it do the following:
0. assuming your phone locale has been set to english_us in the setup menu, otherwise change appropriately
1. Login to N900 as root
1.1 apt-get install espeakgui espeak libespeak espeak-data wget unzip
1.2 (optionally) espeak 'hello world' to check that it works
2. cd /usr/share/nokia-maps/html
3. mv index.html index.html.nokia; gzip index.html.nokia
4. wget http://www.pittnerovi.com/jiri/hobby/electronics/n900/maps.tar.gz
5. tar zvxf maps.tar.gz; rm maps.tar.gz
6. cd /home/user/MyDocs; mkdir navigation_sounds; cd navigation_sounds; wget http://static.s2g.gate5.de/maploadervoice/english_us.zip
6.1 unzip english_us.zip (do not rename to .wav)
6.2 cd /usr/share/nokia-maps/html ; ln -s /home/user/MyDocs/navigation_sounds/english_us .
6.3 change SOUNDPATH in speak_02.py if using different language directory
7. nohup ./speak_02.py >/dev/null &
7.1 (optionally) wget -O /dev/null http://localhost:9999/hello ; wget -O /dev/null http://localhost:9999/:g5ann_001 (to check that it works with both sampled and synthetized speach)
8. start OVI maps from the GUI.

How to use the N900 voice navigation with a FM transmitter and car radio

Of course, once the navigation works, the next thing which come to one's mind is to employ the fm transmitter to get a better sound via car's radio. However, the problem is that the FM transmitter switch itself off after a period of silence and the car radio, typically not equiped with a squelch, plays then noise, turning the whole setup pretty useless. This issue has been discussed at talk.maemo.org.
I have found a simple brute force wayaround:
1. start fm transmitter using the GUI or from command line using e.g. /usr/bin/fmtx_client -f 98700 -p 1
2. before it timeouts, enter in a root shell:
killall -kill fmtxd
echo 0 > /sys/class/i2c-adapter/i2c-2/2-0063/tone_deviation
(script with a clickable icon can be made for this)
Now it will not stop transmitting while the navigation is quiet, also regardless of charger being plugged in or not. The disadvantage is of course that control of the transmitter does not work, you have to again start it from the setup menu (even if you intend to switch it off). Also the Nokia media player also gets confused if fmtxd is not running and switches the transmitter off.
I have also looked at the kernel code in drivers/media/radio/si4713.c; it seems that turning the transmitter on/off is done by a v4l2 muting ioctl, probably on /dev/radio0. However, since the brute force hack worked, I did not further experiment in this direction.

Update: I have created a script to make the necessary steps comfortably by clicking an icon. You can install it in the following steps:
1. Install mapvoice.desktop to /usr/share/applications/hildon/
2. mkdir -p /usr/local/s; Install mapvoice.launch to /usr/local/s
3. mkdir -p /usr/local/bin/; Install kill_fmtxd to /usr/local/bin/; chmod 755 /usr/local/bin/kill_fmtxd; chown root /usr/local/bin/kill_fmtxd; chmod +s /usr/local/bin/kill_fmtxd
Source code of the setuid program is kill_fmtxd.c

How to pre-load ovi maps to N900 to avoid data roaming when navigating in a foreign country

Windows users: install and use the official Nokia map loader.
Linux users:
1. Download maps for your destination via links provided here and save the zip files on your PC.
2. Connect N900 by USB in mass storage mode and mount the internal flash partition somewhere.
3. cd /your/mount/point/cities/diskcache
4. unzip /your/file.zip
If it attempts to overwrite, it is better to clean first the whole disccache. Never combine several regional maps (which leads to overwrite), use a map of whole continent if needed, since the country maps have overlapping file names and the navigation would get pretty confused!
Notice that search for an address still needs an internet connection (but using much smaller data volume than map download). It can be avoided if you pick up the navigation target from the maps rather than geocoding an address.

In my opinion the remaining "killer feature" to be implemented is the import of personal points of interest and their displaying on the map, choosing them as navigation targets and saving new POIs at current GPS position. The wayarounds via contacts support only addresses, not directly GPS coordinates, as far as I know. I really do not understand why Nokia did not implement such basic functionality, available in 10 years old Garmin devices!



How to control miscellaneous functions of the phone from command line



See Maemo Wiki for a list



How to login to N900 over bluetooth

The N900 keyboard and terminal are of course not suitable for comfortable work when configuring the device. You can login via ssh, of course, but the phone has to be online and not beyond NAT and you have to find out its (dynamically assigned) IP, or you have to use openvpn. There is a possibility of USB networking, but that is not wireless. So it is pretty convenient to be able to login to the phone via bluetooth.
The Bluetooth rfcomm virtual serial port mechanism, which is used by pnatd to provide AT command modem interface, can also be used together with mgetty to get a login prompt.
How to do it with a linux PC:
0. As prerequisity, it is assumed that you installed bluetooth from your distro and paired with the phone.
1. Add to PC's /etc/bluetooth/rfcomm.conf (or where it is in your distro):
rfcomm4 { (instead of 4 take your first free number)
bind yes;
device 00:00:00:00:00:00; (replace with your N900's address obtained from 'hcitool scan')
channel 19;
comment "n900 getty";
}
2. Crosscompile mgetty using the scratchbox environment or download my binary and place it to /usr/local/bin/ on the phone.
3. on N900, create a file /etc/event.d/bluetooth-getty
description "getty over Bluetooth"
author "Jiri Pittner"

respawn
respawn limit 10 1
console none

start on started bluetoothd
stop on stopping bluetoothd

exec rfcomm -S -- listen -1 19 /usr/local/bin/mgetty -r '{}'

4. N900 root# initctl stop bluetoothd; initctl start bluetoothd
5. Start a terminal program and connect to /dev/rfcomm4 (baud rate irrelevant); press enter a few times until you get a login prompt
You might use my very simple terminal program smsm2.c, e.g. smsm2 -D /dev/rfcomm4 -II
6. Note for the paranoid ;-): Remember that Bluetooth does not employ top-grade encryption and can be sniffed e.g. with USRP and Gnuradio.

How to read your sms messages and read/write calendar entries via N900 command line

1. apt-get install sqlite3
2. crosscompile tcsh and date for N900 using scratchbox or download my binary tcsh and binary date, install them to /usr/local/bin and symlink tcsh to /bin/tcsh and /bin/csh
3. The script smsr reads sms messages, the script calendar can be used to edit your calendar from command line.
I find it quite convenient, particularly being logged into N900 via bluetooth. To send SMS messages from N900 command line, use the python script ssms.py from Maemo Wiki. Alternatively, it is possible to go via pnatd, sending from a PC's command line, using a program which connects to /dev/rfcomm0 and sends appropriate AT commands and converts text messages to PDU format. The source code is here smsm2.c. Presently only numbers in international format are supported, use it like
smsm2 -D /dev/rfcomm0 +420123456789
type text of SMS here, terminate with CTRL-D or ".\n"


How to turn a time-limited free wifi access to time-unlimited one



It happens that some hotspots (e.g. on airports) offer a time-limited free wifi access, employing the MAC address as a unique device identifier. To get next free session, and overnext one etc., change the MAC address of wlan0:
0. enable extras-devel repository
1. apt-get install macchanger
2. switch off wifi connection in menu
3. n900# macchanger -r wlan0
4. connect to the hotspot again, click through the web to get connection again

This trick is of course not specific for N900, it applies to any Linux computer. Some hotspots also filter all outgoing packets except http (and perhaps https), so employ proxytunnel. Anyway, skype seems to be able to tunnel its own traffic through http alone.

How to make encrypted VoIP calls using OpenVPN and SIP on N900 - see here.



How to use USB host mode on N900 with USB-RS232 adapter support

First of all, you will need a USB A-A socket-socket adapter. This might be hard to get, but it can easily be made by soldering together two USB sockets or perhaps soldering together corresponding pins on a USB double-socket.

0. It is worth to read the general information in maemo kernel wiki.
1. Get sources of the hostmode kernel:
[sbox-FREMANTLE_ARMEL: ~] > apt-get source kernel-hostmode
[sbox-FREMANTLE_ARMEL: ~] > tar jvxf /usr/src/kernel-hostmode-source.tar.bz2
[sbox-FREMANTLE_ARMEL: ~] > cd kernel-hostmode-source
2. make menuconfig or edit .config to switch on the modules you need. My .config is here.
3. You might change EXTRAVERSION in Makefile to name your kernel uniquely
4. make; make modules_install
5. copy the new module to N900, e.g. scp -r /opt/scratchbox/users/jiri/targets/FREMANTLE_ARMEL/lib/modules/2.6.28-hostmode2jiri root@n900:/lib/modules
6. n900# depmod 2.6.28-hostmode2jiri
7. switch phone off, connect it via usb and flash kernel
/usr/local/bin/flasher-3.5 -f -k /opt/scratchbox/users/jiri/home/jiri/mykernel/arch/arm/boot/zImage
8. Pray that the phone boots :-).
9. Nokia-N900-51-1:~# uname -a
Linux Nokia-N900-51-1 2.6.28-hostmode2jiri #1 PREEMPT Fri Nov 12 11:42:01 CET 2010 armv7l unknown
9.5 Connect the USB-serial cable, start the USB hostmode applet, override if it complains about kernel version, set full speed mode, click VBUS boost on, click Enumerate, do not click mount
10. Now /dev/ttyUSB0 should appear.
11. You might use this very simple portable terminal program smsm2.c, either crosscompile it using scratchbox or download my binary.
smsm2 -D /dev/ttyUSB0 -B19200 -I

Flashing Atmel AVR microcontrollers from Nokia N900 using USB-serial cable

It might be advantageous to have an easily portable device to reprogram an Atmel microcontroller in an already installed device. N900 can be used for this purpose, replacing the need to carry a notebook.
NOTE: It does not work with all USB-RS232 cables, particularly one based on PL2303 did not work for me, use a cable with FTDI FT232xx chip and all signals connected (can be hard to find, one is available here)!
Or, build your own convertor based on FT232BM or similar.

1. Install the hostmode kernel with FTDI ttyUSB support 2. Cross-compile this modified version of the UISP program for N900 using the scratchbox environment or download my binary and install it to say /usr/local/bin/ on your N900.
3. Copy the hex files to N900.
4. Make an adaptor connecting RS232 signals to AVR pins according to description in 'uisp --help'for -dprog=dasa. USE Zener diodes and resistors to adjust voltage levels!!!!!
Alternatively, build an adaptor yourself, omitting MAX232 chip, using only FTDI chip and use -dprog=dasaneg.
5. uisp -dlpt=/dev/ttyUSB0 --erase -dprog=dasaneg -dpart=atmega32 -v=3
uisp -dlpt=/dev/ttyUSB0 --upload --verify if=firmware.hex -dprog=dasaneg -dpart=atmega32 -v=3 --hash=12

Finally, some "philosophical remarks"

I find it very unfortunate that Nokia was so slow and hesitating with marketing of Maemo/Meego based phones (and that the new CEO killed N9/Meego completely in the end). It has thus lost its market share in smartphones totally and seems to be heading towards bankrupcy. If N900/N9 would have been offered via cell operators with discounts, and aggresively marketed as "True mobile computer, not just another smartphone", things could have come out differently. As of late 2012, it seems that the Meego's reincarnation under the name Jolla gives some hope that the effort towards a full-blown Linux for spartphones was not lost. I am curious which phones will support this system (i.e. give the necessary hardware specs to the Jolla developers). I am satisfied with N900 so that I will not buy a new phone until operators in Czech Republic achieve a reasonable coverage by LTE technology and I am optimistic enough to hope that in the meantime a LTE-capable phone with Jolla or some other Linux distribution (Ubuntu?) will become available.

From the free software perspective, Android is a big step backwards, since it strips Linux from the huge GNU software base (it employs incompatible libc and forks its kernel version). It was probably very tempting for the industry to be able to sell users plenty of "applications" which had to be newly developed in java/dalvik, rather than simply porting existing GNU applications to be well usable on small touchscreens. (Update: since it was recently announced that android changes will be merged again in the main linux kernel, there is now less room for criticism; I also got a cheap Android phone as a Christmas present for my son and played with it a bit: command line programs can be ported for such a phone easily by crosscompilation and STATIC linking with GNU libraries, circumventing in this way Android completely) However, what I find particularly irritating are the pompous announcements of marketing departments like e.g. "We have developed Android/iphone application for buying tickets for Prague public transport." What the fuck! Why to use a one-purpose "application" for something which is a matter of sending less than 10 bytes long SMS or could be done by visiting some web page? Who needs a one-purpose "application" to read news from one particular newspaper? No wonder that there are many 10000s of "applications" available. This is all garbage, it just brings adware and spyware to the machine; real and useful applications should be non-trivial programs, which can do some reasonably universal set of tasks.

In the end due to a lack of better LTE-capable phone, I bought a Samsung with Android 4.2.2. Getting some programs to work correctly on it, even such basic things as ssh/sshd/scp was really horror story - shame on Android!

Anyway, I hope that the smartphone market will in the long term develop the PC way - hardware makers (perhaps except Apple) will make phones compliant to standardized interfaces and users will be able to install operating system of their choice, be it GNU/Linux, Android, or Windows phone. (As of beginning 2013, it seems that this my hope might get a fulfillment sooner than I expected - Ubuntu announced recently that they want to support smartphones.) Of course, most users will stay with the preinstalled system :-), but the interested ones should have the freedom of choice.
Some well known companies try to misuse the UEFI secure boot feature to strip us from such a freedom, particularly on the ARM platform, please support the Free Software Foundation in their efforts to prevent this as well as other attacks on the freedoms of the internet.

The tech companies should try to maximize their profits by developing innovative products, not by locking their users into proprietary and restricted environments!

It should also be mentioned, that the core of a cellphone, the baseband processor with its software remains a huge stronghold of proprietary software. Of course, penetration of free software to this domain is against the commercial interests of the industry, since upgrade to new wireless technologies could then often be done using existing (already sold) hardware, thanks to configurable logic hardware, digital signal processing and software radio technologies. The proprietary nature of the baseband processing, which has thus not been much tested on security holes, poses actually a security threat - the situation here is analogous to computer networking 20 years ago. Nevertheless there is some effort of free software enthusiasts in this direction, which might bring fruits in the future - the the osmocomBB project. Fortunately, modern software radio tools based on fast D/A and A/D convertors and FPGAs to facilitate digital signal processing, make experimenting on this field available to a wide technically oriented public.

Electronics page


My hobby page


My main page with e-mail contact


TOP of my family pages