How to use external modem in emulator?

829 views
Skip to first unread message

zhou...@gmail.com

unread,
Dec 4, 2007, 12:28:15 AM12/4/07
to Android Internals
Hi, guys,

I have a question about the emulator, I have one Motorola phone which
can be used as a USB modem, and I can send AT commands to it via
HyperTerminal in Windows XP, so I want to try it with Android emulator
because I found emulator has provided a option "-radio" to do this.

-radio <device> redirect radio modem interface to a host character
device

I started emulator by "emulator.exe -radio COM3 -useaudio -
verbose" (COM3 is my USB modem), emulator start but no signal detected
and can't make any call.

Do I misunderstand the help info or I did something wrong? Do anybody
try this before?

Thanks for your comments and suggestions.

Regards,
Alan

Digit

unread,
Dec 4, 2007, 5:30:28 AM12/4/07
to android-...@googlegroups.com
this is interesting, unfortunately, this will not work. the -radio <device> option was added as a debugging aid when developing the internal GSM modem emulation, it is not meant to pilot a real hardware.

even if you connect it to a real phone, you'll encounter the following limitations:

- first, Android abstracts the radio interface layer through a daemon that does the dirty talk to the hardware.
  the daemon is "product" specific, and the one provided with the emulator system is not meant to talk to all
  GSM modems, only a very small subset (which I don't know precisely). this means there is no guarantee
  that it will succesfully dialog with your phone (and the daemon "API" is not available right now, and still likely to change anyway)

  in case you're curious, note that you can still have a look at the AT exchanges with the command 'adb logcat -b radio' when the
  emulator is running.

- moreover, the voice and data streams are not passed through the AT channel (which is here the serial device that -radio connects to)
  but through a different system device that is not emulated in the emulator, nor supported in the emulated kernel

- finally, networking setup in an emulated system is quite different from a "real" one, so it is unlikely you would be able to pass any data
  through your phone even if you could solve the problems described above

I would be extremely surprised but happy to see this work, but this would require significant work.

shane....@gmail.com

unread,
Dec 5, 2007, 4:18:28 PM12/5/07
to Android Internals
I had to do something similar to get a GPS hooked up into the SDK.
This required creating a proxy (in C#) that reads serial input (com
port) and exposes the output through a socket. I've done some work for
handling this proxy, if anyone is interested, I can create a project
and upload it on open source site. I'm using a Garmin, which doesn't
require the init AT commands, so I haven't added the ability to push
commands to an external device.

Shane
> On Dec 4, 2007 6:28 AM, zhoua...@gmail.com <zhoua...@gmail.com> wrote:
>
>
>
>
>
> > Hi, guys,
>
> > I have a question about the emulator, I have one Motorola phone which
> > can be used as a USB modem, and I can send AT commands to it via
> > HyperTerminal in Windows XP, so I want to try it with Android emulator
> > because I found emulator has provided a option "-radio" to do this.
>
> > -radio <device> redirect radio modem interface to a host character
> > device
>
> > I started emulator by "emulator.exe -radio COM3 -useaudio -
> > verbose" (COM3 is my USB modem), emulator start but no signal detected
> > and can't make any call.
>
> > Do I misunderstand the help info or I did something wrong? Do anybody
> > try this before?
>
> > Thanks for your comments and suggestions.
>
> > Regards,
> > Alan- Hide quoted text -
>
> - Show quoted text -

shane....@gmail.com

unread,
Dec 6, 2007, 1:32:27 PM12/6/07
to Android Internals
Hi Alan,

Poking around, I couldn't locate the daemon API, but I did find the
following. You can create an instance of GSMPhone:
GSMPhone(Context, RIL(context), DefaultPhoneNotifier);

RIL uses a mock implementations, specifically it is using a local
socket address (some android thing) and not the standard Java ones. On
the plus side, it looks as though this is just a problem with RIL
itself and not the lower implementations, meaning you can swap out
this implementation. You would need to create a new RIL implementation
(CommandsInterface). Have this one set up to connect to a Java socket
address (where a proxy to the modem resides) and then read the
parcels. And of course the normal warnings: none of this information
may be accurate or useful and what you're trying to do may be really,
really hard.

Have fun,
Shane

On Dec 5, 1:18 pm, "shane.isb...@gmail.com" <shane.isb...@gmail.com>
wrote:
> > - Show quoted text -- Hide quoted text -

zhou...@gmail.com

unread,
Dec 6, 2007, 9:18:10 PM12/6/07
to Android Internals
Guys,

Thank you all at first, here are my updates of the issue:

Emulator can use external modem (I use a Moto phone as USB modem), but
it
has some strange bug of parsing arguments, argument
"-debug-kernel" is must have, otherwise emulator can't find proper
external modem, I find this issue from log with "-verbose" on.

Using command "emulator.exe -radio COM3 -verbose -debug-kernel" to
start emulator, COM3 is the external modem find by Windows.

Using command "adb shell" telnet to emulator, in "/dev" directory you
will find a char device "ttyS1", that is external modem device, now
you can send AT commands to it.

# echo "AT+CFUN=0" > ttyS1
# echo "ATD112;" > ttyS1
...and so on.

But I can't make phone call from emulator GUI directly, maybe
emulator don't support phone call till now?

Regards,
Alan

On Dec 7, 2:32 am, "shane.isb...@gmail.com" <shane.isb...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages