This software uses the Python Serial Port Extension to send Hayes AT commands to a mobile phone. It allows to backup phone book entries and sms messages. It does not provide synchronisation but allow phone book entries modification and deleting messages through a simple curses graphical user interface. It also provides a way to send or write sms messages to memory.

It is released under a free software license, see COPYING for more details.

Copyright 2007 2008 Charles Clément: caratorn _at_ gmail _dot_ com

NEWS: Export to vCard support.


This software is in development and could damage your phone or data. I couldn't be held responsible if something bad happened, use it at your own risk!

It has currently been tested with a SAMSUNG SGH-D900 model and provides read support for SGH-D520 and phonebook read support for SGH-E250.


Kernel Configuration


Download the current archive or access the subversion repository on the page.
Uncompress the archive with:

#tar xvzf [archive-name]
#cd pyhandset-[version-name]

And, as root:

./setup install

Software Configuration

The configuration file should be $HOME/.pyhandset/pyhandset.conf
Here's an example:

# Default Bluetooth device
#Handset.device = '/dev/rfcomm0'
# Default USB device
Handset.device = '/dev/ttyACM0'

Handset.BAUDRATE = '115200'

Handset.phonebook_file = 'phonebook.xml'

Handset.messages_file = 'messages.xml'


Usage: [options]

  -h, --help            show this help message and exit
  -d DEVICE, --device=DEVICE
                        Device filename to use
  -t, --test            Enter interactive mode
  -L, --list-contacts   Show contact list
  -l LOG_FILE, --log-transfer=LOG_FILE
                        Log to file
  -m, --retrieve-messages
                        Retrieve messages
  -r, --retrieve-all    Retrieve phonebook and messages
  -p, --retrieve-phonebook
                        Retrieve phonebook entries
  -g, --gui             Launch curses interface

  Dangerous Options:
    Caution: use these options at your own risk.

    -e, --edit          Gui edit mode [VERY DANGEROUS]
    -s SEND, --send-sms=SEND
                        Send/Write a sms message


To retrieve all the contacts from the sim card and phone: --retrieve-phonebook

To retrieve all the sms messages: --retrieve-messages

To view them in the graphical user interface: --gui

To export the saved phone book contacts to a file named contacts.vcf: -x contacts.vcf

Adding device support

If you are interested in getting this software to work with another cell phone you can write a protocol definition for your model, following the one in the file.

Most commands should be the same, if you are lucky enough your phone might even support the AT+CLAC command which list all available commands.

The answers then have to be processed by the python regular expression module (here is a good place to start). The kodos software can also be really helpful in testing and debugging regular expressions.


A very good introduction to AT commands.

3GPP TS 27.005: SMS specification and 3GPP TS 27.007: overall control and phonebook commands at ETSI.

This page is hosted on: Logo