diff options
author | David Turner <> | 2009-04-15 06:50:16 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-15 06:50:16 -0700 |
commit | fbcbf4201b9b56b72e9a06d292ae94360dd66b9e (patch) | |
tree | 607c852be25de73bc0a7e65e3b7455984d319cca /telephony | |
parent | 791d86195fedca3a8cba5d7fa3e3610302361a78 (diff) | |
download | external_qemu-fbcbf4201b9b56b72e9a06d292ae94360dd66b9e.zip external_qemu-fbcbf4201b9b56b72e9a06d292ae94360dd66b9e.tar.gz external_qemu-fbcbf4201b9b56b72e9a06d292ae94360dd66b9e.tar.bz2 |
AI 146315: am: CL 146314 modify GSM emulation to accomodate 1.0 and 1.1 system images.
without this, networking doesn't work well when using the 1.1 add-on with
the cupcake sdk
Original author: digit
Merged from: //branches/cupcake/...
Automated import of CL 146315
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/android_modem.c | 38 | ||||
-rw-r--r-- | telephony/android_modem.h | 1 |
2 files changed, 30 insertions, 9 deletions
diff --git a/telephony/android_modem.c b/telephony/android_modem.c index 79e93b2..6e73411 100644 --- a/telephony/android_modem.c +++ b/telephony/android_modem.c @@ -190,6 +190,9 @@ typedef struct { typedef struct AModemRec_ { + /* Legacy support */ + char supportsNetworkDataType; + /* Radio state */ ARadioState radio_state; int area_code; @@ -349,6 +352,7 @@ amodem_create( int base_port, AModemUnsolFunc unsol_func, void* unsol_opaque AModem modem = _android_modem; amodem_reset( modem ); + modem->supportsNetworkDataType = 1; modem->base_port = base_port; modem->unsol_func = unsol_func; modem->unsol_opaque = unsol_opaque; @@ -359,6 +363,12 @@ amodem_create( int base_port, AModemUnsolFunc unsol_func, void* unsol_opaque } void +amodem_set_legacy( AModem modem ) +{ + modem->supportsNetworkDataType = 0; +} + +void amodem_destroy( AModem modem ) { asimcard_destroy( modem->sim ); @@ -444,10 +454,15 @@ amodem_set_data_registration( AModem modem, ARegistrationState state ) break; case A_REGISTRATION_UNSOL_ENABLED_FULL: - amodem_unsol( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\",\"%04x\"\r", - modem->data_mode, modem->data_state, - modem->area_code, modem->cell_id, - modem->data_network ); + if (modem->supportsNetworkDataType) + amodem_unsol( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\",\"%04x\"\r", + modem->data_mode, modem->data_state, + modem->area_code, modem->cell_id, + modem->data_network ); + else + amodem_unsol( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\"\r", + modem->data_mode, modem->data_state, + modem->area_code, modem->cell_id ); break; default: @@ -794,11 +809,16 @@ handleNetworkRegistration( const char* cmd, AModem modem ) } } else if ( !memcmp( cmd, "+CGREG", 6 ) ) { cmd += 6; - if (cmd[0] == '?') {\ - return amodem_printf( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\",\"%04x\"", - modem->data_mode, modem->data_state, - modem->area_code, modem->cell_id, - modem->data_network ); + if (cmd[0] == '?') { + if (modem->supportsNetworkDataType) + return amodem_printf( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\",\"%04x\"", + modem->data_mode, modem->data_state, + modem->area_code, modem->cell_id, + modem->data_network ); + else + return amodem_printf( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\"", + modem->data_mode, modem->data_state, + modem->area_code, modem->cell_id ); } else if (cmd[0] == '=') { switch (cmd[1]) { case '0': diff --git a/telephony/android_modem.h b/telephony/android_modem.h index 80d22c5..828da42 100644 --- a/telephony/android_modem.h +++ b/telephony/android_modem.h @@ -23,6 +23,7 @@ typedef struct AModemRec_* AModem; typedef void (*AModemUnsolFunc)( void* opaque, const char* message ); extern AModem amodem_create( int base_port, AModemUnsolFunc unsol_func, void* unsol_opaque ); +extern void amodem_set_legacy( AModem modem ); extern void amodem_destroy( AModem modem ); /* send a command to the modem */ |