How to install Gammu on Lubuntu 14.04

linux insideMy friend bought Wavecom 1306B gsm modem for his campus last task. He use Windows XP and trying to use the modem without success. He try it on his friend laptop that run Windows 7 also not work and he ask me to try it. Just to test the modem. If its not work might then He will return it to the seller.

I use Lubuntu 14.04 but I think the instruction would be same for Ubuntu 14.04 variant :

Install Gammu

# apt-get install gammu
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libgammu-i18n libgammu7
Suggested packages:
wammu gammu-doc
The following NEW packages will be installed:
gammu libgammu-i18n libgammu7
0 upgraded, 3 newly installed, 0 to remove and 128 not upgraded.
Need to get 1.051 kB of archives.
After this operation, 3.161 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

………………………..
…………………………..
………………………………
Preparing to unpack …/libgammu7_1.33.0-3_i386.deb …
Unpacking libgammu7 (1.33.0-3) …
Selecting previously unselected package gammu.
Preparing to unpack …/gammu_1.33.0-3_i386.deb …
Unpacking gammu (1.33.0-3) …
Selecting previously unselected package libgammu-i18n.
Preparing to unpack …/libgammu-i18n_1.33.0-3_all.deb …
Unpacking libgammu-i18n (1.33.0-3) …
Processing triggers for man-db (2.6.7.1-1) …
Setting up libgammu7 (1.33.0-3) …
Setting up gammu (1.33.0-3) …
Setting up libgammu-i18n (1.33.0-3) …
Processing triggers for libc-bin (2.19-0ubuntu6) …
#

# apt-get install gammu-smsd
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libdbi1 libgsmsd7 libodbc1 libpq5
Suggested packages:
gammu-doc libmyodbc odbc-postgresql tdsodbc unixodbc-bin
The following NEW packages will be installed:
gammu-smsd libdbi1 libgsmsd7 libodbc1 libpq5
0 upgraded, 5 newly installed, 0 to remove and 128 not upgraded.
Need to get 389 kB of archives.
After this operation, 1.331 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

………..
……………
……………….

ureadahead will be reprofiled on next reboot
Setting up libodbc1:i386 (2.2.14p2-5ubuntu5) …
Setting up libdbi1:i386 (0.9.0-1) …
Setting up libpq5 (9.3.4-1) …
Setting up libgsmsd7 (1.33.0-3) …
Setting up gammu-smsd (1.33.0-3) …
Adding user gammu to group dialout
*  gammu-smsd not yet configured, please edit /etc/gammu-smsdrc
Processing triggers for libc-bin (2.19-0ubuntu6) …
Processing triggers for ureadahead (0.100.0-16) …
#

Check Modem Appearance

Now put the modem on USB to check if Lubuntu can detect it.

# dmesg | grep usb

684.587832] usb 2-1.2: new full-speed USB device number 13 using ehci-pci
[  684.681358] usb 2-1.2: New USB device found, idVendor=067b, idProduct=2303
[  684.681370] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  684.681377] usb 2-1.2: Product: USB-Serial Controller
[  684.681382] usb 2-1.2: Manufacturer: Prolific Technology Inc.
[  684.786245] usbcore: registered new interface driver usbserial
[  684.786264] usbcore: registered new interface driver usbserial_generic
[  684.786279] usbserial: USB Serial support registered for generic
[  684.792012] usbcore: registered new interface driver pl2303
[  684.792035] usbserial: USB Serial support registered for pl2303
[  684.794098] usb 2-1.2: pl2303 converter now attached to ttyUSB0

Great. Its prolific message mean its detected. Note the position. ttyUSB0

Create configuration file for SMS modem

#nano /root/.gammurc

Put these lines :

[gammu]

port = /dev/ttyUSB0
model =
connection=at115200
synchronizetime=no
logfile=/var/log/smsdlog
logformat=nothing
use_locking=
gammuloc=

save by hit CTRL+X.

Detect connection between Gammu and Linux

# gammu --identify

Device               : /dev/ttyUSB0
Manufacturer         : Wavecom
Model                : MULTIBAND  900E  1800 (MULTIBAND  900E  1800)
Firmware             : 641b09gg.Q2403A 1320676 061804 14:38
IMEI                 : 012345678901234
SIM IMSI             : 510106852771013
#

Configuration of SMS Daemon

#nano /etc/gammu-smsdrc

Put these lines :

# Configuration file for Gammu SMS Daemon

# Gammu library configuration, see gammurc(5)
[gammu]
# Please configure this!
port = /dev/ttyUSB0
connection = at115200
# Debugging
#logformat = textall

# SMSD configuration, see gammu-smsdrc(5)
[smsd]
service = sql
logfile = /var/log/smsdlog
# Increase for debugging information
debuglevel = 0

# Paths where messages are stored
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
errorsmspath = /var/spool/gammu/error/

#mysql connnection
Driver=native_mysql
User=root
Password=123456
PC=Localhost
Database=test
PIN=1234
CheckSecurity=0

save the file.

Create MySQL database for gammu

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 316
Server version: 5.5.35-1ubuntu1 (Ubuntu)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> create database test;
Query OK, 1 row affected (0.00 sec)

mysql>

Import Table structure for Gammu

#cd /usr/share/doc/gammu/examples/sql
# ls
mysql.sql.gz  pgsql.sql.gz  sqlite.sql.gz
# gunzip mysql.sql.gz
# ls
mysql.sql  pgsql.sql.gz  sqlite.sql.gz

# mysql -uroot -p test < mysql.sql

Enter password:
root@alamsyah-Aspire-E1-471:/usr/share/doc/gammu/examples/sql# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 318
Server version: 5.5.35-1ubuntu1 (Ubuntu)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show tables;

use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+——————+
| Tables_in_test   |
+——————+
| daemons          |
| gammu            |
| inbox            |
| outbox           |
| outbox_multipart |
| pbk              |
| pbk_groups       |
| phones           |
| sentitems        |
+——————+
9 rows in set (0.00 sec)

mysql>

Run the service

# /etc/init.d/gammu-smsd start
* Starting Gammu SMS Daemon gammu-smsd                                                                                                                                 Log filename is “/var/log/smsdlog”
[ OK ]
#

Check the service

# tail -f /var/log/smsdlog
Fri 2014/05/30 10:35:35 gammu-smsd[4775]: Connected to Database: test on Localhost
Fri 2014/05/30 10:35:35 gammu-smsd[4775]: Connected to Database native_mysql: test on Localhost
Fri 2014/05/30 10:35:35 gammu-smsd[4775]: Created POSIX RW shared memory at 0xb76f1000
Fri 2014/05/30 10:35:35 gammu-smsd[4775]: Starting phone communication…
Fri 2014/05/30 10:35:43 gammu-smsd[4775]: Inserting phone info
^C
# ps ax | grep gammu
4775 ?        Ss     0:00 /usr/bin/gammu-smsd –daemon –user gammu –pid /var/run/gammu-smsd.pid
4781 pts/5    S+     0:00 grep –color=auto gammu
#

Check for credit

# gammu getussd *888#

Press Ctrl+C to break…
USSD received
Status               : Terminated
Service reply        : “Sisa Pulsa Anda Rp.2000. Penggunaan pulsa di periode ini Rp 0. Akhir periode. 23/06/2014. Seru!!!Video artis lagi, Tekan *500*444#”

Good. All things work and that mean the modem is not broken. My friend must figure out why he can make it run under Win XP or Win 7.