Skip to content

8l/inferno

Repository files navigation

===Usage===

Just run /data/inferno/Android/arm/bin/emu-g. It's
possible to run Inferno (without graphics) in parallel with zygote
(the Android java layer). Don't touch the radio if the Java layer's
running; your phone will probably freeze. The phone device is mounted
automatically. If you want to change this, look in emu/port/main.c for
where it mounts the device #f.

===Phone interface===
Turn on the radio (you'll want to do this before anything else):
 echo on > /phone/ctl

Turn off the radio:
 echo off > /phone/ctl

Turn on the data connection (APN information is omitted if on CDMA):
 echo net on <gsm/cdma> <APN name> <APN user> <APN password> > /phone/ctl
For example, on AT&T this would be:
 echo net on gsm wap.cingular WAP@CINGULARGPRS.COM cingular1 > /phone/ctl

Turn off the data connection:
 echo net off > /phone/ctl

Route the audio to a different device:
 echo route <earpiece/speaker/headphone> > /phone/ctl

Change the call volume:
 echo volume <0-5> > /phone/ctl

Mute/unmute your microphone:
 echo <mute/unmute> > /phone/ctl

Dial a number:
 echo dial <number> > /phone/phone

Hang up a call:
 echo hangup > /phone/phone

Pick up an incoming call:
 echo answer > /phone/phone

Send an SMS:
 echo send <number> <quoted message> > /phone/sms

Reading from /phone/sms gives you SMS messages as they come in.

Reading from /phone/ctl returns "off" or "on" depending on whether the
driver thinks the radio is off or on. There's no way to query the
power state from RIL, though, so if you have the radio powered on
before Inferno starts it will still return "off."

/phone/signal gives you the raw signal strength value, 0-30 or 99 for
failure. It may be different for CDMA phones.

Reading from /phone/status returns a radio status message. The
contents can vary depending on whether you're on CDMA or GSM (see
hardware/ril/include/telephony/ril.h for details on the
RIL_REQUEST_REGISTRATION_STATE response). The most useful information
is the registration status message, which is always the first line in
the data. It tells you whether you're registered to the cell network
or not.

Reading from /phone/phone will give you messages when the phone rings
and when the call state has changed. You should read from /phone/calls
when the call state changes.

Reading from /phone/calls gives you a list of calls. The device dumps
all the information it gets, but the information that you probably
care about the most is the state of each call and the number of the
other party. The state is a value 0-5:
| Value | Meaning  |
|-------+----------|
|     0 | Active   |
|     1 | Holding  |
|     2 | Dialing  |
|     3 | Alerting |
|     4 | Incoming |
|     5 | Waiting  |

===Building=== 

Before you build for the Android, you need to compile the Inferno
tools for x86. Change mkconfig to include SYSHOST=Linux and
OBJTYPE=386. Run makemk.sh, then run mk nuke. When you mk install,
you'll run into errors--this is because of the changes to make Inferno
play nicely with bionic. Run mk install in the directory of each tool
and library you need (lib9, libmath, utils/iyacc, limbo, and maybe
more). After you have a full toolset, change SYSHOST back to Android
and OBJTYPE back to arm. Run mk nuke, mk install, then push your
inferno directory over to your phone using adb push or the
parallel-push.sh script. Make sure to place your Inferno directory to
match the ROOT variable in mkconfig (we suggest using /data/inferno
for your ROOT).

===Porting===

For porting to a new Android phone, take a look at emu/port/main.c,
emu/Android/framebuffer.c, and emu/Android/screen.c. Most of the work
should be finding out which device is the touchscreen input and
handling that correctly. If you want buttonserver to work correctly,
create a config file in /data/inferno/etc.