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
diff --git a/mbtk/mbtk_rild_v2/src/ril_data_call.c b/mbtk/mbtk_rild_v2/src/ril_data_call.c
index f806659..5ec4d55 100755
--- a/mbtk/mbtk_rild_v2/src/ril_data_call.c
+++ b/mbtk/mbtk_rild_v2/src/ril_data_call.c
@@ -15,6 +15,7 @@
-------- -------- -------------------------------------------------------
2024/10/10 LiuBin Initial version
2024/11/13 LiuBin Add auto data call while network changed.
+ Fix apn change for same name.
******************************************************************************/
#include <stdio.h>
@@ -463,6 +464,8 @@
}
// Is add,the APN can't same.
+ // Is change, not change apn name to other cid.
+#if 0
if(!is_change) {
index = 0;
while(index < apns.num) {
@@ -473,6 +476,24 @@
index++;
}
}
+#else
+ index = 0;
+ while(index < apns.num) {
+ if(strcmp((char*)apns.apns[index].apn,(char*)apn->apn) == 0) {
+ if(!is_change) { // Is add,the APN can't same.
+ LOGW("APN : %s exist, can't add.", apn->apn);
+ return -1;
+ } else { // Is change, not change apn name to other cid.
+ if(index != apn->cid) {
+ LOGW("APN : %s exist in cid[%d], can't change to cid[%d]", apn->apn,
+ index, apn->cid);
+ return -1;
+ }
+ }
+ }
+ index++;
+ }
+#endif
}
}
return 0;