Merge "Revert "[Feature][ZXW-218][POWER]gmac power off defaultly""
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral.c b/boot/common/src/uboot/drivers/peripheral/peripheral.c
index 3646130..be5825f 100755
--- a/boot/common/src/uboot/drivers/peripheral/peripheral.c
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral.c
@@ -34,9 +34,6 @@
 ****************************************************************************/

 #define SD1_IO_1V8_EN	0x13c830

 #define REG32(x)			    (*(volatile u32*)(x))

-//xf.li@20230412 add for enable GNSS start

-#define ZX_TOP_CRM_BASE	0x0013B000

-//xf.li@20230412 add for enable GNSS end

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

 *											   Local Types

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

@@ -83,8 +80,6 @@
 	

 	REG32(SD1_IO_1V8_EN) |=(1<<1);

 //xf.li@20230412 add for enable GNSS start

-	REG32(ZX_TOP_CRM_BASE + 0x34) |= (0x1<<5);

-	zDrvGpio_SetFunc(GPIO15,GPIO15_CLK_OUT0);

 	/*关闭gps电源*/

 	zDrvGpio_SetFunc(GPIO86, GPIO86_GPIO86);

 	zDrvGpio_SetDirection(GPIO86, GPIO_OUT);

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/files/poweralarm-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/files/poweralarm-demo.cpp
index 75da1e1..2e0f71f 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/files/poweralarm-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/files/poweralarm-demo.cpp
@@ -6,12 +6,16 @@
 #include <dlfcn.h>

 #include <stdint.h>

 

+

+#define INIT_SUCCESS    0

+

 typedef struct

 {

     int  cmdIdx;

     char *funcName;

 } st_api_test_case;

-    

+

+

 //for server test

 st_api_test_case at_api_testcases[] = 

 {

@@ -26,7 +30,10 @@
     {-1,    NULL}

 };

 

-int src_id = -1;

+ int init_flag = -1;

+ int src_id = -1;

+ void *dlHandle_poweralarm = NULL;

+ 

 typedef int (*lynq_wakealarm_add_cb)(unsigned int src_id, int rtc_id);

 

 int (*lynq_rtc_service_init)(void);

@@ -37,7 +44,6 @@
 int (*lynq_set_poweralarm)(unsigned long time_sec,int src_id);

 int (*lynq_set_wakealarm)(unsigned long time_sec,int srcid,int rtc_id,lynq_wakealarm_add_cb wakealarm_notify);

 

-void *dlHandle_poweralarm = NULL;

 

 

 void print_help(void)

