Merge "[Bugfix][T106BUG-479]Fix that the AT port has no output and cannot input"
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin
index ae19b25..197aad6 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin
index 854310c..8ef3392 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin
Binary files differ
diff --git a/ap/app/Script/scripts/wan_ipv4.sh b/ap/app/Script/scripts/wan_ipv4.sh
index 7c0ba39..95b5203 100755
--- a/ap/app/Script/scripts/wan_ipv4.sh
+++ b/ap/app/Script/scripts/wan_ipv4.sh
@@ -116,11 +116,11 @@
 		pswan_secdns=`nv get $wan_if"_secdns"`
 		pswan_nm=`nv get $wan_if"_nm"`
 		
-		#ifconfig $wan_if down 2>>$test_log
-		ifconfig $wan_if $pswan_ip netmask 255.255.255.0 up 2>>$test_log
-		if [ $? -ne 0 ];then
-	        echo "Error: ifconfig $wan_if $pswan_ip up failed." >> $test_log
-        fi
+#		#ifconfig $wan_if down 2>>$test_log
+#		ifconfig $wan_if $pswan_ip netmask 255.255.255.0 up 2>>$test_log
+#		if [ $? -ne 0 ];then
+#	        echo "Error: ifconfig $wan_if $pswan_ip up failed." >> $test_log
+#        fi
 		
 		pswan_pri=`nv get pswan_priority`
 		rt_num=`expr $pswan_pri \* 10 + $c_id`
@@ -296,4 +296,4 @@
 		tc_tbf.sh down $def_cid
 	fi
 	linkdown $2 $3	
-fi
\ No newline at end of file
+fi
diff --git a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
index 36ec590..7e853a8 100755
--- a/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
+++ b/ap/app/zte_comm/zte_mainctrl/netdev_proc.c
@@ -686,6 +686,7 @@
 	scriptmsg.cid = cid;
 	scriptmsg.iptype = iptype;
 	char buffer[128] = {0};
+	char nv_value[16] = {0};
 	
 	slog(NET_PRINT, SLOG_NORMAL, "$$$$$net_sendmsg_2_atctl cid=%d,iptype=%d\n", cid, iptype);
 	ret = ipc_send_message(MODULE_ID_MAIN_CTRL, MODULE_ID_AT_CTL, cmd, sizeof(TScriptMSG), &scriptmsg, 0); 
@@ -693,10 +694,18 @@
 		softap_assert("send msg to at_ctl error");		
 	}
 	snprintf(buffer, sizeof(buffer), "pdp_act_state_%d", cid);
