My favorites | Sign in
Project Logo
                
Search
for
Updated Feb 03, 2008 by zibree
sendmodem  
A tool to access the modem/baseband directly.

Introduction

The tool sendmodem is a tool that directly accesses the modem/baseband through /dev/tty.debug without the need to disable the commcenter.

Details

Normally, the modem/baseband is accessed through minicom which issues commands to /dev/tty.baseband. In order for minicom to work, the commcenter first needs to be disabled, then your can run minicom, and after you are done with minicom you again need to enable the commcenter.

# cd /usr/bin
# launchctl unload -w /System/Library/LaunchDaemons/com.apple.CommCenter.plist
# minicom
# launchctl load -w /System/Library/LaunchDaemons/com.apple.CommCenter.plist

With sendmodem commands to the modem/baseband can be directly executed from the commandline.

In order to use sendmodem on your iPhone, do the following:

  1. Upload the file sendmodem to your iPhone in /usr/bin (use your favorite program for this e.g. winscp, ibrickr, etc.)
  2. On your iPhone execute the following commands (e.g. from the terminal window or through ssh):
  3.   # cd /usr/bin
      # chmod +x sendmodem

To try sendmodem out, you can execute on your iPhone the following commands:

which will respond with:
  usage: sendmodem <at command>
  examples:       sendmodem "AT+XSIMSTATE=1"
                  sendmodem "AT+XGENDATA"
                  sendmodem "AT+CLCK=\"SC\",2"
which will respond with (depending on your firmware and bootloader version):
  Sending command to modem: AT
  --.+
  AT
  OK
  Sending command to modem: AT+XGENDATA
  -..+
  AT+XGENDATA
  +XGENDATA: "
  ",
             "DEV_ICE_MODEM_04.01.13_G",
  "EEP_VERSION:207",
  "EEP_REVISION:8",
  "BOOTLOADER_VERSION:3.9_M3S2",1,0
 
  OK

Notes

  1. sendmodem always initiates communication to the modem/baseband with the "AT" command and waits till it receives the response "OK". While waiting it will write "-" to your screen. Be patient, the amount of dashes can very from a few to many.
  2. The original modem state is saved before any commands are send and restored after executing your commands.
  3. The original code was obtained from the iPhone-sms application source code, available from http://code.google.com/p/iphone-sms and was slightly modified in its screen output format
  4. Make sure not to send any commands to the modem of which you don't know what its effect is (you don't want a brick right?)

Another example

Have you ever wondered how to make iTunes display your phone number if it is not showing? Here are the commands to enter:

Usually it will respond with "SM" (general addressbook). If the response is not "ON", we change the addressbook to "ON" (SIM card owner specific numbers):
  # sendmodem "AT+CPBS=\"ON\""

And voila, iTunes should be displaying your phone number under the summary tab and also if you scroll to the top of your contact list on the phone, you should now see your phonenumber.


Comment by shade.ge, Nov 24, 2007

Works fine! iTunes now shows my phone number! Thanks to everyone.

Comment by paulmsk, Dec 01, 2007

Thank you! Looks great!!! But I have another question. Can I with sendmodem command change carrier name? My operator is "Megafon RUS", but on my iPhone displayed "Mega..."

Comment by hquest, Dec 03, 2007

Any way by using AT commands to set a different GSM frequency on the phones? At least one of 4 valid ones (850/900/1800/1900 MHz)?

Comment by g.raghavrao, Dec 16, 2007

Hi... When i do this step

  1. sendmodem "AT+CPBW=1,\"+919885122245\",,\"Bablu\""

iam getting the following error.... # sendmodem "AT+CPBW=1,\"+919885122245\",,\"Bablu\"" Sending command to modem: AT -.+ AT OK Sending command to modem: AT+CPBW=1,"+919885122245",,"Bablu" -..+ AT+CPBW=1,"+919885122245",,"Bablu" ERROR

Need your help to proceed forward...

Comment by PmgRiPhone, Dec 16, 2007

>> g.raghavrao

Make sure you have the right address book selected in the SIM card with the command:

sendmodem "AT+CPBS=\"ON\""

You can try executing the same command, but omitting the + sign in the number (it is optional). If that doesn't work, try to remove Bablu from the name string (so just put two backslash quotes only; an empty name string):

sendmodem "AT+CPBW=1,\"919885122245\",,\"\""

Comment by g.raghavrao, Dec 17, 2007

Hi...

sendmodem "AT+CPBW=1,\"919885122245\",,\"\""

worked fine. I can see my number in itunes and address book. Thanks a lot :)

Comment by olivier.hoachuck, Dec 24, 2007

Hi,

