he910: Fixup SIM status switching
authorCaiwen Zhang <caiwen.zhang@intel.com>
Fri, 7 Mar 2014 14:37:56 +0000 (22:37 +0800)
committerCaiwen Zhang <caiwen.zhang@intel.com>
Tue, 13 Jan 2015 03:02:33 +0000 (11:02 +0800)
SIM inserted notification may be missed, when get SIM status is ready,
make sure SIM inserted is set.

Change-Id: Iad752d39af544c2f177015b5e2530018e8947d40

plugins/he910.c

index 81080e3..cb34b93 100644 (file)
@@ -130,19 +130,19 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status)
                        data->sms_phonebook_added = FALSE;
                }
                break;
-       case 1: /* SIM inserted */
-       case 2: /* SIM inserted and PIN unlocked */
-               if (data->have_sim == FALSE) {
-                       ofono_sim_inserted_notify(data->sim, TRUE);
-                       data->have_sim = TRUE;
-               }
-               break;
        case 3: /* SIM inserted, SMS and phonebook ready */
                if (data->sms_phonebook_added == FALSE) {
                        ofono_phonebook_create(modem, 0, "atmodem", data->chat);
                        ofono_sms_create(modem, 0, "atmodem", data->chat);
                        data->sms_phonebook_added = TRUE;
                }
+               /* Go down to case 1 and 2, in case of they are missed  */
+       case 1: /* SIM inserted */
+       case 2: /* SIM inserted and PIN unlocked */
+               if (data->have_sim == FALSE) {
+                       ofono_sim_inserted_notify(data->sim, TRUE);
+                       data->have_sim = TRUE;
+               }
                break;
        default:
                ofono_warn("Unknown SIM state %d received", status);