-	if(cmd == MSG_CMD_LINKUP_END)
-		sc_cfg_set(buffer, "act");
-	else if(cmd == MSG_CMD_LINKDOWN_END)
-		sc_cfg_set(buffer, "deact");
+	sc_cfg_get(buffer, nv_value, sizeof(nv_value)-1);
+	if(cmd == MSG_CMD_LINKUP_END){
+		if(strcmp(nv_value,"acting") == 0)
+			sc_cfg_set(buffer, "act");
+		else
+			slog(NET_PRINT, SLOG_ERR, "$$$$$net_sendmsg_2_atctl_up 5s=%s\n", buffer, nv_value);
+	}else if(cmd == MSG_CMD_LINKDOWN_END){
+		if(strcmp(nv_value,"deacting") == 0)
+			sc_cfg_set(buffer, "deact");
+		else
+			slog(NET_PRINT, SLOG_ERR, "$$$$$net_sendmsg_2_atctl_down %s=%s\n", buffer, nv_value);
+	}
 }
 
 void pdp_wan_config_quick(struct pdp_active_info *actinfo, char *prefix, int prefix_len)
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-fota-backup/files/lynq-fota-backup.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-fota-backup/files/lynq-fota-backup.cpp
index 84a727b..d91390c 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-fota-backup/files/lynq-fota-backup.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-fota-backup/files/lynq-fota-backup.cpp
@@ -27,6 +27,7 @@
 extern "C" {

 #endif

 

+#define FOTA_REBOOT_FLAG "/mnt/userdata/.fota_reboot_flag"

 #define FOTA_FLAG_FILE "/mnt/userdata/.back_up_flag"

 #define FOTA_SYNC_FLAG    1

 

@@ -34,6 +35,24 @@
 extern int lynq_fota_get_addr_value(char *tmp_value);

 extern int lynq_fota_set_addr_value(char        *value,int size);

 extern int lynq_fota_nrestart(void);

+#define REBOOT_DONE  1

+

+void set_upgrade_reboot_flag(void)

+{

+    FILE *fp = NULL;

+    int reboot_flag = REBOOT_DONE;

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

+    if(fp == NULL)

+    {

+        printf("Open reboot flag file failed\n");

+        return;

+    }

+    

+    fwrite(&reboot_flag,sizeof(int),1,fp);

+    fclose(fp);

+    system("sync");

+    return ;

+}

 int main()

 {

     int ret = 0 ;

@@ -48,8 +67,11 @@
         return -1;

 

     }

-    

+   

     fread(&sync_flag,sizeof(int),1,fp);

+    fclose(fp);

+    

+    set_upgrade_reboot_flag();

     

     if(sync_flag == FOTA_SYNC_FLAG)

     {

@@ -57,7 +79,6 @@
         if(ret != 0)

         {

             printf("sync faild\n");

-            fclose(fp);

         }

        system("rm -rf /mnt/userdata/.back_up_flag");

         

@@ -76,7 +97,6 @@
         {

             printf("Set addr failed\n");

             return -1;

-

         }

         ret = lynq_fota_nrestart();

         if(ret != 0)

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/files/lynq-qser-fota-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/files/lynq-qser-fota-demo.cpp
index 63c9504..de637ec 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/files/lynq-qser-fota-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/files/lynq-qser-fota-demo.cpp
@@ -5,14 +5,30 @@
 #include <unistd.h>

 #include <dlfcn.h>

 #include <stdint.h>

+#include <pthread.h>

 

 int (*lynq_get_upgrade_status)(void);

 int (*lynq_fota_set_addr_value)(char *value,int size);

 int (*lynq_fota_nrestart)(void);

 int (*lynq_rock_main)(int first_run);

-

+int (*lynq_read_process)(void);

 void *dlHandle_fota = NULL;

 

+void *thread_function_noreboot(void *arg) 

+{

+

+        lynq_fota_nrestart();

+        return NULL;

+}

+

+void *thread_function_reboot(void *arg) 

+{

+

+        lynq_rock_main(1);

+        return NULL;

+}

+

+

 int main(int argc,char *argv[])

 {

     int ret = 0;

@@ -53,6 +69,13 @@
         printf("lynq_rock_main is null\n");

         return -1;

     }

+

+    lynq_read_process = (int (*)(void))dlsym(dlHandle_fota,"lynq_read_process");

+    if(lynq_read_process == NULL)

+    {

+        printf("lynq_read_process is null\n");

+        return -1;

+    }

     

     ret = lynq_fota_set_addr_value(value,(int )strlen(value));

     if(ret != 0)

@@ -60,34 +83,53 @@
         printf("set upgrade package addr failed\n");

         return -1;

     }

-

-    printf("Please chose  reboot or not when upgrade done  1: reboot 0: not reboot\n");

-    scanf("%d",&reboot_flag);

-

-    switch(reboot_flag)

+    while(1)

     {

-        case 0:

-            printf("Not reboot when upgrade done!!!\n ");

-            ret = lynq_fota_nrestart();

-            printf("upgrade result is %d\n",ret);

-            ret = lynq_get_upgrade_status();

-            printf("get upgrade status result is %d\n",ret);

-            break;

+        printf("Please chose action  0:  upgrade done ,not reboot 1: upgrade done ,reboot 2:get upgrade status 3:read fota process \n");

+        scanf("%d",&reboot_flag);

 

-        case 1:

-            printf("Will reboot when upgrade done!!!\n ");

-            ret = lynq_rock_main(1);

-            printf("upgrade result is %d\n",ret);

-            ret = lynq_get_upgrade_status();

-            printf("get upgrade status result is %d\n",ret);

-            break;

+        switch(reboot_flag)

+        {

+            case 0:

+                {

+                    pthread_t thread_id_noreboot;

+                    int result = pthread_create(&thread_id_noreboot, NULL, thread_function_noreboot, NULL);

+                    if (result != 0) 

+                    {

+                        printf("pthread_create failed \n");

+                        return -1;;

+                    }

+                }

+                break;

 

-        default:

-            printf("please input right flag 1 or 0\n");

-            break;

+            case 1:

+                {

+                    pthread_t thread_id_reboot;

+                    int result = pthread_create(&thread_id_reboot, NULL, thread_function_reboot, NULL);

+                    if (result != 0) 

+                    {

+                        printf("pthread_create failed \n");

+                        return -1;;

+                    }

+                }

+                break;

+            case 2:

+                printf("Get fota upgrade status \n");

+                ret = lynq_get_upgrade_status();

+                printf("lynq_get_upgrade_status ret is %d\n",ret);

+                break;

+            case 3:

+                printf("get fota upgrade process\n");

+                ret = lynq_read_process();

+                printf("Now upgrade process is %d\n",ret);

+                break;

+            default:

+                printf("please input right flag 0 or 1 or 2 or 3\n");

+                break;

 

+        }

+         

     }

-    

     return 0;

 

 }

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/lynq-qser-fota-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/lynq-qser-fota-demo.bb
index d24b8bb..1ce3f8c 100644
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/lynq-qser-fota-demo.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-fota-demo/lynq-qser-fota-demo.bb
@@ -16,7 +16,7 @@
 
 LOCAL_C_INCLUDES = "-I."
 
