Fix ril open and close for v2.

Change-Id: Iec5f7c4de8a27c206d62c2cbb10b796e463ff9c4
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index 438c748..0b70641 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -18,6 +18,7 @@
   WHEN        WHO       WHAT,WHERE,WHY

 --------    --------    -------------------------------------------------------

 2024/08/13     LiuBin      Initial version

+2024/12/31     LiuBin      Add new sms urc process(+CMT)

 

 ******************************************************************************/

 #include <stdio.h>

@@ -686,29 +687,32 @@
 // 0891683108200855F6240D91688189911196F10000221130717445230331D90C

 static void urc_sms_state_change_process(const char *s, const char *sms_pdu)

 {

-    mbtk_ril_sms_state_info_t sms_info;

-    memset(&sms_info, 0, sizeof(mbtk_ril_sms_state_info_t));

-    char* tmp_s = memdup(s,strlen(s) + 1);

-    char *line = tmp_s;

-    char *tmp_str;

-    if (at_tok_start(&line) < 0)

-    {

-        goto CMT_EXIT;

-    }

-    if (at_tok_nextstr(&line, &tmp_str) < 0)

-    {

-        goto CMT_EXIT;

-    }

-    if (at_tok_nextstr(&line, &tmp_str) < 0)

-    {

-        goto CMT_EXIT;

-    }

-    sms_info.pdu_len = (uint16)atoi(tmp_str);

-    memcpy(sms_info.pdu, sms_pdu, strlen(sms_pdu));

+    if(sms_pdu) {

+        LOGD("PDU : %s", sms_pdu);

+        mbtk_ril_sms_state_info_t sms_info;

+        memset(&sms_info, 0, sizeof(mbtk_ril_sms_state_info_t));

+        char* tmp_s = memdup(s,strlen(s) + 1);

+        char *line = tmp_s;

+        char *tmp_str;

+        if (at_tok_start(&line) < 0)

+        {

+            goto CMT_EXIT;

+        }

+        if (at_tok_nextstr(&line, &tmp_str) < 0)

+        {

+            goto CMT_EXIT;

+        }

+        if (at_tok_nextstr(&line, &tmp_str) < 0)

+        {

+            goto CMT_EXIT;

+        }

+        sms_info.pdu_len = (uint16)atoi(tmp_str);

+        memcpy(sms_info.pdu, sms_pdu, strlen(sms_pdu));

 

-    urc_msg_distribute(false, RIL_MSG_ID_IND_SMS_STATE_CHANGE, &sms_info, sizeof(mbtk_ril_sms_state_info_t));

-CMT_EXIT:

-    free(tmp_s);

+        urc_msg_distribute(false, RIL_MSG_ID_IND_SMS_STATE_CHANGE, &sms_info, sizeof(mbtk_ril_sms_state_info_t));

+    CMT_EXIT:

+        free(tmp_s);

+    }

 }

 

 // +CREG: 1, "8010", "000060a5", 0, 2, 0