rild: 解决85949

Change-Id: I80d014cc74d3f71af3b1fd8e01db2e2396ff12e1
diff --git a/mbtk/mbtk_rild/inc/info_data.h b/mbtk/mbtk_rild/inc/info_data.h
index a8e8c3f..aa67acc 100755
--- a/mbtk/mbtk_rild/inc/info_data.h
+++ b/mbtk/mbtk_rild/inc/info_data.h
@@ -51,6 +51,7 @@
     INFO_URC_MSG_PDP_STATE,
     INFO_URC_MSG_SMS_STATE,
     INFO_URC_MSG_SET_BAND,
+    INFO_URC_MSG_GET_SIM_STATE,     //check sim status
     INFO_URC_MSG_NET_STATE_LOG      // Save Network state into file.
 } info_urc_msg_id_enum;
 
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index 4c8c6ee..47c5ba7 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -6299,6 +6299,19 @@
             }
             break;
         }
+        case INFO_URC_MSG_GET_SIM_STATE:
+        {
+            net_info.sim_state = getSIMStatus();
+            if(net_info.sim_state == MBTK_SIM_READY)
+            {
+                LOG("SIM READY!");
+            }
+            else
+            {
+                LOG("SIM NOT READY!");
+            }
+            break;
+        }
         case INFO_URC_MSG_NET_STATE_LOG:
         {
             // Get network state and signal.
@@ -6650,9 +6663,24 @@
                 send_pack_to_queue(NULL, urc);
             }
 #endif
+            sleep(15);
         }
-
-        sleep(15);
+        else
+        {
+            info_urc_msg_t *urc = (info_urc_msg_t*)malloc(sizeof(info_urc_msg_t));
+            if(!urc)
+            {
+                LOG("malloc() fail[%d].", errno);
+            }
+            else
+            {
+                urc->msg = INFO_URC_MSG_GET_SIM_STATE;
+                urc->data = NULL;
+                urc->data_len = 0;
+                send_pack_to_queue(NULL, urc);
+            }
+            sleep(2);
+        }
     }
 
     LOGD("monitor_thread exit.");
@@ -6763,6 +6791,11 @@
 {
     signal(SIGPIPE, SIG_IGN);
 
+    //check cfun and sim card status
+    ril_at_ready_process();
+
+    //any AT instruction that is not sent through pack_process_thread needs to precede the thread
+    //thread create
     if(sock_listen_fd > 0)
     {
         LOG("Information Server Has Started.");
@@ -6843,8 +6876,6 @@
     }
 #endif
 
-    ril_at_ready_process();
-
     // Set Band
     // AT*BAND=15,78,147,482,134742231
     char buff[10];