@@ -125,6 +131,7 @@
     print_help();

     while(1)

     {

+        

         printf("\nplease input cmd index(-1 exit): ");

         scanf("%d", &cmdIdx);

         if(cmdIdx == -1)

@@ -139,92 +146,145 @@
             case 1:

                 {

                     src_id = lynq_rtc_service_init();

+                    if(src_id <= 0)

+                    {

+

+                        printf("RTC service init failed ");

+                        return -1;

+                    }

+                    else

+                    {

+                        init_flag = INIT_SUCCESS;

+                    }

+                    

                     break;

                 }

             case 2:

                 {

-                    int ret = 0;

-                    char tmp_time[32] = {0};

-                    printf("Set poweralarm time,e.g: 60 (seconds)\n");

-                    scanf("%s",tmp_time);

-                    ret = poweralarm(tmp_time,src_id);

-                    if(ret != 0)

+                    

+                    if(init_flag != INIT_SUCCESS)

                     {

-                        printf("set poweralarm failed\n");

-                        return -1;

+                        printf("*****ERROR must init rtc service ,Please reselect *******\n ");

+                    }

+                    else

+                    {

+                        int ret = 0;

+                        char tmp_time[32] = {0};

+                        printf("Set poweralarm time,e.g: 60 (seconds)\n");

+                        scanf("%s",tmp_time);

+                        ret = poweralarm(tmp_time,src_id);

+                        if(ret != 0)

+                        {

+                            printf("set poweralarm failed\n");

+                            return -1;

+                        }

                     }

                 break;

                 }

             case 3:

                 {

-                    int ret = 0;

-                    char tmp_time[32]={0};

-                    int rtc_id = 0;

-                    printf("Set wakealarm time ,e.g: 60  1 (seconds)\n");

-                    scanf("%s%d",tmp_time,&rtc_id);

-                   

-                    ret = wakealarm(tmp_time,src_id,rtc_id,lynq_wakealarm_add_callback);

-                    if(ret != 0)

+                    if(init_flag != INIT_SUCCESS)

                     {

-                        printf("set wakealarm failed\n");

-                        return -1;

+                        printf("*****ERROR must init rtc service ,Please reselect *******\n ");

+                    }

+                    else

+                    {

+                        int ret = 0;

+                        char tmp_time[32]={0};

+                        int rtc_id = 0;

+                        printf("Set wakealarm time ,e.g: 60  1 (seconds)\n");

+                        scanf("%s%d",tmp_time,&rtc_id);

+                   

+                        ret = wakealarm(tmp_time,src_id,rtc_id,lynq_wakealarm_add_callback);

+                        if(ret != 0)

+                        {

+                            printf("set wakealarm failed\n");

+                            return -1;

+                        }

                     }

                     break;

                 }

              case 4:

                 {

-                    int ret = 0;

-                    int rtc_id = 0;

-                    printf("Please input you want cancel rtc timer rtc id\n");

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

-                    ret = cancel_wakealarm(src_id,rtc_id);

-                    if(ret != 0)

+                    if(init_flag != INIT_SUCCESS)

                     {

-                        printf("Cancel_wakealarm failed!!!");

-                        return -1;

+                        printf("*****ERROR must init rtc service ,Please reselect *******\n ");

+                    }

+                    else

+                    {

+                        int ret = 0;

+                        int rtc_id = 0;

+                        printf("Please input you want cancel rtc timer rtc id\n");

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

+                        ret = cancel_wakealarm(src_id,rtc_id);

+                        if(ret != 0)

+                        {

+                            printf("Cancel_wakealarm failed!!!");

+                            return -1;

+                        }

                     }

                     break;

                 }

              case 5:

                 { 

-                   int ret = 0; 

-                   unsigned long time_sec = 0;

-                   printf("Input time_sec you want poweralarm,e.g: 60 (seconds)\n");

-                   scanf("%lu",&time_sec);

-                   ret =lynq_set_poweralarm(time_sec,src_id);

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

-                   if(ret != 0)

-                   {

-                        printf("lynq_set_poweralarm failed\n");

-                        return -1;

-                   }

+                    if(init_flag != INIT_SUCCESS)

+                    {

+                        printf("*****ERROR must init rtc service ,Please reselect *******\n ");

+                    }

+                    else

+                    {

+                        int ret = 0; 

+                        unsigned long time_sec = 0;

+                        printf("Input time_sec you want poweralarm,e.g: 60 (seconds)\n");

+                        scanf("%lu",&time_sec);

+                        ret =lynq_set_poweralarm(time_sec,src_id);

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

+                        if(ret != 0)

+                        {

+                            printf("lynq_set_poweralarm failed\n");

+                            return -1;

+                        }

+                    }

                    break;

                 }

             case 6:

-                 { 

-                   int ret = 0; 

-                   unsigned long time_sec = 0;

-                   int rtc_id;

-                   printf("Input time_sec you want wakealarm,e.g:60  1(seconds)\n");

-                   scanf("%lu%d",&time_sec,&rtc_id);

-                   ret =lynq_set_wakealarm(time_sec,src_id,rtc_id,lynq_wakealarm_add_callback);

-                   if(ret != 0)

-                   {

-                        printf("lynq_set_wakealarm failed\n");

-                        return -1;

+                { 

+                    if(init_flag != INIT_SUCCESS)

+                    {

+                        printf("*****ERROR must init rtc service ,Please reselect *******\n ");

                    }

+                   else

+                   {

+                        int ret = 0; 

+                        unsigned long time_sec = 0;

+                        int rtc_id;

+                        printf("Input time_sec you want wakealarm,e.g:60  1(seconds)\n");

+                        scanf("%lu%d",&time_sec,&rtc_id);

+                        ret =lynq_set_wakealarm(time_sec,src_id,rtc_id,lynq_wakealarm_add_callback);

+                        if(ret != 0)

+                        {

+                            printf("lynq_set_wakealarm failed\n");

+                            return -1;

+                        }

+                    }

                    break;

                 }

             case 7:

                 {

-                    int ret  = -1;

-                    printf("rtc servce deinit !!!!!!!!!!!!");

-                    ret = lynq_rtc_service_deinit();

-                    if(ret != 0)

+                    if(init_flag != INIT_SUCCESS)

                     {

-                        printf("lynq rtc service deinit failed \n");

-                        return -1;

-

+                        printf("*****ERROR must init rtc service ,Please reselect *******\n ");

+                    }

+                    else

+                    {

+                        int ret  = -1;

+                        printf("rtc servce deinit !!!!!!!!!!!!");

+                        ret = lynq_rtc_service_deinit();

+                        if(ret != 0)

+                        {

+                            printf("lynq rtc service deinit failed \n");

+                            return -1;

+                        }

                     }

                     break;

                 }

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h
index 75bfd03..33b3504 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h
@@ -63,10 +63,8 @@
 	qser_data_call_ip_family_e ip_family;             /*!< IP version. */
 	qser_data_call_state_e state;                     /*!< The dial status. */
 	qser_data_call_error_e err;                       /*!< The Reason code after data call disconnected. */
-	union {
-		struct v4_address_status v4;            /*!< IPv4 information. */
-		struct v6_address_status v6;            /*!< IPv6 information. */
-	};
+	struct v4_address_status v4;            /*!< IPv4 information. */
+	struct v6_address_status v6;            /*!< IPv6 information. */
 } qser_data_call_state_s;
 
 /*
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index 489bf64..395cf95 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -129,6 +129,11 @@
     const char addresses_separator[2] = "/";
     const char dnses_separator[2] = " ";
 
+    char buf_ip[64] = {0};
+    char buf_gateway[64] = {0};
+    char buf_pri_dns[64] = {0};
+    char buf_sec_dns[64] = {0};
+
     addresses = libdata->addresses;
     dnses = libdata->dnses;
     //get addresses
@@ -170,8 +175,19 @@
         inet_pton(AF_INET6, tmp_char, &(data_res->v6.sec_dns));
     }
     //get gateway
+    inet_aton(libdata->gateways,&(data_res->v4.gateway));
     inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.gateway));
 
+    LYINFLOG("v4.ip=%s", inet_ntoa(data_res->v4.ip));
+    LYINFLOG("v4.pri_dns=%s", inet_ntoa(data_res->v4.pri_dns));
+    LYINFLOG("v4.sec_dns=%s", inet_ntoa(data_res->v4.sec_dns));
+
+    inet_ntop(AF_INET6, &(data_res->v6.ip), buf_ip, sizeof(buf_ip));
+    inet_ntop(AF_INET6, &(data_res->v6.gateway), buf_gateway, sizeof(buf_gateway));
+    inet_ntop(AF_INET6, &(data_res->v6.pri_dns), buf_pri_dns, sizeof(buf_pri_dns));
+    inet_ntop(AF_INET6, &(data_res->v6.sec_dns), buf_sec_dns, sizeof(buf_sec_dns));
+    LYINFLOG("v6.ip=%s, v6.gateway=%s, v6.pri_dns=%s, v6.sec_dns=%s\n"
+        , buf_ip, buf_gateway, buf_pri_dns, buf_sec_dns);
     return ;
 }
 
@@ -328,9 +344,11 @@
         inet_pton(AF_INET6, tmp_char, &(data_res->v6.addr.sec_dns));
     }
     //get gateway
+    inet_aton(libdata->gateways,&(data_res->v4.addr.gateway));
     inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.addr.gateway));
 
     LYINFLOG("v4.ip=%s", inet_ntoa(data_res->v4.addr.ip));
+    LYINFLOG("ipv4 gateways = %s", inet_ntoa(data_res->v4.addr.gateway));
     LYINFLOG("v4.pri_dns=%s", inet_ntoa(data_res->v4.addr.pri_dns));
     LYINFLOG("v4.sec_dns=%s", inet_ntoa(data_res->v4.addr.sec_dns));
 
@@ -386,11 +404,210 @@
     return ;
 }
 
+int apn_xml_handle_get_profile(int handle, unsigned char *profile_idx)
+{
+    //xmlDocPtr apn_table_xml_pdoc = NULL;
+    xmlNodePtr node = NULL;
+    xmlNodePtr modify_node = NULL;
+    unsigned char temp = NULL;
+    //apn_table_xml_pdoc = xmlReadFile(data_xml_path ,"UTF-8",XML_PARSE_RECOVER);
+    if(NULL == apn_table_xml_pdoc)
+    {
+        LYERRLOG("open xml file error");
+        goto FAILED;
+    }
+    
+    node = xmlDocGetRootElement(apn_table_xml_pdoc);
+    if (NULL == node)
+    {
+        LYERRLOG("xmlDocGetRootElement() error");
+        goto FAILED;
+    }
+    modify_node = node->xmlChildrenNode;
+    if(modify_node != NULL)
+    {
+        modify_node = modify_node->next;
+    }
+    else
+    {
+        LYERRLOG("modify_node is null\n");
+        goto FAILED;
+    }
+    for (;;)
+    {
+        if(modify_node == NULL)
+        {
+            LYERRLOG("modify_node is null\n");
+            goto FAILED;
+        }
+        if (xmlGetProp(modify_node, "handle") == NULL)  //Null Node
+        {
+            modify_node = modify_node->next;
+            continue;
+        }
+        else if((int)atoi(xmlGetProp(modify_node, "handle")) == handle)
+        {
+            break;
+        }
+        modify_node = modify_node->next;
+    }
+    if(modify_node == NULL)
+    {
+        LYERRLOG("modify_node is null\n");
+        goto FAILED;
+    }
+    *profile_idx = (unsigned char)atoi(xmlGetProp(modify_node, "profile_idx"));
+    //xmlFreeDoc(apn_table_xml_pdoc);
+    return RESULT_OK;
+
+    FAILED:
+    // if (apn_table_xml_pdoc)
+    // {
+    //     xmlFreeDoc(apn_table_xml_pdoc);
+    // }
+    return RESULT_ERROR;
+}
+int apn_xml_handle_set(unsigned char profile_idx, int handle)
+{
+    int node_num = 0;
+    char temp_buff[12];
+    //xmlDocPtr apn_table_xml_pdoc = NULL;
+    xmlNodePtr node = NULL;
+    xmlNodePtr modify_node = NULL;
+    xmlNodePtr check_node = NULL;
+    //apn_table_xml_pdoc = xmlReadFile(data_xml_path ,"UTF-8",XML_PARSE_RECOVER);
+    if(NULL == apn_table_xml_pdoc)
+    {
+        LYERRLOG("open xml file error");
+        goto FAILED;
+    }
+    node = xmlDocGetRootElement(apn_table_xml_pdoc);
+    if (NULL == node)
+    {
+        LYERRLOG("xmlDocGetRootElement() error");
+        goto FAILED;
+    }
+    modify_node = node->xmlChildrenNode;
+    if(modify_node != NULL)
+    {
+        modify_node = modify_node->next;
+    }
+    else
+    {
+        LYERRLOG("modify_node is null\n");
+        goto FAILED;
+    }
+    for (;;)
+    {
+        if(modify_node == NULL)
+        {
+            LYERRLOG("modify_node is null\n");
+            goto FAILED;
+        }
+        if (xmlGetProp(modify_node, "profile_idx") == NULL)  //Null Node
+        {
+            modify_node = modify_node->next;
+            node_num--;
+            continue;
+        }
+        else if((int)atoi(xmlGetProp(modify_node, "profile_idx")) == (int)profile_idx)
+        {
+            break;
+        }
+        modify_node = modify_node->next;
+    }
+    if(modify_node == NULL)
+    {
+        LYERRLOG("modify_node is null\n");
+        goto FAILED;
+    }
+    bzero(temp_buff,12);
+    snprintf(temp_buff,sizeof(temp_buff),"%d",handle);
+    xmlSetProp(modify_node,BAD_CAST"handle",(xmlChar *)temp_buff);
+    xmlSaveFormatFileEnc(data_xml_path, apn_table_xml_pdoc, "UTF-8", 1);
+    //xmlFreeDoc(apn_table_xml_pdoc);
+    return RESULT_OK;
+
+    FAILED:
+    // if (apn_table_xml_pdoc)
+    // {
+    //     xmlFreeDoc(apn_table_xml_pdoc);
+    // }
+    return RESULT_ERROR;
+}
+int apn_xml_handle_get(unsigned char profile_idx, int *handle)
+{
+    int node_num = 0;
+    //xmlDocPtr apn_table_xml_pdoc = NULL;
+    xmlNodePtr node = NULL;
+    xmlNodePtr modify_node = NULL;
+    unsigned char temp = NULL;
+    //apn_table_xml_pdoc = xmlReadFile(data_xml_path ,"UTF-8",XML_PARSE_RECOVER);
+    if(NULL == apn_table_xml_pdoc)
+    {
+        LYERRLOG("open xml file error");
+        goto FAILED;
+    }
+    
+    node = xmlDocGetRootElement(apn_table_xml_pdoc);
+    if (NULL == node)
+    {
+        LYERRLOG("xmlDocGetRootElement() error");
+        goto FAILED;
+    }
+    modify_node = node->xmlChildrenNode;
+    if(modify_node != NULL)
+    {
+        modify_node = modify_node->next;
+    }
+    else
+    {
+        LYERRLOG("modify_node is null\n");
+        goto FAILED;
+    }
+    LYINFLOG("profile_idx is %d\n", (int)profile_idx);
+    for (;;)
+    {
+        if(modify_node == NULL)
+        {
+            LYERRLOG("modify_node is null\n");
+            goto FAILED;
+        }
+        if (xmlGetProp(modify_node, "profile_idx") == NULL)  //Null Node
+        {
+            modify_node = modify_node->next;
+            node_num--;
+            continue;
+        }
+        else if((int)atoi(xmlGetProp(modify_node, "profile_idx")) == (int)profile_idx)
+        {
+            break;
+        }
+        modify_node = modify_node->next;
+    }
+    if(modify_node == NULL)
+    {
+        LYERRLOG("modify_node is null\n");
+        goto FAILED;
+    }
+    *handle = (int)atoi(xmlGetProp(modify_node, "handle"));
+    xmlSaveFormatFileEnc(data_xml_path, apn_table_xml_pdoc, "UTF-8", 1);
+    //xmlFreeDoc(apn_table_xml_pdoc);
+    return RESULT_OK;
+
+    FAILED:
+    // if (apn_table_xml_pdoc)
+    // {
+    //     xmlFreeDoc(apn_table_xml_pdoc);
+    // }
+    return RESULT_ERROR;
+}
 
 int apn_xml_add(qser_apn_add_s *apn,unsigned char *apn_num)
 {
     int node_num = 0;
     char temp_buff[12];
+    int default_handle = LYNQ_APN_CHANNEL_MAX + 1;
     //xmlDocPtr apn_table_xml_pdoc = NULL;
     xmlNodePtr node = NULL;
     xmlNodePtr tmp_node = NULL;
@@ -447,6 +664,9 @@
     xmlNewProp(tmp_node,BAD_CAST"username",(xmlChar *)apn->username);
     xmlNewProp(tmp_node,BAD_CAST"password",(xmlChar *)apn->password);
     xmlNewProp(tmp_node,BAD_CAST"apn_type",(xmlChar *)apn->apn_type);
+    bzero(temp_buff,12);
+    snprintf(temp_buff,sizeof(temp_buff),"%d",default_handle);
+    xmlNewProp(tmp_node,BAD_CAST"handle",(xmlChar *)temp_buff);
     xmlAddChild(node,tmp_node);
     xmlSaveFormatFileEnc(data_xml_path, apn_table_xml_pdoc, "UTF-8", 1);
    
@@ -549,6 +769,7 @@
     //xmlDocPtr apn_table_xml_pdoc = NULL;
     xmlNodePtr node = NULL;
     xmlNodePtr modify_node = NULL;
+    xmlNodePtr check_node = NULL;
 //    apn_table_xml_pdoc = xmlReadFile(data_xml_path ,"UTF-8",XML_PARSE_RECOVER);
     if(NULL == apn_table_xml_pdoc)
     {
@@ -572,6 +793,23 @@
         LYERRLOG("modify_node is null\n");
         goto FAILED;
     }
+    //check apn_type
+    check_node = modify_node;
+    while (check_node != NULL)
+    {
+        if (xmlGetProp(check_node, "profile_idx") == NULL)  //Null Node
+        {
+            check_node = check_node->next;
+            continue;
+        }
+        else if(strcmp((char *)xmlGetProp(check_node, "apn_type"), apn->apn_type) == 0)
+        {
+            LYERRLOG("apntype already exists\n");
+            goto FAILED;
+        }
+        check_node = check_node->next;
+    }
+    //check apn_type end
     for (node_num=0; node_num<(int)apn->profile_idx;node_num++)
     {
         if(modify_node == NULL)
@@ -857,6 +1095,7 @@
 {
     int handle = -1;
     int ret = 0;
+    int default_handle = LYNQ_APN_CHANNEL_MAX + 1;
     lynq_data_call_response_v11_t data_urc_info = {0};
     qser_data_call_state_s data_cb_state;
     while (s_qser_data_cb_thread_status)
@@ -876,7 +1115,8 @@
         memset(&data_cb_state, 0, sizeof(data_cb_state));
         lynq_get_data_call_list(&handle,&data_urc_info);
         /*compare paramter*/
-        data_cb_state.profile_idx = (char)handle;
+        //data_cb_state.profile_idx = (char)handle;
+        apn_xml_handle_get_profile(handle, &data_cb_state.profile_idx);
         LYINFLOG("[thread_wait_cb_status]: status=%d, suggestedRetryTime=%d, cid=%d, active=%d, type=%s, ifname=%s, addresses=%s, dnses=%s, gateways=%s, pcscf=%s, mtu=%d\n",
         data_urc_info.status, data_urc_info.suggestedRetryTime, data_urc_info.cid, data_urc_info.active, 
         data_urc_info.type, data_urc_info.ifname, data_urc_info.addresses, data_urc_info.dnses, data_urc_info.gateways, data_urc_info.pcscf, 
@@ -906,6 +1146,11 @@
         else
         {
             data_cb_state.state = QSER_DATA_CALL_DISCONNECTED;
+            ret = apn_xml_handle_set(data_cb_state.profile_idx, default_handle);
+            if(ret != 0)
+            {
+                LYERRLOG("handle set error");
+            }
         }
         if (data_cb_state.ip_family == QSER_DATA_CALL_TYPE_IPV4)
         {
@@ -1031,6 +1276,7 @@
 int qser_data_call_start(qser_data_call_s *data_call, qser_data_call_error_e *err)
 {
     int ret = -1;
+    int error = -1;
     int handle = 0;
     if(g_lynq_qser_data_init_flag == 0)
     {
@@ -1071,12 +1317,21 @@
     {
         *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
     }
+    else
+    {
+        error = apn_xml_handle_set(data_call->profile_idx, handle);
+        if(error != 0)
+        {
+            LYERRLOG("handle set error");
+        }
+    }
     return ret;
 }
 
 int qser_data_call_start_async(qser_data_call_s *data_call, qser_data_call_error_e *err)
 {
     int ret = -1;
+    int error = -1;
     int handle = 0;
     if(g_lynq_qser_data_init_flag == 0)
     {
@@ -1117,6 +1372,14 @@
     {
         *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
     }
+    else
+    {
+        error = apn_xml_handle_set(data_call->profile_idx, handle);
+        if(error != 0)
+        {
+            LYERRLOG("handle set error");
+        }
+    }
     return ret;
 }
 
@@ -1214,15 +1477,26 @@
 int qser_apn_set(qser_apn_info_s *apn)
 {
     int ret = 0;
+    int handle = -1;
     if(g_lynq_qser_data_init_flag == 0)
     {
         return LYNQ_E_NO_INIT;
     }
-    if (NULL == apn)
+    if (NULL == apn || apn->profile_idx == 0)
     {
         LYERRLOG("apn set incoming paramters error");
         return RESULT_ERROR;
     }
+    ret = apn_xml_handle_get(apn->profile_idx, &handle);
+    if(ret != 0)
+    {
+        LYERRLOG("handle set error");
+    }
+    if(handle >= 0 && handle < LYNQ_APN_CHANNEL_MAX)
+    {
+        LYERRLOG("It has setup datacall");
+        return RESULT_ERROR;
+    }
     ret = apn_xml_modify(apn);
     if (ret < 0)
     {
@@ -1315,12 +1589,23 @@
     {
         return LYNQ_E_NO_INIT;
     }
-    if (profile_idx < 0 || profile_idx > 24)
+    if (profile_idx <= 0 || profile_idx > QSER_APN_MAX_LIST)
     {
         LYERRLOG("apn del incoming paramters error");
-        return RESULT_OK;
+        return RESULT_ERROR;
     }
     int ret = 0;
+    int handle = -1;
+    ret = apn_xml_handle_get(profile_idx, &handle);
+    if(ret != 0)
+    {
+        LYERRLOG("handle set error");
+    }
+    if(handle >= 0 && handle < LYNQ_APN_CHANNEL_MAX)
+    {
+        LYERRLOG("It has setup datacall");
+        return RESULT_ERROR;
+    }
     ret = apn_xml_delete(profile_idx);
     if (ret < 0)
     {
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml
index c9c8304..d881dc0 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml
@@ -1,3 +1,3 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <lynq_qser_data_apn>
-  <apn profile_idx="0" pdp_type="3" auth_proto="0" apn_name="default" username="NULL" password="NULL" apn_type="default"/></lynq_qser_data_apn>
+  <apn profile_idx="0" pdp_type="3" auth_proto="0" apn_name="default" username="NULL" password="NULL" apn_type="default" handle="11"/></lynq_qser_data_apn>
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
index 4225625..5e12c84 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
@@ -210,9 +210,12 @@
     {
         pt_info->e_card_state = 0xB03;
     }
-    else
+    else if(0 == sim_status)
     {
     
+        pt_info->e_card_state = 0xB02;
+    }
+    else{
         pt_info->e_card_state = 0xB01;
     }
     LYINFLOG("[%s-%d] QSER_CARD_STATUS: 0x%x\n", __FUNCTION__, __LINE__, pt_info->e_card_state);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
index aa69974..75a1d0b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
@@ -457,6 +457,10 @@
     }
     if(puk == NULL || pin == NULL)
         return -1;
+
+    if(strlen(puk) < 4 || strlen(pin) < 4){
+        return -1;
+    }
     Parcel p;
     int res = lynq_send_common_request(&p,RIL_REQUEST_ENTER_SIM_PUK,2,1,"%s %s\n", puk, pin);
     if(res != 0)
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
index 6d46661..569b224 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
@@ -32,5 +32,5 @@
         option status '0'

         

 config  lynq_led_rw  'lynq_led'

-        option lynq_statusled_on '1'

-        option lynq_netled_on '1'
\ No newline at end of file
+        option lynq_statusled_on '0'

+        option lynq_netled_on '0'
\ No newline at end of file
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c
index ed602a0..451abfd 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/nv-rpc-daemon/main.c
@@ -68,7 +68,7 @@
  *******************************************************************************/
 static long g_pid;
 static long g_ap_pid_backup;
-static int  nv_debug_switch = false;
+static int  nv_debug_switch = true;//jb.qi add for nv wakeup debug on 20231220
 
 /*******************************************************************************
  *                                ¾Ö²¿º¯ÊýʵÏÖ                                  *
@@ -171,7 +171,7 @@
     msgSnd.msgType = MSG_TYPE_NV;
     msgSnd.pid     = g_pid;
     //printf("apnv_cap msgsnd to nvserver pid:%d\n", msgSnd.pid);
-    if (strcmp(msgSnd.key, "zcat_mode"))
+    //if (strcmp(msgSnd.key, "zcat_mode")) jb.qi add for nv wakeup debug on 20231220
         print_nv_info(&msgSnd);
 
 retry1:
diff --git a/update_version.sh b/update_version.sh
index 76d5e72..0882ff2 100755
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 #export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P52U02.AP.09.08"
-LYNQ_CAP_INSIDE_VERSION="CAP.09.08"
-LYNQ_CAP_VERSION="CAP.09.08"
+LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P52U02.AP.09.10"
+LYNQ_CAP_INSIDE_VERSION="CAP.09.10"
+LYNQ_CAP_VERSION="CAP.09.10"
 COMMIT_ID="$(git rev-parse HEAD)"
 
 LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""