ifx: Rework SIM state handling
authorDenis Kenzior <denkenz@gmail.com>
Sat, 24 Nov 2012 13:50:44 +0000 (07:50 -0600)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 28 Nov 2012 16:31:14 +0000 (10:31 -0600)
When performing a SIM REFRESH, particularly NAA Initialization, we need
to wait until the modem sends XSIMSTATE: 7, not XSIMSTATE:2.  Even on
normal initialization it seems safer to wait until XSIMSTATE:2.

plugins/ifx.c

index eb30141..6936fd1 100644 (file)
@@ -139,19 +139,24 @@ static void ifx_set_sim_state(struct ifx_data *data, int state)
 
        switch (state) {
        case 0: /* SIM not present */
+       case 6: /* SIM Error */
+       case 8: /* SIM Technical Problem */
        case 9: /* SIM Removed */
                ofono_sim_inserted_notify(data->sim, FALSE);
                break;
        case 1: /* PIN verification needed */
-       case 2: /* PIN verification not needed – Ready */
-       case 3: /* PIN verified – Ready */
        case 4: /* PUK verification needed */
        case 5: /* SIM permanently blocked */
-       case 6: /* SIM Error */
        case 7: /* ready for attach (+COPS) */
-       case 8: /* SIM Technical Problem */
                ofono_sim_inserted_notify(data->sim, TRUE);
                break;
+       case 2: /* PIN verification not needed – Ready */
+       case 3: /* PIN verified – Ready */
+               /*
+                * State 3 is handled in the SIM atom driver
+                * while for state 2 we should be waiting for state 7
+                */
+               break;
        case 10: /* SIM Reactivating */
        case 11: /* SIM Reactivated */
        case 12: /* SIM SMS Caching Completed */