Togaware OpenMoko Neo1973
Desktop Survival Guide
by Graham Williams
Google

Command Line Dialer

We can place and receive calls using a command line interface that uses an extended version of the traditional modem command set. For those familiar with controlling modems we use the AT command set. Underneath the graphical interface presented by the Dialer application it is simply sending the same commands as those introduced here. Of course, with the graphical interface we do not need to know or remember all of this detail.

We will use the call up program, cu, to issue the commands to the GSM device in the Neo. Alternatives include using the higher level tool libgsmd-tool.

We first ensure that the gsmd daemon that manages and controls the GSM device is not running, as otherwise it may interfere with our manual command line interactions. We do this with:

neo$ /etc/init.d/gsmd stop

Next we reset the gsm modem so that it is in a known state! The following two commands first turns off the GSM and then turns it back on:

neo$ echo 0 > /sys/bus/platform/devices/gta01-pm-gsm.0/power_on
neo$ echo 1 > /sys/bus/platform/devices/gta01-pm-gsm.0/power_on

We then start the cu program (which has stopped working with 2007.2) or the libgsmd-tool. Both provide command interfaces to send text to a specified device (in this case, to the GSM device):

neo$ cu -l /dev/ttySAC0
Connected.
AT-Command Interpreter ready

or

neo$ libgsmd-tool -m atcmd
libgsm-tool - (C) 2006 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

With cu we will receive a ``Connected.'' line, and importantly the AT-Command Intererpreter ready line (this seems to be regularly truncated) indicating that the AT command interpreter is running, and so everything looks okay. After this we might verify the connection by entering an AT followed by Enter, to get an ``OK'' message:

AT
OK

Here we see the style we will use to show the interaction (since there is no prompt as such). We have typed the AT (it does not need to be type in capitals) and then pressed the Enter key and the modem has responded with OK. Note that even though we have type AT it is not actually displayed (yet).

We are now ready to talk directly to the GSM!

To see what we are doing it is best to turn on echoing with the AT echo command (note that you can use Ctrl-H to backspace over mistakes). Also note that the device will respond with an OK:

ATE1
OK

We first power up the GSM modem:

AT+CFUN=1
ERROR

This returns ERROR, which is what it should return (but not sure why).

Enter the SIM card's pin (if it has/needs one):

AT+CPIN="1234"
OK

We need to ensure we are actually connected to our mobile telephone provider. This will register us with our network provider:

AT+COPS
OK

To find out our service provider's identity we can use:

AT+COPS?
+COPS: 0,0,"YES OPTUS"
OK

In fact, we can even get a list of available providers:

AT+COPS=?
+COPS: (2,"YES OPTUS","Optus","50502"),
(3,"Telstra Mobile","Telstra","50501"),
(3,"vodafone AU","voda AU","50503")

OK

To dial a number (first of all we may like to use XnullXXnullXprogramsapplications (application)programsbuttons (button)programsfiles (file)programspaths (path)programsprograms (program)programsmenus (menu)XnullXprogramsprogramsalsactl to set up the gsmhandset configuration and set the volume appropriately using XnullXXnullXprogramsapplications (application)programsbuttons (button)programsfiles (file)programspaths (path)programsprograms (program)programsmenus (menu)XnullXprogramsprogramsalsamixer, as described in Section 13.3):

ATD555

To hang up:

ATH

To exit

~.

Thus, a complete typical sequence for making a phone call might be (for those who will cut-n-paste this):

/etc/init.d/gsmd stop
echo 0 > /sys/bus/platform/devices/gta01-pm-gsm.0/power_on
echo 1 > /sys/bus/platform/devices/gta01-pm-gsm.0/power_on
cu -l /dev/ttySAC0

AT+CFUN=1
AT+CPIN="<pin>"
AT+COPS
ATD<number>

There's a lot more we can use the AT commands for and we cover some of them here, and focus on using them for messaging in Section 7.3. We can see a summary of some AT commands at the Wiki at http://wiki.openmoko.org/wiki/Hardware:AT_Commands. To get a full list available/implemented commands:

AT+CLAC		List available commands

To check your SIM's International Mobile Subscriber Identity (or imsi), which is an identity number that we probably should not reveal publicly:

AT+CIMI
<15-digit-number>

To get some other information:

AT+CGMI		Request manufacturer identification
+CGMI: "FIC/OpenMoko"

OK
AT+CGMM		Request model identification
+CGMM: "Neo1973 GTA01 Embedded GSM Modem"

OK
AT+CGMR		Request revision identification
+CGMR: "HW: GTA01Bv4, GSM: gsm_ac_gp_fd_pu_em_cph_ds_vc
                           _cal35_ri_36_amd8_ts0-Moko1"

OK
AT+CGSN		Request product serial number identification
+CGSN: 534321126083726

OK



AT+CNUM
+CNUM: "Line1","",255
+CNUM: "Line2","",255

OK

Other commands:

AT+CGSN			IMEI Number
AT+CIMI			Return 15-digit IMSI number of the SIM
ATE0V1
ATE0
AT+CFUN=1
AT+COPS=0

The full specification of the commands for controlling the GSM device is available as the Global System for Mobile Communications Technical Specification of 1998. A convenient guide is available from http://www.phonestar.com.my/s_at.html.



Subsections
Copyright © 2007 Graham.Williams@togaware.com
Support further development and obtain the PDF version of the book.
Brought to you by Togaware.