Using gammu to connect to a mobile phone

After switching between mobile phones several times I always lost some data, contacts, media, so on…

There is a Linux tool called Gammu which allows to connect a selection of mobile phones. It seems that Gammus functionality is maximal for Nokia and Siemens, but I will give it a try on my Sony Ericsson…

The configuration is not trivial and I found some hints on JohnMcClumpha.org:

Install Gammu

Installing gammu is surprisingly easy (once again thanks to the wonders of apt-get), just use the following command:

sudo apt-get install gammu

Hard wasn’t it? 😉

OK now it’s time to plug your phone in and see if we can get things talking. With the phone connected, type the following command:

lsusb

you should now see your phone listed as a device – for example:

Bus 001 Device 002: ID 0421:0802 Nokia Mobile Phones

if not – make sure your cables and power are all good and try again.

The gammu installation comes with some example configuration files which are worth using as a starting point – if nothing else they help you to understand how gammu can be configured so that you can tailor a solution for your needs. These are located in
/usr/share/doc/gammu/examples
(in gZip archives).

Copy the gammurc file to /etc/gammurc :

sudo cp /usr/share/doc/gammu/examples/config/gammurc /etc/gammurc

Now edit /etc/gammurc to specify your port and connection type (this will vary based upon where/how you have things plugged in and what sort of cable/interface your phone is using). The settings for mine are:

port = /dev/ttyACM0
connection = dku5

Save this config and from the shell type:

gammu --identify

you should now be presented with some information regaqrding your phone such as:

Manufacturer : Nokia
Model : 7200 (RH-23)
Firmware : 3.110 T (18-03-04)
Hardware : 0903
IMEI : 353363000813894
Original IMEI : 353363/00/081389/4
Manufactured : 04/2004
Product code : 0514143
UEM : 16

If this is the case then you have got gammu up and running and can send yourself a test message with the following command:

 echo "boo" | gammu --sendsms TEXT [recipient mobile number]
Advertisement