-LOCAL_LIBS = "-L. -ldl -lstdc++"
+LOCAL_LIBS = "-L. -ldl -lstdc++ -lpthread"
 
 #INHIBIT_PACKAGE_STRIP = "1"
 S = "${WORKDIR}"
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index a32e119..e1fdb18 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -1611,7 +1611,7 @@
         return LYNQ_E_PARAMETER_ANONALY;

     }

     if((handle ==RIL_UNSOL_SIGNAL_STRENGTH && NULL == solSigStren) || 

-        (handle ==RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED && NULL == slot_id))

+        (handle !=RIL_UNSOL_SIGNAL_STRENGTH && NULL == slot_id))

     {

         LYINFLOG("incoming solSigStren or slot_id is NULL!!!");

         return LYNQ_E_PARAMETER_ANONALY;

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/include/lynq-qser-fota.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/include/lynq-qser-fota.h
index 34be9aa..2a8cfd6 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/include/lynq-qser-fota.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/include/lynq-qser-fota.h
@@ -18,6 +18,7 @@
 int lynq_fota_set_addr_value(char        *value,int size);

 int lynq_fota_nrestart(void);

 int lynq_rock_main(int first_run);

+int lynq_read_process(void);

 

 #ifdef __cplusplus

 }

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
index 53ee3c8..5dab391 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
@@ -28,12 +28,13 @@
 #include "include/lynq-qser-fota.h"

 #include "liblog/lynq_deflog.h"

 

-#define FOTA_FLAG_FILE "/mnt/userdata/.back_up_flag"

 

+#define FOTA_REBOOT_FLAG "/mnt/userdata/.fota_reboot_flag"

+#define FOTA_FLAG_FILE "/mnt/userdata/.back_up_flag"

 #define USER_LOG_TAG    "LYNQ_FOTA"

 #define FOTA_ADDR_FILE  "/mnt/userdata/.addr_value"

 #define FOTA_FILE_NAME  "upgrade.package"

-

+#define FOTA_UPGRADE_PROCESS  "/mnt/userdata/.fota_upgrade_process"

 #define  SYSTEM_A  "34650"

 #define  SYSTEM_B  "39019"

 

