March 2, 2006

Linux and smart phones

Author: Luigi Paiella

So you want a cell phone that's also a PDA? Smart phones can make calls, synchronize your calendar with your PC, act as data storage devices, and connect your PC to the Internet. You can use your Linux PC to connect with and even program some mobile phones using some of the following tools.

In testing these open source applications I used a Nokia phone running Symbian OS v8.0 and the Series 60 Platform second edition user interface, with USB, Bluetooth, and Internet connectivity. My computer is a laptop with Kanotix, a Debian-based distribution.

PIM synchronization

The first connectivity tool I tried was Gnokii, a command-line application licensed under the GPL. Gnokii lets you connect many different types of mobile devices not only with Linux, but also with Windows and Unix systems. Depending on your phone model, you can make data calls, synchronize your address book and calendar, send and receive SMS messages, and more. Symbian-based phones in particular use a new protocol that forced gnokii developers to adopt a client-server architecture: The client, running on the PC, talks with the server running on the phone. Gnokii can communicate with mobile devices through serial, infrared, USB, and Bluetooth connections.

I find PIM synchronization is more user-friendly when it's done wirelessly. Bluetooth lets you keep the phone in your pocket while exchanging data. Once you've configured your Bluetooth device under Linux and installed the latest applet on the phone (gnapplet.sis) and the corresponding gnokii package on the PC (make sure that gnapplet and gnokii are the same version) you can run gnapplet from the Symbian phone's menu and gnokii from the Linux shell. To see the first five contacts on your phone, issue the command gnokii --getphonebook ME 1 5, where ME represents the internal memory of the equipment; 1 is the first position in the address book and 5 is the last. With the options --getcalendarnote and --gettodo I was able to retrieve calendar items and a to-do list, but I couldn't do much more.

Unfortunately, many of gnokii's options didn't work with my phone, and manually activating the applet didn't create an automatically scheduled synchronization task.

Data transfer

Transmitting data between my phone and Linux with both USB and Bluetooth was fairly easy. You can make the Bluetooth connection through P3nfs, another GPL-licensed application. P3nfs lets you mount the file system of the phone on your *nix machine. For Series 60 phones, P3nfs can work through TCP/IP and infrared in addition to Bluetooth.

Like gnokii, P3nfs uses an applet on the phone (which you can install through its .sis package) and an application on the PC. Start the applet on the phone by picking the NFS icon, and invoke the PC program on the server side with a command like p3nfsd -series60 -tty /dev/rfcomm0. You will see all the phone's drives mounted on your Linux machine in the directory /mnt/psion.

To make a USB connection, I tried ObexFTP, which moves data to and from the phone more or less like a command-line FTP client without installing any software on the phone. It isn't too user-friendly, but you can work around that by employing developer Andrzej Szombierski's GPL-licensed mcOBEX application, an OBEX virtual file system that lets Midnight Commander act as an interface for ObexFTP. Once you adjust the mcOBEX script according to the instructions, it lets MC browse the drives of the mobile when you issue the command cd #mcOBEX on your PC. Its speed, ease of use, and stability are excellent.


Nokia developed a complete Python environment for Series 60 that lets you create programs and scripts for smart phones. An interesting added feature is the Bluetooth console application: Python commands written on the PC are sent to the mobile device's interpreter, and results are displayed back to the PC, promoting a fast learning curve and easy application development.

With the console properly configured, you can program your phone from almost any operating system. To use the Bluetooth console you need a listening Bluetooth RFCOMM serial port on the PC and VT100-compatible serial terminal software, such as cu. First, start your PC start listening on the Bluetooth port with a command like :rfcomm listen /dev/rfcomm0 10 &. Start the Bluetooth console on the phone, and issue a cu command (e.g. : cu -l /dev/rfcomm0). Now you can start sending commands directly to the phone's Python interpreter.

Internet connection

Smart phones can connect a computer to the Internet through the GPRS, UMTS, or EDGE protocols, depending on the phone's capabilities and network. I tested GPRS Easy Connect version 2.5 (GPL license). It's easy to use, intuitive, and works with both Bluetooth and USB. It also lets you monitor data volume limits, if your Internet provider contract imposes any, and, despite the name, it seems to allow UMTS and EDGE connections too. The only negative point was that sometimes my system became unstable when I was running the application, forcing me to reboot.

There are a lot of things you can do using smart phones in conjunction with Linux, though some of them remain tricky, and sometimes applications can become unstable due to changes in carrier protocols. I hope that mobile device producers' increasing interest in open source will lead to their offering greater support for open source software developers.

Click Here!