Squashed 'LYNQ_PUBLIC/' changes from 994e41a76..f3dd8cbdf

f3dd8cbdf [Feature][ZK-92] ftp gpslog to soc with syslog
8bb9992d3 [Feature][API-1508] in NMEA-statement for ZK ,transfer BD to GB
17579bbfa [BugFix][API-1564]fix File descriptor leakage
9c8bb35ff Merge "[Bugfix][API-1561][mtklog]  support mtk log slim fota upgrade"
926d2ad75 [Bugfix][API-1561][mtklog]  support mtk log slim fota upgrade
4bcc14334 Merge "[Bugfix][ZK-78][FOTA]get process and upgrade status error when start fota up status"
610236b60 [Bugfix][ZK-78][FOTA]get process and upgrade status error when start fota up status
f700d98cb Merge "[Bugfix][API-1473][mdlog] lynq_query_registration_state type Voice  lac cid error"
0c874421d [Feature][T8TSK-320]Print the reason for the PDN when disconnected by the modem into the syslog
dac13540e Merge "[Feature][API-1406][API-1113]Adjust SEND_SMS timeout"
31850f3e5 Merge "[Feature][API-1557] FIX libvendor-ril can`t connected RILD issue"
d3a8f5da1 [Feature][API-1557] FIX libvendor-ril can`t connected RILD issue
2f4c07922 Merge "[Feature][T8TSK-316][rtp] rtp confirm to the standard of Geely"
1ee60ec01 Merge "[Bugfix][API-1551[network]  lynq_set_vlan_info, vlan_info is "", ret 8004"
98beaeaf3 Merge "[Bugfix][API-1534]After turning on the USB port, delay for 3 seconds to make a  call"
786e97304 [Feature][T8TSK-289] missing wom when add telephonyware to LYNQ_PUBLIC repo 0
d25d37156 [Bugfix][API-1534]After turning on the USB port, delay for 3 seconds to make a  call
4157623f6 [Feature][T8TSK-316][rtp] rtp confirm to the standard of Geely
c66c73d5d [Bugfix][API-1551[network]  lynq_set_vlan_info, vlan_info is "", ret 8004
4bf2e2e0b [Feature][API-1406][API-1113]Adjust SEND_SMS timeout
4b1c33121 [Bugfix][API-1473][mdlog] lynq_query_registration_state type Voice  lac cid error

git-subtree-dir: LYNQ_PUBLIC
git-subtree-split: f3dd8cbdf17f75f5c9672368b59c1cd59194fce6

Change-Id: Ie206616813b8064220450958d9f91e5048c08ac2
diff --git a/IC_meta/mtk/2735/liblynq-call/liblynq-call.bb b/IC_meta/mtk/2735/liblynq-call/liblynq-call.bb
index 109490f..32fd6b3 100755
--- a/IC_meta/mtk/2735/liblynq-call/liblynq-call.bb
+++ b/IC_meta/mtk/2735/liblynq-call/liblynq-call.bb
@@ -13,7 +13,8 @@
 #Parameters passed to do_compile()

 EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\

                 'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\

-                'TARGET_PLATFORM = ${TARGET_PLATFORM}'"

+                'TARGET_PLATFORM = ${TARGET_PLATFORM}'\

+                'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"

 

 EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"

 

diff --git a/IC_meta/mtk/2735/liblynq-gnss/liblynq-gnss.bb b/IC_meta/mtk/2735/liblynq-gnss/liblynq-gnss.bb
index 7a6ef90..e2e255f 100755
--- a/IC_meta/mtk/2735/liblynq-gnss/liblynq-gnss.bb
+++ b/IC_meta/mtk/2735/liblynq-gnss/liblynq-gnss.bb
@@ -26,7 +26,8 @@
 MOBILETEK_GNSS_CN_OUTPUT_SYSLOG ?= "no"

 EXTRA_OEMAKE += "'MOBILETEK_GNSS_CN_OUTPUT_SYSLOG = ${MOBILETEK_GNSS_CN_OUTPUT_SYSLOG}'"

 

-

+MOBILETEK_GNSS_BD_TRANSFORM_GB ?= "no"

+EXTRA_OEMAKE += "'MOBILETEK_GNSS_BD_TRANSFORM_GB = ${MOBILETEK_GNSS_BD_TRANSFORM_GB}'"

 

 FILES_${PN} = "${base_libdir}/*.so \

                ${base_bindir}\

diff --git a/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/files/properties.c b/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/files/properties.c
old mode 100644
new mode 100755
index 79f4c41..dd0f85f
--- a/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/files/properties.c
+++ b/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/files/properties.c
@@ -19,6 +19,7 @@
 // #define LOG_NDEBUG 0
 
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <ctype.h>
 #include <unistd.h>
@@ -110,17 +111,11 @@
 
 #include <uci.h>
 #define UCI_CONFIG_FILE "/etc/config/radio_property"
+#define UCI_CONFIG_FILE_DEFAULT "/etc/property_default/radio_property_default"
 
 static pthread_mutex_t property_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-int property_set(const char *key, const char *new_value) {
-
-    if (NULL == key || NULL == new_value) {
-        return 0;
-    }
-
-    pthread_mutex_lock(&property_mutex);
-
+int property_set_impl(const char *key, const char *new_value) {
     int retValue = 0;
     int value = 0;
     struct uci_context *_ctx = uci_alloc_context();
@@ -151,7 +146,9 @@
         value = uci_commit(_ctx, &ptr.p, false);
         if (value == 0) {
             retValue = 1;
-            ALOGV("property_set ok. %s=%s return %d\n", key, new_value, value);
+            if (!strcmp(key, "rild.socket.status1") || !strcmp(key, "rild.socket.status2")) {
+                ALOGD("property_set ok. %s=%s return %d\n", key, new_value, value);
+            }
         } else {
             ALOGE("property_set uci_commit fail %s=%s return %d\n", key, new_value, value);
         }
@@ -162,18 +159,66 @@
     uci_free_context(_ctx);
     _ctx = NULL;
 
-    pthread_mutex_unlock(&property_mutex);
     return retValue;
 }
 
+int property_get_impl(const char *key, char *value, const char *default_value) {
+    static bool has_property_check = false;
+    FILE *p = NULL;
 
-int property_get(const char *key, char *value, const char *default_value) {
-    if (NULL == key || NULL == value) {
-        return 0;
+    if (has_property_check == false)
+    {
+        if (p = fopen(UCI_CONFIG_FILE, "r+")) {
+            getc(p);
+            if (feof(p)) {
+                ALOGD("the file: %s is empty.\n", UCI_CONFIG_FILE);
+
+                fseek(p, 0, SEEK_CUR);
+                FILE *fr = fopen(UCI_CONFIG_FILE_DEFAULT, "r");
+                char str[1024];
+
+                if (fr == NULL) {
+                    ALOGD("the file: %s can't open.\n", UCI_CONFIG_FILE_DEFAULT);
+                    fclose(p);
+
+                } else {
+                    while (!feof(fr)) {
+                        fgets(str, sizeof(str), fr);
+                        fputs(str, p);
+                    }
+                    fclose(p);
+                    fclose(fr);
+                    sync();
+                }
+
+            } else {
+                fclose(p);
+            }
+
+        } else {
+            ALOGD("the file: %s is missing.\n", UCI_CONFIG_FILE);
+
+            FILE *fr = fopen(UCI_CONFIG_FILE_DEFAULT, "r");
+            FILE *fw = fopen(UCI_CONFIG_FILE, "w");
+            char str[1024];
+
+            if (fr == NULL) {
+                ALOGD("the file: %s can't open.\n", UCI_CONFIG_FILE_DEFAULT);
+                fclose(fw);
+
+            } else {
+                while (!feof(fr)) {
+                    fgets(str, sizeof(str), fr);
+                    fputs(str, fw);
+                }
+                fclose(fr);
+                fclose(fw);
+                sync();
+            }
+        }
+        has_property_check = true;
     }
 
-    pthread_mutex_lock(&property_mutex);
-
     int retValue = 0;
     struct uci_context *uciCtx = uci_alloc_context();
     const char *pValueData = NULL;
@@ -190,7 +235,6 @@
         }
     }
 
-
     if (UCI_OK != uci_load(uciCtx, UCI_CONFIG_FILE, &pkg)) {
         if (default_value) {
             int len = strlen(default_value);
@@ -211,7 +255,9 @@
                 strncpy(value, pValueData, strlen(pValueData));
             }
             retValue = 1;
-            ALOGV("property_get, %s: %s\n", key, value);
+            if (!strcmp(key, "rild.socket.status1") || !strcmp(key, "rild.socket.status2")) {
+                ALOGD("property_get, %s: %s\n", key, value);
+            }
         }
     }
     if (!retValue) {
@@ -220,7 +266,9 @@
             memcpy(value, default_value, len);
             value[len] = '\0';
             retValue = 1;
-            ALOGV("property_get use default value, %s: %s\n", key, value);
+            if (!strcmp(key, "rild.socket.status1") || !strcmp(key, "rild.socket.status2")) {
+                ALOGD("property_get use default value, %s: %s\n", key, value);
+            }
         }
     }
 
@@ -230,6 +278,51 @@
     uci_free_context(uciCtx);
     uciCtx = NULL;
 
+    return retValue;
+}
+
+int property_set(const char *key, const char *new_value) {
+
+    if (NULL == key || NULL == new_value) {
+        return 0;
+    }
+
+    pthread_mutex_lock(&property_mutex);
+
+    int retValue = 0, count = 0;
+    char property_status[PROP_VALUE_MAX] = {0};
+
+    while (count < 10) {
+        retValue = property_set_impl(key, new_value);
+
+        // property get to ensure set success
+        memset(&property_status, 0, sizeof(property_status));
+        property_get_impl(key, property_status, "-1");
+
+        if (!strcmp(new_value, property_status)) {
+            ALOGD("set %s: %s success\n", key, property_status);
+            break;
+
+        } else {
+            ALOGE("set %s: %s fail (%s), retry %d\n", key, new_value, property_status, count);
+            count++;
+            usleep(1000);
+        }
+    }
+
+    pthread_mutex_unlock(&property_mutex);
+    return retValue;
+}
+
+int property_get(const char *key, char *value, const char *default_value) {
+    if (NULL == key || NULL == value) {
+        return 0;
+    }
+
+    pthread_mutex_lock(&property_mutex);
+
+    int retValue = property_get_impl(key, value, default_value);
+
     pthread_mutex_unlock(&property_mutex);
     return retValue;
 }
diff --git a/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/libuciwrapper_1.0.0.bb b/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/libuciwrapper_1.0.0.bb
old mode 100644
new mode 100755
index 865a072..6fec02d
--- a/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/libuciwrapper_1.0.0.bb
+++ b/IC_meta/mtk/2735/mtk-telephonyware/libuciwrapper/libuciwrapper_1.0.0.bb
@@ -10,11 +10,13 @@
 FILES_SOLIBSDEV = ""
 FILES_${PN} = "${libdir}/libuciwrapper.so"
 FILES_${PN} += "/etc/config/radio_property"
+FILES_${PN} += "/etc/property_default/radio_property_default"
 
 do_install() {
     install -d ${D}${libdir}
     install -m 0755 ${S}/libuciwrapper.so ${D}${libdir}/
     install -d ${D}/etc/config
+    install -d ${D}/etc/property_default
     install -m 0644 ${S}/radio_property.config ${D}/etc/config/radio_property
+    install -m 0644 ${S}/radio_property.config ${D}/etc/property_default/radio_property_default
 }
-
diff --git a/IC_src/mtk/framework/lynq-logrotate-service/src/lynq_logrotate_service.c b/IC_src/mtk/framework/lynq-logrotate-service/src/lynq_logrotate_service.c
index 264bb11..d4338e1 100755
--- a/IC_src/mtk/framework/lynq-logrotate-service/src/lynq_logrotate_service.c
+++ b/IC_src/mtk/framework/lynq-logrotate-service/src/lynq_logrotate_service.c
@@ -141,6 +141,15 @@
     }

     system("/usr/bin/lynq-default");

     system("systemctl stop ntpd");

+

+    if(access("/etc/firmware/catcher_filter_5_SuperSlim.bin",0) && access("/data_backup/catcher_filter_5_SuperSlim.bin",0) == 0 )    

+    {

+           system("cp /data_backup/catcher_filter_5_SuperSlim.bin /etc/firmware/catcher_filter_5_SuperSlim.bin");

+           sleep(2);

+           system("killall emdlogger1");

+           sleep(2);         

+    }

+

     lynq_fota_func();

 //    while(1)

 //    {

diff --git a/IC_src/mtk/lib/liblynq-fota/rock_ua/rock_ua.c b/IC_src/mtk/lib/liblynq-fota/rock_ua/rock_ua.c
index d510633..8fae757 100755
--- a/IC_src/mtk/lib/liblynq-fota/rock_ua/rock_ua.c
+++ b/IC_src/mtk/lib/liblynq-fota/rock_ua/rock_ua.c
@@ -289,10 +289,9 @@
         RLOGD("+[UA]: save_fota_status: Error opening metadata file: %s\n",strerror(errno));
         return -err;
     }
-    
+
     write(fd_fota_status, &fota_status,sizeof(fota_status));
     sync();
-    
     close(fd_fota_status);
 }
 
@@ -876,6 +875,10 @@
     }
     close(fd);
 //xf.li@20230830 add for ab_recover end
+    memset(&fota_status,0,sizeof(fota_status));
+    fota_status.ota_run = 1;
+    save_fota_status();
+
     hw_module = &HAL_MODULE_INFO_SYM;
 
     if (!hw_module ||
@@ -907,7 +910,6 @@
     RLOGD("Booting slot = %d, : isSlotMarkedSuccessful= %d\n",current_slot,is_successful);
 
 
-
     memset(&ctx, 0, sizeof(ctx));
     ctx.rom_base = 0;
     ctx.ram_base =(unsigned char *)&ram_buffer[0];
@@ -927,8 +929,6 @@
         return E_ROCK_FOTA_ADDR;
     }
 
-
-    memset(&fota_status,0,sizeof(fota_status));
     RLOGD("+[UA]: up_info.ota_run = %d\n",up_info.ota_run);
 
 #if 0
@@ -937,7 +937,6 @@
         up_info.ota_run = 0;
     }    
 #endif 
-
     up_info.ota_run = 0;
     if(backup_mode == 1)
     {
@@ -1099,14 +1098,13 @@
                 fd_write = fd_partition_b;
             }
 
-            fota_status.ota_run = i;
+            fota_status.ota_run = i+1;
             fota_status.update_status[i].check_delta = WAIT;
             fota_status.update_status[i].check_rom = WAIT;
             fota_status.update_status[i].update_result= WAIT;
 
             save_fota_status();
-        
-        
+
             up_info.ota_run = i+1;
             save_fota_info();
 
@@ -1173,8 +1171,7 @@
 
         now_patch = 0;
         up_info.ota_run = 0;
-        
-        memset(&fota_status,0,sizeof(fota_status));
+
         fota_status.switch_slot = WAIT;
         save_fota_status();
         
diff --git a/IC_src/mtk/lib/liblynq-gnss/include/lynq_gnss.h b/IC_src/mtk/lib/liblynq-gnss/include/lynq_gnss.h
index fac71b0..ea02c2e 100755
--- a/IC_src/mtk/lib/liblynq-gnss/include/lynq_gnss.h
+++ b/IC_src/mtk/lib/liblynq-gnss/include/lynq_gnss.h
@@ -110,7 +110,9 @@
 int lynq_gnss_epo_switch(LYNQ_CONF_SWITCH switch_op);

 

 int lynq_gnss_output_frequency_set(int frequency);

-

+#ifdef GNSS_BD_TRANSFORM_GB

+int lynq_gnss_bd_transform_enable(int flag);

+#endif

 int lynq_agps_set_enabled(LYNQ_CONF_SWITCH agps_status);

 

 int lynq_agps_get_enabled_status(int *status);

diff --git a/IC_src/mtk/lib/liblynq-gnss/makefile b/IC_src/mtk/lib/liblynq-gnss/makefile
index 1d21aef..66084e0 100755
--- a/IC_src/mtk/lib/liblynq-gnss/makefile
+++ b/IC_src/mtk/lib/liblynq-gnss/makefile
@@ -50,6 +50,10 @@
     LOCAL_CFLAGS += -DGNSS_CN_OUTPUT_SYSLOG

 endif

 

+ifeq ($(strip $(MOBILETEK_GNSS_BD_TRANSFORM_GB)), yes)

+    LOCAL_CFLAGS += -DGNSS_BD_TRANSFORM_GB

+endif

+

 

 

 $(warning libs=$(LOCAL_LIBS))

diff --git a/IC_src/mtk/lib/liblynq-gnss/src/lynq_callback.c b/IC_src/mtk/lib/liblynq-gnss/src/lynq_callback.c
index 51dd989..e0102a3 100755
--- a/IC_src/mtk/lib/liblynq-gnss/src/lynq_callback.c
+++ b/IC_src/mtk/lib/liblynq-gnss/src/lynq_callback.c
@@ -25,7 +25,8 @@
 #define NMEA_GGA "GGA"

 #define NMEA_VTG "VTG"

 #define NMEA_GSV "GSV"

-

+#define NMEA_BD "BD"

+#define NMEA_GB "GB"

 time_t reopen_start;

 extern lynq_gnss_cb* lynq_callbacks;

 extern lynq_raw_gnss_cbs *lynq_meas_callbacks;

@@ -75,6 +76,9 @@
 int count = 0;

 int nmea_count = 0;

 #endif

+#ifdef GNSS_BD_TRANSFORM_GB

+extern int BD_transform_GB_flag;

+#endif

 

 static inline int update_systime_time(GpsUtcTime gpstime)

 {

@@ -135,6 +139,22 @@
     }

 }

 #endif

+#ifdef GNSS_BD_TRANSFORM_GB

+void BD_transform_GB(char *str)

+{

+    int i;

+    int result;

+

+    strncpy(str + 1, NMEA_GB,strlen(NMEA_GB));

+    result = str[1];

+    for(i = 2; str[i] != '*'; i++)

+    {

+        result ^= str[i];

+    }

+    sprintf(str+i+1,"%02X",result);

+    return;

+}

+#endif

 

 void lynq_gps_nmea_callback(GpsUtcTime timestamp, const char* nmea, int length)

 {

@@ -191,6 +211,15 @@
         }

     }

 #endif

+#ifdef GNSS_BD_TRANSFORM_GB

+    char str[128];

+    if(BD_transform_GB_flag == 1 && strncmp(nmea + 1, NMEA_BD,strlen(NMEA_BD)) == 0)

+    {

+        strncpy(str,nmea,strlen(nmea));

+        BD_transform_GB(str);

+        nmea = str;

+    }

+#endif

 #ifdef GNSS_ELT_OUTPUT_CFG

     if(Open_ELT)

     {

diff --git a/IC_src/mtk/lib/liblynq-gnss/src/lynq_gnss.c b/IC_src/mtk/lib/liblynq-gnss/src/lynq_gnss.c
index 053a2fd..c6ad803 100755
--- a/IC_src/mtk/lib/liblynq-gnss/src/lynq_gnss.c
+++ b/IC_src/mtk/lib/liblynq-gnss/src/lynq_gnss.c
@@ -398,6 +398,15 @@
     return 0;

 }

 

+#ifdef GNSS_BD_TRANSFORM_GB

+int BD_transform_GB_flag = 0;

+int lynq_gnss_bd_transform_enable(int flag)

+{

+    BD_transform_GB_flag = flag;

+    return 0;

+}

+#endif

+

 lynq_atsvc_outcb atsvc_gnss_outcb;

 void atsvc_incb_entity(const char *input,const int length);

 int lynq_at_cgps(int at_type,char *at_paramter);

diff --git a/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c b/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c
index 60c4224..dbc9ef1 100755
--- a/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c
+++ b/IC_src/mtk/lib/liblynq-wifi6/libwifi6.c
@@ -214,7 +214,7 @@
 
 static void notify_service_invoke_fail(int error)
 {
-    struct local_wpa_ctrl *lynq_wpa_ctrl = NULL;
+    struct wpa_ctrl *lynq_wpa_ctrl = NULL;
     pthread_mutex_lock(&s_global_check_mutex);
     if (error == -2) //timeout
     {
@@ -232,15 +232,19 @@
         {
             s_service_invoke_timeout_cnt = FAKE_MAX_INT_VALUE;
             pthread_cond_signal(&s_global_check_cond);
-        }
-        wpa_ctrl_close(lynq_wpa_ctrl);
+        }else
+         {
+            wpa_ctrl_close(lynq_wpa_ctrl);
+         }
         lynq_wpa_ctrl = wpa_ctrl_open(CTRL_PATH[1]);
         if (lynq_wpa_ctrl == NULL)
         {
             s_service_invoke_timeout_cnt = FAKE_MAX_INT_VALUE;
             pthread_cond_signal(&s_global_check_cond);
+        }else
+        {
+            wpa_ctrl_close(lynq_wpa_ctrl);
         }
-        wpa_ctrl_close(lynq_wpa_ctrl);
     }
 
     pthread_mutex_unlock(&s_global_check_mutex);
@@ -1582,18 +1586,31 @@
         pthread_join(g_sta_watcher_pid, NULL);
     if (g_sta_auto_watcher_pid != 0)
         pthread_join(g_sta_auto_watcher_pid, NULL);
-    if (g_lynq_wpa_ctrl[0] != NULL)
-        wpa_ctrl_close(g_lynq_wpa_ctrl[0]);
-    if (g_lynq_wpa_ctrl[1] != NULL)
-        wpa_ctrl_close(g_lynq_wpa_ctrl[1]);
+    if ( g_lynq_wpa_ctrl[0] != NULL)
+    {
+        if(g_lynq_wpa_ctrl[0]->ctrl != NULL)
+        {
+             wpa_ctrl_close(g_lynq_wpa_ctrl[0]->ctrl);
+        }
+        free(g_lynq_wpa_ctrl[0]);
+        g_lynq_wpa_ctrl[0] = NULL;
+    }
+
+    if ( g_lynq_wpa_ctrl[1] != NULL )
+    {
+        if( g_lynq_wpa_ctrl[1]->ctrl != NULL )
+        {
+            wpa_ctrl_close(g_lynq_wpa_ctrl[1]->ctrl);
+        }
+        free(g_lynq_wpa_ctrl[1]);
+        g_lynq_wpa_ctrl[1] = NULL;
+    }
     if (g_ap_tmp_watcher_pid != 0)
         pthread_join(g_ap_tmp_watcher_pid, NULL);
     g_ap_watcher_pid = 0;
     g_sta_watcher_pid = 0;
     g_sta_auto_watcher_pid = 0;
 //    g_ap_tmp_watcher_pid = 0;
-    g_lynq_wpa_ctrl[0] = NULL;
-    g_lynq_wpa_ctrl[1] = NULL;
     g_history_disconnect_valid_num = 0;   //clean history_disconenct_list info
     system("systemctl stop wg870_drv_insmod.service");
     pthread_mutex_unlock(&s_check_wpa_ctrl_mutex);
diff --git a/IC_src/mtk/packages/apps/lynq-log-transfer/lynq_inner_log_transfer.sh b/IC_src/mtk/packages/apps/lynq-log-transfer/lynq_inner_log_transfer.sh
index 1a8a462..189ab5c 100755
--- a/IC_src/mtk/packages/apps/lynq-log-transfer/lynq_inner_log_transfer.sh
+++ b/IC_src/mtk/packages/apps/lynq-log-transfer/lynq_inner_log_transfer.sh
@@ -129,7 +129,6 @@
 q_max_size_uci=""
 
 
-
 TAR_CMD="gzip"
 TAR_ARG=" -f"
 TAR_EXT="gz"
@@ -146,6 +145,78 @@
     mkdir -p ${CONTROL_FILE_PATH}
 fi
 
+#gpslog transfer to soc begin@cz.li,20240314
+GPS_LOG_PATH="${TMP_LOG_PATH}gps/"
+GPS_COF_PATH="/etc/gnss/mnl.prop"
+EXIST_GPS_NUM=0
+EXIST_GPS_NUM_MAX=180
+GPS_LOG_DEL=$(($EXIST_GPS_NUM_MAX/2))
+
+function get_gpslog_del_num()
+{	
+    if [ $1 -lt $((${2}/2)) ]; then
+        GPS_LOG_DEL=$((${1}+${2}/2))
+    else
+	    GPS_LOG_DEL=$((${1}-${2}/2))
+    fi
+}
+
+function do_gpslog_num_plus()
+{
+    ((EXIST_GPS_NUM++))
+    if [ $EXIST_GPS_NUM -gt $EXIST_GPS_NUM_MAX ]; then
+        EXIST_GPS_NUM=0
+    fi
+}
+
+function do_gps_log_transfer()
+{
+    cd ${GPS_LOG_PATH}
+    gpslog_prefix="gpslog"
+    for file_name in *."$1"; do 
+        gps_new_file_name=${gpslog_prefix}_${EXIST_GPS_NUM}.$1    
+        if [ -e "$file_name" ]; then        		   
+            mv $file_name $GPS_LOG_PATH${gps_new_file_name}
+            get_gpslog_del_num $EXIST_GPS_NUM $EXIST_GPS_NUM_MAX
+            ftp_delete_file ${gpslog_prefix}_${GPS_LOG_DEL}.$TAR_EXT
+            ftp_transfer_file_then_delete ${gps_new_file_name}    1 
+            do_gpslog_num_plus     
+        else
+            break;
+        fi    
+    done     
+}
+
+function gps_init_conf()
+{
+    echo "debug.dbg2file=1" > $GPS_COF_PATH
+    echo "debug.filename=${GPS_LOG_PATH}gpsdebug.log" >> $GPS_COF_PATH
+    echo "DBGLOG_FILE_MAX=5242880" >> $GPS_COF_PATH
+    echo "DBGLOG_FOLDER_MAX=10485760" >> $GPS_COF_PATH
+}
+
+function init_gpslog()
+{
+    target="DBGLOG_FILE_MAX=5242880"
+    sign=0
+    if [ ! -e ${GPS_COF_PATH} ]; then
+        gps_init_conf
+    else
+    while IFS= read -r line || [ -n "$line" ]; do
+        if [[ $line == *"$target"* ]]; then
+            sign=1
+            break
+        fi
+    done < ${GPS_COF_PATH}
+
+        if [ $sign -eq 0 ]; then
+            gps_init_conf
+            echo_debug_info "gps log file size is changed  to 5M" 
+        fi
+    fi
+}
+#gpslog transfer to soc end@cz.li,20240314
+
 function clear_relative_tag()
 {      
     length=${#transfer_log_tag[@]}
@@ -154,7 +225,10 @@
     do
         if [ ${transfer_log_tag[$i]} -eq 1 ]; then                       
             if [ $i -eq 0 ]; then              
-                rm -rf $SYS_LOG_PATH$log_prefix*                    
+                rm -rf $SYS_LOG_PATH$log_prefix* 
+                #gpslog transfer to soc begin@cz.li,20240314
+                rm -rf ${GPS_LOG_PATH}     
+                #gpslog transfer to soc end@cz.li,20240314            
             elif [ $i -eq 1 ]; then
                 echo 7 | emdlogger_ctrl        
                 rm -rf $MTK_LOG_PATH*
@@ -477,7 +551,13 @@
 {
     if [ $1 -eq 0 ]; then        
         do_sys_log_transfer "syslog.log"
-        echo "" > ${SYS_LOG_PATH}/syslog.log 
+        echo "" > ${SYS_LOG_PATH}/syslog.log
+        #gpslog transfer to soc begin@cz.li,20240314
+        if [ -d ${GPS_LOG_PATH} ]; then
+            do_gps_log_transfer "nma" 
+            do_gps_log_transfer "curf" 
+        fi
+        #gpslog transfer to soc end@cz.li,20240314
     elif [ $1 -eq 1 ]; 
     then
         do_mtk_log_transfer "muxz"
@@ -489,12 +569,15 @@
     fi    
 }
 
-
-
 function do_log_transfer()
 {
-    if [ $1 -eq 0 ]; then        
+    if [ $1 -eq 0 ]; then
         do_sys_log_transfer
+        #gpslog transfer to soc begin@cz.li,20240314
+        if [ -d ${GPS_LOG_PATH} ]; then 
+            do_gps_log_transfer "nma"
+        fi
+        #gpslog transfer to soc end@cz.li,20240314
     elif [ $1 -eq 1 ]; 
     then
         do_mtk_log_transfer "muxz"
@@ -635,7 +718,11 @@
 
 function loop_prepare()
 {
-    if [ $1 -eq 1 ]; then
+    #gpslog transfer to soc begin@cz.li,20240314
+    if [ $1 -eq 0 ]; then
+        init_gpslog
+    #gpslog transfer to soc end@cz.li,20240314
+    elif [ $1 -eq 1 ]; then
         echo 6 | emdlogger_ctrl
         if [ $? -ne 0 ]; then 
             echo_debug_info "start mtk log fail"
@@ -698,8 +785,12 @@
     if [ -e ${WAIT_TRANSFER_REMAIN_LOG[$index]} ]; then                
         exit_process $((ERROR_IS_IN_TRANSFER_LOG+${index}*5+2 ))
     fi          
-    
-    if [ $index -eq 1 ]; then
+    #gpslog transfer to soc begin@cz.li,20240314
+    if [ $index -eq 0 ]; then
+        #Because the GPS process cannot dynamically stop log output,${GPS_LOG_PATH} needs to be deleted in order to exit the log
+        rm -rf ${GPS_LOG_PATH}
+    #gpslog transfer to soc end@cz.li,20240314
+    elif [ $index -eq 1 ]; then
         echo 7 | emdlogger_ctrl
     elif [ $index -eq 2 ]; then
         show_relative_tag
@@ -733,7 +824,7 @@
 {
     index=$2
     if [ $index -eq 1 ]; then
-        #Æô¶¯debug
+        # activate  debug
         trigger_log_transfer 3  
         init_md_log
     fi	
diff --git a/IC_src/mtk/telephonyware/3.0/atcid/atci/src/Makefile b/IC_src/mtk/telephonyware/3.0/atcid/atci/src/Makefile
index 77f997a..7a5d595 100755
--- a/IC_src/mtk/telephonyware/3.0/atcid/atci/src/Makefile
+++ b/IC_src/mtk/telephonyware/3.0/atcid/atci/src/Makefile
@@ -7,6 +7,10 @@
     FLAGS += -DLYNQ_ATSVC 
 endif
 
+ifeq ($(strip $(MOBILETEK_ATCID_CFG)), WOM)
+    FLAGS += -DCONFIG_WOM_ATCID
+endif
+
 INCLUDES := -I. \
          -I./platform \
          -I./lynq-private \
diff --git a/IC_src/mtk/telephonyware/3.0/atcid/atci/src/atcid.c b/IC_src/mtk/telephonyware/3.0/atcid/atci/src/atcid.c
index 0eaff4f..54f1c5e 100755
--- a/IC_src/mtk/telephonyware/3.0/atcid/atci/src/atcid.c
+++ b/IC_src/mtk/telephonyware/3.0/atcid/atci/src/atcid.c
@@ -94,6 +94,27 @@
         listenVCOM = 1;
     }
 #else
+#ifdef CONFIG_WOM_ATCID
+    /*dongyu@2023.5.2 VCOM port as AT port in WOM platform meta mode, ELT port as AT port in normal mode start*/
+    snprintf(serial.devicename[0], strlen(TTY_GS0) + 1, "%s", TTY_GS0);
+    int listenVCOM = 1;
+    int bootMode = readSys_int(BOOTMODE_PATH);
+
+    LOGATCI(LOG_INFO, "bootMode = %d", bootMode);
+
+    if(bootMode == META_BOOT)
+    {
+        LOGATCI(LOG_INFO, "meta mode for CPE/ IVT, listen VCOM");
+        listenVCOM = 0;
+    }
+    else if(bootMode == NORMAL_BOOT)
+    {
+        LOGATCI(LOG_INFO, "normal mode for CPE/ IVT, listen ELT");
+        snprintf(serial.devicename[0], strlen(TTY_GS3) + 1, "%s", TTY_GS3);
+        listenVCOM = 1;
+    }
+    /*dongyu@2023.4.2 VCOM port as AT port in WOM platform meta mode, ELT port as AT port in normal mode end*/
+#else
     //for CPE / IVT listen TTYGS0
     snprintf(serial.devicename[0], strlen(TTY_GS0) + 1, "%s", TTY_GS0);
     int listenVCOM = 1; //listen ETS port as default
@@ -106,6 +127,7 @@
         listenVCOM = 0;
     }
 #endif
+#endif
 
     if (listenVCOM == 1) {
         for (i = 0; i < MAX_DEVICE_VCOM_NUM; i++) {
diff --git a/IC_src/mtk/telephonyware/3.0/atcid/atci/src/lynq-private/lynq_atsvc_plugin.xml b/IC_src/mtk/telephonyware/3.0/atcid/atci/src/lynq-private/lynq_atsvc_plugin.xml
index 3cdb250..ddb6a95 100755
--- a/IC_src/mtk/telephonyware/3.0/atcid/atci/src/lynq-private/lynq_atsvc_plugin.xml
+++ b/IC_src/mtk/telephonyware/3.0/atcid/atci/src/lynq-private/lynq_atsvc_plugin.xml
@@ -6,7 +6,7 @@
   />
   <module name="/lib64/liblynq-gnss.so"
                  register="lynq_register_gnss"
-                 cmd="AT+CGPS;AT+CGPSNMEA"
+                 cmd="AT+CGPS;AT+CGPSNMEA;AT+CGPSINFO"
   />
   <module name="/lib64/liblynq-at-common.so"
                  register="lynq_register_at_common"
@@ -16,4 +16,8 @@
                  register="lynq_register_at_factory"
                  cmd="AT+LYNQFACTORY"
   />
+  <module name="/lib64/liblynq-at-fota.so"
+                 register="lynq_register_fota"
+                 cmd="AT+FOTA;AT+LYNQFOTA"
+  />
 </lynq_atsvc_plugin>
\ No newline at end of file
diff --git a/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp b/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp
index 24aa3ad..d937316 100755
--- a/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp
+++ b/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp
@@ -1651,10 +1651,10 @@
             case -4: return PDP_FAIL_PREF_RADIO_TECH_CHANGED;
             case -5: return PDP_FAIL_RADIO_POWER_OFF;
             case -6: return PDP_FAIL_TETHERED_CALL_ACTIVE;
-            default: return PDP_FAIL_ERROR_UNSPECIFIED;
+            default: return (RIL_DataCallFailCause)cause;
         }
     } else {
-        return PDP_FAIL_ERROR_UNSPECIFIED;
+        return (RIL_DataCallFailCause)cause;
     }
 }
 
diff --git a/common_src/framework/lynq-ril-service/src/rtp/call_rtp.cpp b/common_src/framework/lynq-ril-service/src/rtp/call_rtp.cpp
index 0f8e597..e784cc6 100755
--- a/common_src/framework/lynq-ril-service/src/rtp/call_rtp.cpp
+++ b/common_src/framework/lynq-ril-service/src/rtp/call_rtp.cpp
@@ -143,25 +143,22 @@
 {

     RLOGD("%s start!",__FUNCTION__);

     android::Parcel p;

-

-    if(argc < 2) 

+    const char* vlan_info="";   

+        

+    if(argc >1) 

     {

-        android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_VLAN_INFO,0,2);

-        android::LYNQ_RIL_respSocket_sp(p,pRI);
-        free(pRI);
-        RLOGW("Warning: no %s!",__FUNCTION__);

-        return -1;
+        vlan_info=argv[1];      

     } 

 

-    if(exe_set_vlan_info(argv[1],strlen(argv[1])+1)==RESULT_OK)

+    if(exe_set_vlan_info(vlan_info,strlen(vlan_info)+1)==RESULT_OK)

     {

         android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_VLAN_INFO,0,0);

-        RLOGD(">>>>%s<<<< success value is %s!\n", __FUNCTION__, argv[1]);

+        RLOGD(">>>>%s<<<< success value is %s!\n", __FUNCTION__, vlan_info);

     }

     else

     {

         android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_VLAN_INFO,0,4);

-        RLOGE(">>>>%s <<<< failure value is %s!\n",__FUNCTION__, argv[1]);

+        RLOGE(">>>>%s <<<< failure value is %s!\n",__FUNCTION__, vlan_info);

     }       

 

     android::LYNQ_RIL_respSocket(p,(void *)pRI);  

@@ -514,7 +511,7 @@
                sprintf(ssrc_para_string,RTP_SSRC_INFO_FORMAT,g_rtp_server_info.ssrc);

             }

             sprintf(cmd,RTP_TO_CMD,   \

-            ssrc_para_string, g_rtp_server_info.ip,vlan_para_string,g_rtp_server_info.port);       

+            g_rtp_client_info.channels, g_rtp_client_info.clockrate, ssrc_para_string, g_rtp_server_info.ip,vlan_para_string,g_rtp_server_info.port);       

             

             RLOGD("start to rtp play: cmd is %s",cmd);

             system(cmd);    

@@ -680,7 +677,7 @@
     RLOGD("exe_set_rtp_port suc: LYNQ_Rtp_Mode is %d, port is %d", rtp_mode, port);

     return RESULT_OK;  

 }

-int exe_set_rtp_param(const int clock_rate,const int channels,const int latency) //only for client mode

+int exe_set_rtp_param(const int clock_rate,const int channels,const int latency) 

 {

     g_rtp_client_info.clockrate = clock_rate;

     g_rtp_client_info.channels = channels;

diff --git a/common_src/framework/lynq-ril-service/src/rtp/call_rtp_inner.h b/common_src/framework/lynq-ril-service/src/rtp/call_rtp_inner.h
index 7e5614f..0a1ebd0 100755
--- a/common_src/framework/lynq-ril-service/src/rtp/call_rtp_inner.h
+++ b/common_src/framework/lynq-ril-service/src/rtp/call_rtp_inner.h
@@ -15,8 +15,8 @@
     RTP_MODE_MAX

 }LYNQ_Rtp_Mode;

 

-#define RTP_FROM_CMD "gst-launch-1.0 -v udpsrc port=%d caps=\'application/x-rtp, media=(string)audio, clock-rate=(int)%d, channels=(int)%d\' ! rtpjitterbuffer latency=%d ! rtppcmadepay ! alawdec ! alsasink device=\'hw:0,2\'"

-#define RTP_TO_CMD   "gst-launch-1.0 -v alsasrc device=\'hw:0,6\' ! alawenc ! rtppcmapay ! %s udpsink host=%s %s auto-multicast=true port=%d"

+#define RTP_FROM_CMD "gst-launch-1.0 -v udpsrc port=%d caps=\'application/x-rtp, media=(string)audio, clock-rate=(int)%d, channels=(int)%d\' ! rtpjitterbuffer latency=%d ! rtpL16depay ! audioconvert ! alsasink device=\'hw:0,2\'"

+#define RTP_TO_CMD   "gst-launch-1.0 -v alsasrc device=\'hw:0,6\' ! audioconvert ! audio/x-raw,format=S16BE, channels=%d ! audioresample  ! audio/x-raw, rate=%d ! rtpL16pay ! %s udpsink host=%s %s auto-multicast=true port=%d"                        

 #define RTP_VLAN_INFO_FORMAT "multicast-iface=\"%s\""

 #define RTP_SSRC_INFO_FORMAT " rtpmux name=mux ssrc=%u !"

 

diff --git a/common_src/lib/liblynq-call/lynq_call.cpp b/common_src/lib/liblynq-call/lynq_call.cpp
index 8e6943d..0b7e385 100755
--- a/common_src/lib/liblynq-call/lynq_call.cpp
+++ b/common_src/lib/liblynq-call/lynq_call.cpp
@@ -30,7 +30,8 @@
 #define AUDIO_CTRL_SER "/tmp/audio_ctrl_service"

 #define LIBMODEM_AFE "/tmp/libmodem-afe-ctrl"

 #define TELE_DEMO_LOCK "/tmp/tel_demo_single_proc.lock"

-

+#define CALL_REBOOT_FLAG "/tmp/.call_reboot_flag"

+#define SYSTEM_UPTIME 40

 #define MAX_RING_INCOMING_INTERVAL 10

 

 using ::android::Parcel;

@@ -989,6 +990,49 @@
     return 0;

 }

 

+int call_boot_check()

+{

+    FILE *file = NULL;

+    int uptime = 0;

+

+    file = fopen("/proc/uptime", "r");

+    if(file == NULL) 

+    {

+        LYERRLOG("Error opening /proc/uptime");

+        return -1;

+    }

+    

+    if(fscanf(file, "%d ", &uptime) != 1) 

+    {

+        LYERRLOG("Error reading uptime value");

+    }

+    

+    fclose(file);

+

+    if(uptime > SYSTEM_UPTIME) 

+    {

+        LYINFLOG("System uptime is greater than 40 seconds.");

+    } 

+    else 

+    {

+        LYINFLOG("System uptime is less than 40 seconds.");

+        FILE *fp = NULL;

+        if(check_file_access(CALL_REBOOT_FLAG) != 0)

+        {

+            usleep(3000000);

+            fp = fopen(CALL_REBOOT_FLAG,"w");

+            if(fp == NULL)

+            {

+                LYERRLOG("Creat call reboot flag file failed !!!!");

+                return -1;

+            }

+            LYINFLOG("Creat flag file success");

+            fclose(fp);

+        }

+    }

+    return 0;

+

+}

 int lynq_call(int* handle,char addr[])

 {

     if(g_module_init_flag != MODULE_RUNNING)

@@ -997,6 +1041,11 @@
         return LYNQ_E_CONFLICT;

     }

     try_reset_audio_service();

+

+#ifdef GSW_RIL_CFG

+    call_boot_check();

+#endif

+

     int lynq_call_id = -1;

 

     LYINFLOG("lynq_call begin addr %s",addr);

diff --git a/common_src/lib/liblynq-call/lynq_call_rtp.cpp b/common_src/lib/liblynq-call/lynq_call_rtp.cpp
index 05b3032..092a85c 100755
--- a/common_src/lib/liblynq-call/lynq_call_rtp.cpp
+++ b/common_src/lib/liblynq-call/lynq_call_rtp.cpp
@@ -33,6 +33,17 @@
     return strndup16to8(s16, stringlen);

 }

 

+int is_whitespace_only(const char *str) {  

+    while (*str != '\0') {

+        if (!isspace((unsigned char)*str)) { 

+            return 0; 

+        }  

+        str++;

+    }  

+    return 1; 

+}  

+

+

 /*set*/

 int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode)

 {

@@ -62,9 +73,9 @@
         LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

         return LYNQ_E_CONFLICT;

     }

-    if (NULL == ip)

+    if (NULL == ip || is_whitespace_only(ip))

     {

-        LYERRLOG("ip is NULL!!!");

+        LYERRLOG("ip is NULL or white space string !!!");

         return LYNQ_E_PARAMETER_ANONALY;

     }

     if ((ip_length < strlen(ip)+1) || (ip_length > MAX_IP_LENGTH))

@@ -94,15 +105,24 @@
         LYERRLOG("vlan_info is NULL!!!");

         return LYNQ_E_PARAMETER_ANONALY;

     }

-    

-    if ((vlan_info_length < strlen(vlan_info)+1) || (vlan_info_length > MAX_VLAN_INFO_LENGTH))

-    {

-        LYERRLOG("incoming vlan_info error, vlan info length %d", vlan_info_length);

-        return LYNQ_E_PARAMETER_ANONALY;

-    }    

 

     Parcel* p=NULL;

-    int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,1,"%s",vlan_info);

+    int ret;

+

+    if(is_whitespace_only(vlan_info))

+    {

+        ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,0,"");    

+    }

+    else

+    {

+        if ((vlan_info_length < strlen(vlan_info)+1) || (vlan_info_length > MAX_VLAN_INFO_LENGTH))

+        {

+            LYERRLOG("incoming vlan_info error, vlan info length %d", vlan_info_length);

+            return LYNQ_E_PARAMETER_ANONALY;

+        }       

+        ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,1,"%s",vlan_info);

+    }    

+    

     if(ret==RESULT_OK)

     {

         delete p;        

diff --git a/common_src/lib/liblynq-call/makefile b/common_src/lib/liblynq-call/makefile
index 6073694..6d3e7ba 100755
--- a/common_src/lib/liblynq-call/makefile
+++ b/common_src/lib/liblynq-call/makefile
@@ -41,6 +41,10 @@
     -llynq-log \
     -llynq-shm \
 
+ifeq ($(strip $(MOBILETEK_RIL_CFG)), GSW)
+    LOCAL_CFLAGS += -DGSW_RIL_CFG
+endif
+
 SOURCES = $(wildcard *.cpp)
 
 EXECUTABLE = liblynq-call.so
diff --git a/common_src/lib/liblynq-network/lynq_network.cpp b/common_src/lib/liblynq-network/lynq_network.cpp
index ca07f55..311a360 100755
--- a/common_src/lib/liblynq-network/lynq_network.cpp
+++ b/common_src/lib/liblynq-network/lynq_network.cpp
@@ -468,6 +468,80 @@
     return RESULT_OK;  

 }

 

+int lynq_query_registration_state_from_parcel(Parcel* p, int num,int reject_index, int* regState,char * LAC,char * CID,int *netType,int *netRejected)

+{

+    int i;

+    char *resp[LYNQ_RESP_STRING_MAX_NUM]={0};    

+    int ret = RESULT_OK;

+    for(i=0;i<num;i++)

+    {

+        resp[i]=lynqStrdupReadString(p);

+    }            

+    if(resp[0]==NULL)

+    {

+        LYERRLOG("%s resp[0] %s is NULL",__func__,resp[0]);

+        ret = LYNQ_E_INNER_ERROR;

+        goto registration_from_parcel_return;

+    }

+    *regState = atoi(resp[0]);   

+    strcpy(CID,""); 

+    strcpy(LAC,"");

+    *netType = RADIO_TECH_UNKNOWN;            

+    *netRejected = -1;                   

+    if((*regState)==1 || (*regState)==5) 

+    {   

+        if(resp[1]!=NULL) 

+        {

+            strcpy(LAC,resp[1]);

+        }

+        else 

+        {           

+            LYERRLOG("%s resp[1] %s is NULL",__func__);

+        }

+        

+        if(resp[2]!=NULL) 

+        {

+            strcpy(CID,resp[2]);

+        }

+        else 

+        {                

+            LYERRLOG("%s resp[2] %s is NULL",__func__);

+        }

+

+        if(resp[3]!=NULL) 

+        {

+            *netType = atoi(resp[3]);

+        }

+        else 

+        {            

+            LYERRLOG("%s data resp[3] %s is NULL",__func__);

+        }

+    }

+    else if((*regState)==3 || (*regState)==13)

+    {    

+        if(resp[reject_index]==NULL)

+        {    

+            LYERRLOG("%s resp[%d] is NULL",__func__,reject_index);            

+        }  

+        else 

+        {

+            *netRejected = atoi(resp[reject_index]);            

+        }        

+    }    

+

+registration_from_parcel_return:

+

+    for(i=0;i<num;i++)

+    {

+        if(resp[i]!=NULL)

+        {

+            free(resp[i]);             

+        }            

+    }                  

+    return ret;

+}

+

+

 int lynq_query_registration_state(const char *type,int* regState,int* imsRegState,char * LAC,char * CID,int *netType,int *radioTechFam,int *netRejected)

 {

     if(g_module_init_flag != MODULE_RUNNING)

@@ -492,14 +566,14 @@
     memcpy(str,type,strlen(type)+1);

     strUpper(str);

     if(!strcmp(str,"VOICE"))

-    {

-        if(get_state_from_buf(NETWORK_STATE_BUFFER_TYPE_VOICE_REG,3,regState,netType,netRejected,0)==0)

+    {    

+        if(get_state_from_buf(NETWORK_STATE_BUFFER_TYPE_VOICE_REG,3,regState,netType,netRejected,2,LAC,CID)==0)

         {

             return RESULT_OK;  

         }       

         request = RIL_REQUEST_VOICE_REGISTRATION_STATE;

     }else if(!strcmp(str,"DATA")){

-        if(get_state_from_buf(NETWORK_STATE_BUFFER_TYPE_DATA_REG,2,regState,netType,2,LAC,CID)==0)

+        if(get_state_from_buf(NETWORK_STATE_BUFFER_TYPE_DATA_REG,3,regState,netType,netRejected,2,LAC,CID)==0)

         {

             return RESULT_OK;  

         }      

@@ -524,28 +598,21 @@
         return ret;  

     }   

     

-    int num,i;

-    char *resp[LYNQ_RESP_STRING_MAX_NUM];       

+    int num;

+    char *resp[LYNQ_RESP_STRING_MAX_NUM]={0};       

     if(!strcmp(str,"VOICE"))

-    {

-        p->readInt32(&num);

-        if(num == 15)

+    {        

+        p->readInt32(&num);        

+        if(num >0 && num<=15)

         {

-            for(i=0;i<15;i++)

+            ret=lynq_query_registration_state_from_parcel(p, num, 13, regState, LAC,CID,netType,netRejected);

+            if(ret!=RESULT_OK)

             {

-                resp[i]=lynqStrdupReadString(p);

-            }            

-            *regState = atoi(resp[0]);

-            *netType = atoi(resp[3]);

-            *netRejected = atoi(resp[14]);     

-            for(i=0;i<15;i++)

-            {

-                if(resp[i]!=NULL)

-                {

-                    free(resp[i]);            

-                }            

-            }            

-            set_state_to_buf(NETWORK_STATE_BUFFER_TYPE_VOICE_REG,3,*regState,*netType,*netRejected,0);

+                LYERRLOG("%s call lynq_query_registration_state_from_parcel fail",__func__);             

+                goto registration_return;       

+            }  

+            set_state_to_buf(NETWORK_STATE_BUFFER_TYPE_VOICE_REG,3,*regState,*netType,*netRejected,2,LAC,CID);

+            goto registration_return;

         }

         else 

         {

@@ -556,24 +623,17 @@
     }

     else if(!strcmp(str,"DATA")){

         p->readInt32(&num);

-        if(num == 11)

-        {                

-            for(i=0;i<4;i++)

+        if(num >0 && num <=11)

+        {        

+            ret=lynq_query_registration_state_from_parcel(p, num, 4, regState, LAC,CID,netType,netRejected);

+            if(ret!=RESULT_OK)

             {

-                resp[i]=lynqStrdupReadString(p);

-            }            

-            *regState = atoi(resp[0]);

-            strcpy(LAC,resp[1]);

-            strcpy(CID,resp[2]);

-            *netType = atoi(resp[3]);

-            for(i=0;i<4;i++)

-            {

-                if(resp[i]!=NULL)

-                {

-                    free(resp[i]);            

-                }           

-            }            

-            set_state_to_buf(NETWORK_STATE_BUFFER_TYPE_DATA_REG,2,*regState,*netType,2,LAC,CID);

+                LYERRLOG("%s call lynq_query_registration_state_from_parcel fail",__func__);             

+                goto registration_return;       

+            }              

+                        

+            set_state_to_buf(NETWORK_STATE_BUFFER_TYPE_DATA_REG,3,*regState,*netType,*netRejected,2,LAC,CID);                

+            goto registration_return;

         }

         else 

         {

@@ -598,10 +658,18 @@
             delete p;

             return LYNQ_E_INNER_ERROR;

         }            

-    }

-    LYINFLOG("%s suc",__func__); 

-    delete p;        

-    return RESULT_OK;     

+    }  

+     

+registration_return:

+

+    if(ret==RESULT_OK)

+    {

+        LYINFLOG("%s suc",__func__); 

+    }    

+   

+    delete p;

+    return ret;

+    

 }

 

 int lynq_query_prefferred_networktype(int *preNetType)

diff --git a/common_src/lib/liblynq-sms/lynq_sms.cpp b/common_src/lib/liblynq-sms/lynq_sms.cpp
index 4522fb6..938eedf 100755
--- a/common_src/lib/liblynq-sms/lynq_sms.cpp
+++ b/common_src/lib/liblynq-sms/lynq_sms.cpp
@@ -152,7 +152,7 @@
         char msg_e_b[msglen*2+1] = {0};// +1 for end of string.*2:A char array contains two elements of a string for each value

         ArrayToStr(msg, msglen, msg_e_b);

         LYINFLOG("tel, charset, msg_e_b: %s, %d, %s", telephony_num, charset, msg_e_b);

-        int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_SEND_SMS,3,"%s %d %s",telephony_num, charset, msg_e_b);

+        int ret=lynq_send_common_request(p,20,RIL_REQUEST_SEND_SMS,3,"%s %d %s",telephony_num, charset, msg_e_b);

         if(ret!=RESULT_OK)

         {

             LYERRLOG("%s  8bit send error %d",__func__,__LINE__);

@@ -163,7 +163,7 @@
     }

     else//other bit

     {

-        int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_SEND_SMS,3,"%s %d %s",telephony_num, charset, msg);

+        int ret=lynq_send_common_request(p,20,RIL_REQUEST_SEND_SMS,3,"%s %d %s",telephony_num, charset, msg);

         if(ret!=RESULT_OK)

         {

             LYERRLOG("%s  7bit send error %d",__func__,__LINE__);