February 25, 2005

Gammu open source cell phone synchronisation tool

Author: Tony Granberg

I've been an enthusiastic owner of a GSM cellphone since 1999. I soon bought a serial communication cable to connect it to my PC. Since then I've tested several tools to retrieve and send data between the two. Searching the net one day I came across Gammu, a Linux-based command-line-driven open source synchronisation and backup tool written in C, focused mainly on Nokia models old and new. Gammu lets you retrieve and send SMS directly from your PC, synchronize your address book data, manage your calendar, and check out internal information about your phone's firmware and IMEI number.

To begin testing Gammu, you'll need the following, in addition to the software itself:

A compatible cell phone (I used a Nokia 7110i)An original (for Nokia, DCT3 or DCT4) or third-party FBUS/MBUS serial or USB cell phone connection cable (I used an RS-232 serial cable)Serial support in the Linux kernel

Begin with checking that you have serial support in your Linux kernel. In the Linux 2.6 kernel, go to your Linux source code directory (usually /usr/src/linux) and type make menuconfig or make xconfig.
Look for serial support. In, I found it in the menu category Device Drivers. Continue under that to Character Devices >> Serial Drivers. Check either [x] or [M] for the "8250/16550 and compatible serial port" option, then follow standard Linux source code compilation routines. You can find a HOWTO guide on this subject at Digitalhermit.com.

Unpack the Gammu archive (gammu.tar.gz) and run the usual configure script:

tar zxvf gammu.tar.gz
cd gammu-1.00.0
make && make shared
make installshared && make install
cp /usr/local/share/doc/gammu/examples/config/gammurc $HOME/.gammurc

Look at the .gammurc file using your favorite text editor. This is how my configuration file for Arch Linux looks:

port = /dev/tts/0
model = 7110
connection = fbus
synchronizetime = yes
logfile = gammulog
logformat = textall
use_locking = yes
gammuloc = locfile
startinfo = yes

Open source vs. commercial

The cell phone software utility business seems to be centered mostly on Windows. The available open source tools usually run from the command line. Other than that, the features found in the two kinds of cell phone utility applications are more or less equal. You can choose an application based on software availability, price, interface design, visual features, and setup ease. Another consideration is cable type support -- serial or USB. Nowadays vendors are using USB interfaces more frequently to connect phones and PCs to simplify usage and setup and facilitate higher transfer rates between phone and computer.

The port value will differ depending on your system settings. Sometimes the older /dev/ttyS0 or /dev/ttyS1 devices are used instead.
To validate that the configuration was successful, type gammu --identify, which outputs information about the cell phone directly to the terminal. If you're able to read the cell phone device information on your screen, the connection is working.

Some interesting commands to try out:

gammu --monitor 1 This command will output information about free and occupied space for SMS, number of calendar entries available, your phone's battery status, GSM network signal strength, SIM card space utilisation (divided in different categories), additional GSM network status, etc. If you change it to gammu --monitor you can get Gammu to monitor the status continuously, until you hit Ctrl-C on your keyboard.gammu --backup /home/tony/n7110bkp.dat Backup your phone's data to a file called n7110bkp.dat stored in /home/tony. Unless you append the -yes argument you will get prompted with questions about whether to save data in Unicode format, and which information to backup (SMS, address book entries, calendar notes, logos, ringtones, etc.). The input is case-sensitive. Note: I follow the 8.3 filename convention so I can transfer the backup file to any filesystem without any issues.gammu --restore Information about your backed up data will be displayed for you, along with date and time of backup. At the same time, you get prompted about whether and what to restore from a previously backed up file.gammu --getwapsettings start# stop# On my Nokia 7110i phone, I can use the Internet through a dial-up fax modem and reach WAP pages. This command retrieve the WAP settings stored in your phone. Passwords are passed in cleartext form, so paranoid people should think twice before using this command. However, it's extremely useful and practical.gammu --nokiagetadc Battery information for Nokia phones.gammu --nokiaselftests Check the general health and status of a Nokia phone. Very useful for testing the status of a purchased used phone. It might be able to help you determine if you should send the phone to a repair shop.gammu --reset SOFT Reboot your phone's firmware.gammu --reset HARD Reboot your phone completely, and be prepared to enter a PIN code unless there isn't one configured.

Wammu -- a Python front end for Gammu

Once you're comfortable with Gammu's commands, you might want to take a look at Wammu, a Python-based GUI constructed to easily deal with cell phone information management.

Managing contacts, messages, and other files on the command-line can be very tedious. A GUI can help you get things done more quickly. That's what Wammu is for. Wammu requires requires Gammu itself, python-gammu, and wxpython be installed on your system in order to run properly. To compile Python applications the standard way, use python setup.py build and then python setup.py install to install the files on your system.

After you have installed Wammu and its dependencies, simply launch it with wammu & and then go to its Settings menu, where you will discover entries from the .gammurc file. I suggest you do not use the "automatically connect to phone on startup" feature found in that dialog, because it might cause you trouble if an experimental setting fails and you need to restart the program to reconfigure it before initialising the phone connection.

After the configuration is complete, go to the Phone >> Connect menu and click on the Retrieve choice to choose what information you want to fetch from the phone. When you do that, the application will download the files from your phone into Wammu.

If you want to send off an SMS message, go to New >> Message. Fill in the appropriate values in the resulting dialog box and press the OK button to send off your message. (Keep in mind that this SMS is charged from the phone, not the computer!)

Summing up

Gammu is a nice cell phone management tool that simply works. It is open source, stable, intelligent, feature-rich, complex, and at the same time it is fun to experiment with. The Wammu interface, however, will have to reach a stable 1.0 release before I consider it to be a reasonable competitor to any of the commercial counterparts available for Windows. Because of the time and fiddling required to make everything work, I recommend this software mainly to experienced Linux users.

Tony Granberg is a 21-year-old student from Sweden with six years of experience using Linux software.


  • Open Source
Click Here!