For some reasons I have a "16(Resource busy)" error when I try the basic command like this : sendmodem "AT+XGENDATA"

Any clue ?

oho

Comment by olivier.hoachuck, Dec 31, 2007

Yo Guys ...,

Still any clue ?

O.

Comment by olivier.hoachuck, Jan 17, 2008

:(

Comment by dimonb, Feb 04, 2008

may be you shoud stop somebody using it? launchctl unload -w /System/Library/LaunchDaemons?/com.apple.CommCenter?.plist

Comment by ambrosei...@yahoo.com, Feb 05, 2008

After my accidental upgrade to 1.1.3 of my OTB 1.1.2 moderm firmware 04.02.13_G

I have managed to find my way back to 1.1.2 modem firmware 04.03.13_G. (Thank you all that has contributed in making it possible to bring back my iphone to this current state.Thank you guys).

The phone now complains with every sim card (including the original OTB sim card)"incorrect SIM" No longer respects NEXTSIM or TurboSIM.

Can this routine perhaps able to re-instate the modem firmware to 04.02.13_G. If so how does one proceed.

Comment by namjam105, Feb 07, 2008

Add Source installer : http://iphonebaidu.com/app/ Test iPhone - iPhone Simulator : http://iphonebaidu.com/test/ All Software for Apple MAC : http://iphonebaidu.com/mac-iphone/ All Software for Apple iPhone : http://iphonebaidu.com/mac-iphone/iphone.html

Install iTransformy (.swf) view for iPhone : http://iphonebaidu.com/beta/ Forum iPhone : http://iphonebaidu.com/forum/

Copyright © 2008 iPhone Baidu! Inc. All rights reserved

Comment by jorge.asch, Feb 29, 2008

Why am I unable to save the output of sendmodem?

I want to save into a text file the phone number of the SIM

sendmodem "AT+CNUM" >output.txt produces a 0 byte file, and output is shown on screen.

Can this be fixed?

Comment by federico.schwindt, Mar 05, 2008

@jorge.asch:

Use: sendmodem "AT+CNUM" >output.txt 2>&1

Comment by smokemeout, May 01, 2008

when i type sendmodem "AT+CPBS=\"ON\"" it returns an error any ideas why?

Comment by smokemeout, May 01, 2008

by the way i have given it permissions - #chmod +x sendmodem

Comment by prabhat.kasera, May 07, 2008

can u help me out .. whhat shoul i do to send smsm through the /dev/tty.debug have any idea, what should be the procedure?

thanks in advance

Comment by hagenuk, May 15, 2008

if I want to use sendmodem to send a sms from commandlind how is is done ?

it does allow me to include my text message when I used:

sendmodem at+cmgs=13456789

Comment by craftyguy, May 19, 2008

Is there any way to emulate keypresses in sendmodem? For example, I want to execute: sendmodem "AT+CMGF=\"+1234567890\""

This AT + command requires a <CR>, followed by a string of text, followed again by a <Ctrl+z> to end the command. The whole thing would look like this:

AT+CMGF=+1234567890 <CR> >Hello world<Ctrl+z>

Comment by adrian.werner, May 22, 2008

could you provide an example of "How to send an SMS using sendmodem" I found a tutorial http://www.developershome.com/sms/howToSendSMSFromPC.asp saying:

AT OK AT+CMGF=1 OK AT+CMGW="+85291234567" > A simple demo of SMS text messaging. +CMGW: 1

OK AT+CMSS=1 +CMSS: 20

OK

everything works as aspected till the #AT+CMGW="+85291234567"' command. it seems like sendmodem does not provide the msg-text input.

Thanks a lot.

Adrian

Comment by vicky2007dec, Jul 29, 2008

Will anyone tell me how to send sms from SQL Schedular

Comment by jpmhouston, Sep 30, 2008

i'm trying to do something similar in my app and open("/dev/tty.debug"..) is returning -1. is there a reason this code wouldn't work in app built in Xcode by the SDK?? thx

Comment by jpmhouston, Sep 30, 2008

(duh, forgot..) and it looks like open returns with errno=1

Comment by shujaamin, Oct 15, 2008

endmodem AT+XGENDATA sending command to modem: AT

generates only - - - - where is the problem

Comment by shade.ge, Oct 24, 2008

Hi all,

this also works in the lastest iPhone 3G with firmware 2.1, but you need, for sure, jailbreak and then sign the binary with sauriks tutorial.

Greetings

Shade (www.iphonefix.de)

Comment by narender.mudgal, Jan 07, 2009

I am having the same problem like open("dev/tty.debug") returning -1 and exited with status 1. I stuck here and not going further to complete my application. I need your help. Thanks n@ren.


Sign in to add a comment
Hosted by Google Code