he910: Fixup SIM status switching
authorCaiwen Zhang <caiwen.zhang@intel.com>
Fri, 7 Mar 2014 14:37:56 +0000 (22:37 +0800)
committerPhilippe Coval <philippe.coval@osg.samsung.com>
Tue, 12 Jan 2016 10:51:04 +0000 (11:51 +0100)
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 69362b873b12f59f4133e404d857b9bd3e51b8f4..d7f8df10625a94b6a58d74d2a1a508fd39e5ee98 100644 (file)
@@ -131,19 +131,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);