@@ -49,6 +50,18 @@
 #define    LYNQ_UPGRADE_STATUS_UPDATE_SUCCESS      (4)

 #define    LYNQ_UPGRADE_STATUS_UPDATE_FAIL         (5)

 

+#define    LYNQ_SYNNCHRONIZING  8

+#define    LYNQ_SYNC_SUCCESS    9

+#define    LYNQ_SYNC_FAILED    -1

+

+#define    ZXIC_SYNCHRONIZING    1

+#define    ZXIC_SYNC_SUCCESS      0

+

+#define    NO_REBOOT    0

+

+

+int total_size = 0;

+int upgrade_size = 0;

 

 typedef struct

 {

@@ -122,6 +135,7 @@
     int ret = 0;

     int current_slot = 0;

     int fota_sync_flag = 0;

+    int reboot_flg = NO_REBOOT;

     FILE *fp = NULL;

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

     if(fp == NULL)

@@ -134,6 +148,17 @@
 

     /* T106BUG-189 fix */

     system("sync");

+

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

+    if(fp == NULL)

+    {

+        LYERRLOG("Creaf get upgrade status flag failed");

+        return -1;

+    }

+

+    fwrite(&reboot_flg,sizeof(int),1,fp);

+    fclose(fp);

+    system("sync");

     

     ret = lynq_fota_verify();

     if(ret != 0)

@@ -233,7 +258,20 @@
     LYINFLOG("Total size:%d ", p_status->total_size);

 

     LYINFLOG("Updated size:%d ", p_status->upgraded_size);

-    return ;

+

+    total_size = p_status->total_size;

+    upgrade_size = p_status->upgraded_size;

+

+    FILE *fp = NULL;

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

+    if (fp == NULL) 

+    {

+        LYERRLOG("Error opening file");

+        return;

+    }

+    

+    fprintf(fp, "%d,%d\n", total_size, upgrade_size);

+    fclose(fp);

 }

 

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

@@ -528,21 +566,59 @@
 {

     z_upgrade_status_info_t status;

     int ret = 0;

-

-    

-    ret = zxic_dual_get_upgrade_status(&status);

-    if(ret  < 0)

+    int reboot_flag = -1;

+    FILE *fp = NULL;

+    fp = fopen(FOTA_REBOOT_FLAG,"r");

+    if(fp == NULL)

     {

-        LYINFLOG("Get upgrade status fail! ");

+        LYERRLOG("Open reboot flag file failed");

         return -1;

     }

+    

+    fread(&reboot_flag,sizeof(int),1,fp);

+    fclose(fp);

+    

+    //get upgrade status before no reboot

+    if(reboot_flag == NO_REBOOT)

+    {

+    

+        ret = zxic_dual_get_upgrade_status(&status);

+        if(ret  < 0)

+        {

+            LYERRLOG("Get upgrade status fail! ");

+            return -1;

+        }

      

-    LYINFLOG("Current upgrade info: ");

-    LYINFLOG("Current upgrade status:%d ", status.upgrade_status);

-    LYINFLOG("Current upgrade total size:%d ", status.total_size);

-    LYINFLOG("Current upgrade updated size:%d ", status.upgraded_size);

-

-    return status.upgrade_status;

+        LYINFLOG("Current upgrade info: ");

+        LYINFLOG("Current upgrade status:%d ", status.upgrade_status);

+        LYINFLOG("Current upgrade total size:%d ", status.total_size);

+        LYINFLOG("Current upgrade updated size:%d ", status.upgraded_size);

+                           

+        return status.upgrade_status;

+    }

+    else

+    {

+        //get sync status 

+        int fota_sync_tatus = 0;

+        fota_sync_tatus = lynq_get_sync_status();

+        if(fota_sync_tatus == ZXIC_SYNCHRONIZING)

+        {

+            LYINFLOG("Now fota upgrade sync status is synchronizing");

+            return LYNQ_SYNNCHRONIZING;

+        }

+        else if(fota_sync_tatus == ZXIC_SYNC_SUCCESS)

+        {

+            LYINFLOG("Now fota upgrade sync status sync success ");

+            return LYNQ_SYNC_SUCCESS;

+        }        

+        else if(fota_sync_tatus == LYNQ_SYNC_FAILED)

+        {

+            LYERRLOG("Now fota upgrade sync status sync failed ");

+            return LYNQ_SYNC_FAILED;

+        }

+        

+        

+    }

 

 }

 

