aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGjermund Hodnebrog <gjermund.hodnebrog@stericsson.com>2011-06-04 11:51:03 +0200
committerSverre Vegge <sverre.vegge@stericsson.com>2011-08-03 10:39:20 +0200
commit490492f309cbbca963f341aec4bd5b4fb42e3053 (patch)
treec0771f575212cdb1876a0713cee7e3e576c537ca
parentf68ebd71a39dd455dfe14216794386b2a1af52d1 (diff)
downloadu300-490492f309cbbca963f341aec4bd5b4fb42e3053.tar.gz
SIM: Handle wrong SIM cards and report CARDSTATE_ERROR to Android
Signed-off-by: Sverre Vegge <sverre.vegge@stericsson.com>
-rw-r--r--u300-ril-sim.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/u300-ril-sim.c b/u300-ril-sim.c
index 6f9acf6..1dfb331 100644
--- a/u300-ril-sim.c
+++ b/u300-ril-sim.c
@@ -68,7 +68,8 @@ typedef enum {
SIM_SERVICE_PROVIDER_PERSO_PUK = 17,/* Service Provider Perso. PUK */
SIM_CORPORATE_PERSO_PUK = 18, /* Corporate Personalization PUK */
SIM_SIM_PERSO_PUK = 19, /* SIM Personalization PUK (unused) */
- SIM_PUK2_PERM_BLOCKED = 20 /* PUK2 is permanently blocked */
+ SIM_PUK2_PERM_BLOCKED = 20, /* PUK2 is permanently blocked */
+ SIM_ERROR = 21 /* Improper or failing SIM card */
} SIM_Status;
enum PIN_PUK_Verification {
@@ -293,6 +294,14 @@ static const RIL_AppStatus app_status_array[] = {
NULL, NULL, 0,
RIL_PINSTATE_UNKNOWN,
RIL_PINSTATE_ENABLED_PERM_BLOCKED
+ },
+ /* SIM_ERROR = 21 */
+ {
+ RIL_APPTYPE_UNKNOWN, RIL_APPSTATE_UNKNOWN,
+ RIL_PERSOSUBSTATE_UNKNOWN,
+ NULL, NULL, 0,
+ RIL_PINSTATE_UNKNOWN,
+ RIL_PINSTATE_UNKNOWN
}
};
@@ -513,6 +522,12 @@ static SIM_Status getSIMStatus()
case CME_SIM_PUK_REQUIRED:
ret = SIM_PUK;
break;
+ case CME_SIM_FAILURE:
+ ret = SIM_ERROR;
+ break;
+ case CME_SIM_WRONG: /* E.g. SIM is deactivated due to IMEI checks */
+ ret = SIM_ERROR;
+ break;
case CME_SIM_PIN2_REQUIRED:
ret = SIM_PIN2;
break;
@@ -700,7 +715,11 @@ static int getCardStatus(RIL_CardStatus *p_card_status)
sim_status = getSIMStatus();
- if (sim_status > SIM_ABSENT) {
+ if (sim_status == SIM_ABSENT)
+ p_card_status->card_state = RIL_CARDSTATE_ABSENT;
+ else if (sim_status == SIM_ERROR)
+ p_card_status->card_state = RIL_CARDSTATE_ERROR;
+ else {
p_card_status->card_state = RIL_CARDSTATE_PRESENT;
/* Only support one app, gsm/wcdma. */