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]
Advertisements

4 thoughts on “Using gammu to connect to a mobile phone

  1. sorry for disturbing but i have little dificult in setting up gammu,
    i have managed to setup gammu for sending sms, receiving sms, but i can’t get to test and work runonreceive… it woun’t work

    i am using huawei k3765 usb, and a Huawei E220 usb, and both of them have same problems,

    please can you help me????

    the problem i have is that if i run the bash file under ubuntu command it works just fine, but it woun’t work automatic.
    both files has chmod 755, or chmod a+x privillege, if there are run independent they work, they are inserting in mysql and gammu sends the messages, but i can’t get it run to work on gammu-smsdrc file

    where do i go wrong, sorry for misspelling, i am new in setting up, i have tryed everything.

    bellow you have my configuration file.

    thanks in advance, and have a nice day

    root@s1:~# gammu –identify
    Device : /dev/ttyUSB0
    Manufacturer : Huawei
    Model : unknown (K3765)
    Firmware : 11.126.03.09.00
    IMEI : 351617041622867
    SIM IMSI : 226019631314686

    or the second i have tested :

    root@S1:~# gammu –identify
    Device : /dev/ttyUSB0
    Manufacturer : Huawei
    Model : E220 (E220)
    Firmware : 11.117.10.00.00
    IMEI : 351827013006904
    SIM IMSI : 226018055206982

    the gammu-smsdrc config #########
    [gammu]
    port = /dev/ttyUSB0
    connection = at115200
    logformat = textall

    [smsd]
    runonreceive = /etc/script.sh
    service = sql
    driver = native_mysql
    logfile = syslog
    user = root
    password = rootPassword
    pc = localhost
    database = gammu
    debuglevel = 255

    the script.sh #########
    #!/bin/bash
    php -q /var/www/sms/test.php

    the test.php script #####
    #!/user/bin/php -q

    1. Sorry, did not catch your comment/request. Honestly, I never used Gammu very much and stopped using it some time ago. So, sorry I cannot really help you on this.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s