@@ -753,7 +829,7 @@
     int sync_status = -2;

     zxic_dual_get_sync_status(&sync_status);

     LYINFLOG("Current sync status is %d", sync_status);

-    return 0;

+    return sync_status;

 }

 

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

@@ -785,6 +861,67 @@
     return 0;

 }

 

+/*****************************************

+* @brief:lynq_read_process

+* @param count [IN]:NS

+* @param sum [OUT]:NA

+* @return :fota upgrade process 0-10

+* @todo:NA

+* @see:NA

+* @warning:NA

+*****************************************/

+int lynq_read_process(void)

+{

+    LYINFLOG("Enter lynq_read_process");

+    

+    float fota_process = 0;

+    int ration = 0;

+    int read_count = 0;

+    FILE *fp = NULL;

+    

+    while(1)

+    {

+        

+        fp = fopen(FOTA_UPGRADE_PROCESS, "r");

+        if(fp == NULL)

+        {

+            LYERRLOG("lynq_read_process open file failed");

+            usleep(10000);

+            read_count++;

+            if(read_count > 5)

+            {

+                break;

+            }

+        }

+        else

+        {

+            break;

+        }

+    }

+    

+    if(fp != NULL) 

+    {

+        

+        char line[256] = {0};

+        if (fgets(line, sizeof(line), fp) != NULL) 

+        {

+            sscanf(line, "%d,%d", &total_size, &upgrade_size);

+        }

+        fclose(fp);

+    }

+    

+    

+    if(total_size != 0 && upgrade_size <= total_size)

+    {

+        LYINFLOG("Caculate fota process ration ");

+        fota_process =  (float) upgrade_size / total_size;

+     }

+     

+     ration = (int)(fota_process * 10);

+     LYINFLOG("Fota process ration is %d",ration);

+     return ration;

+}

+

 DEFINE_LYNQ_LIB_LOG(LYNQ_FOTA)

 

 #ifdef __cplusplus

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
index 8400938..04ce391 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
@@ -62,9 +62,6 @@
 static int sCSQ[2] = { 99, 99 };

 static int sys_mode = 0;/*LTE*/

 

-static int airPlaneMode = 0;

-

-

 static uint64_t ref_ril_nano_time(void)

 {

 	struct timespec now;

@@ -257,6 +254,10 @@
 	setRadioState(RADIO_STATE_OFF);

 }

 

+void resetRadioStateOff(void)

