Bug 733990 - Handle errors for ICC IO. r=philikon

This commit is contained in:
Yoshi Huang 2012-03-28 20:46:06 -07:00
parent a3e4c8bf31
commit 1a0f59c346
2 changed files with 20 additions and 16 deletions

View File

@ -437,12 +437,15 @@ const GET_RESPONSE_EF_SIZE_BYTES = 15;
const EF_PATH_MF_SIM = "3f00";
const EF_PATH_DF_TELECOM = "7f10";
// Status code for ICC I/O,
// see GSM11.11 and TS 51.011 clause 9.4.
const STATUS_NORMAL_ENDING = 0x90;
const STATUS_NORMAL_ENDING_WITH_EXTRA = 0x91;
const STATUS_WITH_SIM_DATA = 0x9e;
const STATUS_WITH_RESPONSE_DATA = 0x9f;
// Status code of sw1 for ICC I/O,
// see GSM11.11 and TS 51.011 clause 9.4, and ISO 7816-4
const ICC_STATUS_NORMAL_ENDING = 0x90;
const ICC_STATUS_NORMAL_ENDING_WITH_EXTRA = 0x91;
const ICC_STATUS_WITH_SIM_DATA = 0x9e;
const ICC_STATUS_WITH_RESPONSE_DATA = 0x9f;
const ICC_STATUS_ERROR_WRONG_LENGTH = 0x67;
const ICC_STATUS_ERROR_COMMAND_NOT_ALLOWED = 0x69;
const ICC_STATUS_ERROR_WRONG_PARAMETERS = 0x6a;
/**
* GSM PDU constants

View File

@ -1244,16 +1244,6 @@ let RIL = {
* Process the MSISDN ICC I/O response.
*/
_processMSISDNResponse: function _processMSISDNResponse(options) {
let sw1 = Buf.readUint32();
let sw2 = Buf.readUint32();
// See GSM11.11 section 9.4 for sw1 and sw2
if (sw1 != STATUS_NORMAL_ENDING) {
// TODO: error
// Wait for fix for Bug 733990 to report error.
debug("Error in iccIO");
}
if (DEBUG) debug("ICC I/O (" + sw1 + "/" + sw2 + ")");
switch (options.command) {
case ICC_COMMAND_GET_RESPONSE:
let response = Buf.readString();
@ -1823,6 +1813,17 @@ RIL[REQUEST_SETUP_DATA_CALL] = function REQUEST_SETUP_DATA_CALL(length, options)
this[REQUEST_DATA_CALL_LIST](length, options);
};
RIL[REQUEST_SIM_IO] = function REQUEST_SIM_IO(length, options) {
let sw1 = Buf.readUint32();
let sw2 = Buf.readUint32();
if (sw1 != ICC_STATUS_NORMAL_ENDING) {
// See GSM11.11, TS 51.011 clause 9.4, and ISO 7816-4 for the error
// description.
debug("ICC I/O Error EF id = " + options.fileid.toString(16) +
" command = " + options.command.toString(16) +
"(" + sw1.toString(16) + "/" + sw2.toString(16) + ")");
return;
}
switch (options.fileid) {
case ICC_EF_MSISDN:
this._processMSISDNResponse(options);