+{

+    setRadioStateOff();

+}

 

 static void reportRadioTech(RIL_Token t)

 {

@@ -1016,7 +1017,6 @@
 	if ((err < 0 || response->success == 0) && (isRadioOn() != 1)) {

 		goto error;

 	}

-	airPlaneMode = 0;

 	updateRadioState();

 	ril_request_open_zsqr_notify();

 

@@ -1856,33 +1856,27 @@
 	RIL_RadioState  currentState = getRadioState();

 

 	RLOGD("ril_request_radio_power(): onOff=%d, currentState=%d", onOff, currentState);

-	if ((onOff == 4) && (currentState != RADIO_STATE_OFF)) {

+	if ( onOff == 4 ) {

 		RLOGD("onOff=%d, currentState=%d   --> AT+CFUN=4", onOff, currentState);

 		err = at_send_command_timeout("AT+CFUN=4", &response, TIMEOUT_CFUN);

 		DO_MM_RESPONSE_ERROR_JDUGE;

 		setRadioStateOff();

-		airPlaneMode = 1;

-	} else if ((onOff == 0) && (currentState != RADIO_STATE_OFF)) {

+	} else if ( onOff == 0 ) {

 		RLOGD("onOff=%d, currentState=%d   --> AT+CFUN=4", onOff, currentState);

 		err = at_send_command_timeout("AT+CFUN=4", &response, TIMEOUT_CFUN);

 		DO_MM_RESPONSE_ERROR_JDUGE;

 		//err = at_send_command("AT^ZPOWEROFF", NULL); //poweroff

-		airPlaneMode = 1;

 		setRadioStateOff();

-	} else if (((onOff == 1) && (currentState == RADIO_STATE_OFF)) || (currentState == RADIO_STATE_UNAVAILABLE) || (currentState == RADIO_STATE_SIM_READY)) {

+	} else if (onOff == 1) {

 		RLOGD("onOff=%d, currentState=%d   --> AT+CFUN=1", onOff, currentState);

 		err = at_send_command_timeout("AT+CFUN=1", &response, TIMEOUT_CFUN);

 		if ((err < 0 || response->success == 0) && (isRadioOn() != 1)) {

 			goto error;

 		}

-		airPlaneMode = 0;

 		updateRadioState();

 		ril_request_open_zsqr_notify();

-	} else if ((onOff == 4) && (airPlaneMode == 1)) {

-		RLOGD("onOff=%d, airPlaneMode=%d   --> AT^ZPOWEROFF", onOff, airPlaneMode);

-		at_send_command("AT^ZPOWEROFF", NULL);

-		setRadioStateOff();

-	}

+	} 

+

 	RIL_onRequestComplete(token, RIL_E_SUCCESS, NULL, 0);

 	goto exit;

 error:

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
index 64eecd2..43b4347 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
@@ -248,7 +248,17 @@
 
 RIL_RadioState getRadioState(void)
 {
-	return sState;
+    int radioState = -1;
+    
+    radioState = isRadioOn();
+    
+    if(1 == radioState) {    
+        updateRadioState();    
+    } 
+    else if((0 == radioState) || (4 == radioState)) {
+        resetRadioStateOff();    
+    }
+    return sState;
 }
 
 /** returns 1 if on, 0 if off, and -1 on error */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
index 0b985a2..8b12387 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
@@ -177,6 +177,7 @@
 void requestSendUSSD(void *data, size_t datalen, RIL_Token t);

 void requestCancelUSSD(void *data, size_t datalen, RIL_Token t);

 void requestDeviceIdentity(void *data, size_t datalen, RIL_Token t);

+void resetRadioStateOff(void);

 

 /*ril_sim.c*/

 void ril_handle_sim_pin_puk(int request, void *data, size_t datalen, RIL_Token token);

diff --git a/mk_T106.sh b/mk_T106.sh
index 6a218cc..2a53128 100644
--- a/mk_T106.sh
+++ b/mk_T106.sh
@@ -1,7 +1,11 @@
 #!/bin/bash
 TOP=$(pwd)
 source update_version.sh
-
+mkdir esdk_patch/Uboot
+cp -R boot/ build/ cp/ pub/ rpm/ tools/ esdk_patch/Uboot/
+cd esdk_patch
+tar -czvf Uboot.tar.gz Uboot
+cd ${TOP}
 cd ap/project/zx297520v3/prj_vehicle_dc_ref/build/
 make allclean all
 cd ../../../../..
@@ -29,6 +33,7 @@
 tar -czvf upstream.tar.gz upstream
 mkdir do_package_tool
 cd ${TOP}
+cp esdk_patch/Uboot.tar.gz allbins cap/zx297520v3/build-vehicle_dc_ref/tmp/deploy/sdk/
 cp -R allbins cap/zx297520v3/build-vehicle_dc_ref/tmp/deploy/sdk/do_package_tool/
 cd cap/zx297520v3/build-vehicle_dc_ref/tmp/deploy/sdk/
 tar -czvf do_package_tool.tar.gz do_package_tool