[Bugfix][ZXW-302]CPU usage optimization-ZXW patch

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I16b0c06f18879544f3550d1b056c76186790f0f3
diff --git a/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c b/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c
index d2479c9..24ec133 100755
--- a/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c
+++ b/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c
@@ -5445,7 +5445,7 @@
     {

         snprintf(convertDataStr + strlen(convertDataStr), AT_USSD_DATA_TO_WEB_LEN, "%04x", dataStr[iDataLen]);

     }

-    printf("%s\n", convertDataStr);

+    at_print(AT_DEBUG,"%s\n",convertDataStr);

 }

 

 VOID atBase_Convert8BitToUCS2(const CHAR *dataStr, CHAR *convertDataStr, UINT16 dataLen)

@@ -5467,7 +5467,7 @@
             snprintf(convertDataStr + strlen(convertDataStr), AT_USSD_DATA_TO_WEB_LEN, "%c", dataStr[iDataLen]);

         }

     }

-    printf("%s\n", convertDataStr);

+     at_print(AT_DEBUG,"%s\n",convertDataStr);

 }

 

 

@@ -5497,7 +5497,7 @@
     }

     else

     {

-        printf("DCS Reported can't be processed!!!!\n");

+        at_print(AT_DEBUG,"DCS Reported can't be processed!!!!\n");

         return FALSE;

     }

 }

diff --git a/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c b/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c
index 078e8d0..9c6122b 100755
--- a/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c
+++ b/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c
@@ -3402,7 +3402,7 @@
 	at_print(AT_DEBUG,"@@@@@@@@@@@@@start_pdp_auto_dial g_pdp_set_info=0x%p, auto_connect is %s!\n",g_defcid_mng.set_info, auto_reconnect);

 	if((0 == check_is_fd(g_defcid_mng.modid)) && 0 == strcmp(auto_reconnect,"1"))

 	{

-		at_print(AT_DEBUG,"@@@@@@@@@@@@@start_pdp_auto_dial: apn is %s, modid is %x!\n", g_defcid_mng.set_info->comm_info.apn, g_defcid_mng.modid);

+		//at_print(AT_DEBUG,"@@@@@@@@@@@@@start_pdp_auto_dial: apn is %s, modid is %x!\n", g_defcid_mng.set_info->comm_info.apn, g_defcid_mng.modid);

 		//ÊÕµ½×¤Íø³É¹¦ºó£¬ÉèÖÃÒ»¸ö5s¶¨Ê±Æ÷£¬³¬Ê±ºó½øÐÐpdp²¦ºÅÇëÇó

 		if(0 == strcmp(reconnect_type,"simple"))

 		{

diff --git a/ap/app/zte_comm/at_ctl/src/atctrl/at_context.c b/ap/app/zte_comm/at_ctl/src/atctrl/at_context.c
index 12f4dad..8fc69b2 100755
--- a/ap/app/zte_comm/at_ctl/src/atctrl/at_context.c
+++ b/ap/app/zte_comm/at_ctl/src/atctrl/at_context.c
@@ -1559,7 +1559,7 @@
 {

 	MSG_BUF stMsg = {0};

 

-	at_print(AT_ERR,"Enter resend_rcv_atstr, fd:%d str:%s!!!\n", at_fd, at_str);

+	at_print(AT_DEBUG,"Enter resend_rcv_atstr, fd:%d str:%s!!!\n", at_fd, at_str);

 

 	if(at_fd >= MODULE_ID_ATCTL_TO_VOLTE && at_fd < MODULE_ID_ATCTL_TO_VOLTE+VOLTE_PTY1_MAX)

 	{

@@ -1629,7 +1629,7 @@
     MSG_BUF stMsg = {0};

 	at_msg.at_fd = at_fd;

 

-	at_print(AT_ERR,"Enter delay_resend_atstr, at_str:%s!!!\n", at_str);

+	at_print(AT_DEBUG,"Enter delay_resend_atstr, at_str:%s!!!\n", at_str);

 

 	//zdm ÕâÀïÊÇÓÉÓÚatÃüÁî½âÎöÍê³Éºó£¬ÒѾ­½«\r\nÈ¥³ý£¬Èç¹ûatͨµÀ²»×ãʱ£¬ÐèÒª½«atÃüÁî

 	//ÖØÐµ±×ö´ÓatͨµÀ¶ÁÈ¡µ½µÄatÃüÁî·¢¸øÖ÷Ï̴߳¦Àí£¬Òò´ËÐèÒª½«\r\nÖØÐÂÌí¼ÓÉÏ

diff --git a/ap/app/zte_comm/at_ctl/src/atctrl/at_portmng.c b/ap/app/zte_comm/at_ctl/src/atctrl/at_portmng.c
index 9049199..6074897 100755
--- a/ap/app/zte_comm/at_ctl/src/atctrl/at_portmng.c
+++ b/ap/app/zte_comm/at_ctl/src/atctrl/at_portmng.c
@@ -118,6 +118,12 @@
 		if(FD_FAR_PS[ilde_idx] >= 0)

 		{

 			node = add_new_channel(FD_FAR_PS[ilde_idx],FAR_PS);

+			if(0 == at_strncmp(name, "/dev/rpmsg35", strlen(name)) ||

+				0 == at_strncmp(name, "/dev/rpmsg37", strlen(name)) ||

+				0 == at_strncmp(name, "/dev/rpmsg38", strlen(name)) ||

+				0 == at_strncmp(name, "/dev/rpmsg39", strlen(name))) {

+				node->attribution |= 1<<CH_AUTOIND;

+			}

 			//if(node != NULL &&(strstr(name, "/dev/ttyGS0") != NULL || strstr(name, "/dev/ttyGS1") != NULL))

 				node->reserved = 0;//×÷ΪԤÁôͨµÀ£¬ÔÚÇëÇóÃüÁîÑ¡Ôñfarpsʱºò£¬»áÑ¡Ôñ·¢ËÍ

 			memcpy(g_farps_port_info[ilde_idx].name,name,strlen(name));

diff --git a/ap/app/zte_comm/at_ctl/src/atctrl/at_rcvmsg.c b/ap/app/zte_comm/at_ctl/src/atctrl/at_rcvmsg.c
index c5b86ed..48f1f32 100755
--- a/ap/app/zte_comm/at_ctl/src/atctrl/at_rcvmsg.c
+++ b/ap/app/zte_comm/at_ctl/src/atctrl/at_rcvmsg.c
@@ -726,7 +726,7 @@
     int msgtype = get_msgtype(at_str);

     int ret = AT_END;

 

-	at_print(AT_ERR, "rcvmsg_rsp_at_fwd_down context->prefix = %s \n" ,context->at_cmd_prefix);

+	at_print(AT_DEBUG, "rcvmsg_rsp_at_fwd_down context->prefix = %s \n" ,context->at_cmd_prefix);

     /* ¶ÔÓÚת·¢ÏÂÓÎÊÕµ½µÄÓ¦´ð´¦Àí,Ö»ÓÐPDP¼¤»îµÄת·¢ÐèÒª¼à¿Ø£¬Ò»°ãµÄATÃüÁîת·¢ÎÞÐè¼à¿Ø,Ö±½Óת·¢Í¸´«¸øÉÏÓÎλÖÃ*/

     if(context->at_proc != NULL)

     {

@@ -769,7 +769,7 @@
     int    res_msglen = 0;

     struct app_clt_ops_t *clt_nod = NULL;

 

-    at_print(AT_ERR, "rcvmsg_rsp_at_client context->prefix = %s \n" ,context->at_cmd_prefix);

+    at_print(AT_DEBUG, "rcvmsg_rsp_at_client context->prefix = %s \n" ,context->at_cmd_prefix);

 

 	//оƬÈÏÖ¤ÅжϷÖÖ§

 	if(atcmd_stream_rep_proc(context, at_str))

@@ -917,10 +917,10 @@
 			}

 			if(ismatch){

 				set_fwd_fd(BROADCAST_FWD);				

-				at_print(AT_ERR,"[XXX]set_fwd_fd  111\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd  111\n");

 			}else{

 				set_fwd_fd(BROADCAST_VOLTE);

-				at_print(AT_ERR,"[XXX]set_fwd_fd  222\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd  222\n");

 			}

 		}

 		else if(strlen(FwIndAtCmdPrefix) != 0)

@@ -928,18 +928,18 @@
 			if(at_strstr(FwIndAtCmdPrefix, temp_prefix))

 			{

 				set_fwd_fd(BROADCAST_FWD);	

-				at_print(AT_ERR,"[XXX]set_fwd_fd  333\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd  333\n");

 			}

 			else

 			{

 				set_fwd_fd(BROADCAST_VOLTE);	

-				at_print(AT_ERR,"[XXX]set_fwd_fd  444\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd  444\n");

 			}

 		}

 		else

 		{

 			set_fwd_fd(BROADCAST_FWD);	

-			at_print(AT_ERR,"[XXX]set_fwd_fd  555\n");

+			at_print(AT_DEBUG,"[XXX]set_fwd_fd  555\n");

 		}

 	}	

 	/* ½«VOLTEµÄÖ÷¶¯Éϱ¨·¢Ë͸øFAR_PS*/

@@ -970,10 +970,10 @@
 			}

 			if(ismatch){

 				set_fwd_fd(BROADCAST_FARPS);	

-				at_print(AT_ERR,"[XXX]set_fwd_fd  666\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd  666\n");

 			}else{

 				set_fwd_fd(0);	

-				at_print(AT_ERR,"[XXX]set_fwd_fd  777\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd  777\n");

 			}

 		}

 		else if(strlen(FwIndAtCmdPrefix) != 0)

@@ -981,25 +981,25 @@
 			if(at_strstr(FwIndAtCmdPrefix, temp_prefix))

 			{

 				set_fwd_fd(BROADCAST_FARPS);	

-				at_print(AT_ERR,"[XXX]set_fwd_fd 888\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd 888\n");

 			}

 			else

 			{

 				set_fwd_fd(0);	

-				at_print(AT_ERR,"[XXX]set_fwd_fd  999\n");

+				at_print(AT_DEBUG,"[XXX]set_fwd_fd  999\n");

 			}

 		}		

 		else

 		{

 			set_fwd_fd(BROADCAST_FARPS);	

-			at_print(AT_ERR,"[XXX]set_fwd_fd  AAA\n");

+			at_print(AT_DEBUG,"[XXX]set_fwd_fd  AAA\n");

 		}		

 	}

 	//fd²»ÊÇÕæÊµµÄͨµÀ£¨½«ÏûÏ¢Ô´×÷Ϊfd£©ÉÏÊÕµ½µÄÖ÷¶¯Éϱ¨²»²ÎÓë¹ýÂË

 	else if(check_is_fd(at_fd) == 0 && position == NEAR_PS)

 	{

 		set_fwd_fd(BROADCAST_FARPS);	

-		at_print(AT_ERR,"[XXX]set_fwd_fd  BBB\n");

+		at_print(AT_DEBUG,"[XXX]set_fwd_fd  BBB\n");

 	}

 

 }

@@ -1020,7 +1020,7 @@
         if( (prefix_len >0 && at_cmd_prefix != NULL && 0 == at_strncmp(context->at_cmd_prefix,(char*)at_cmd_prefix, prefix_len))

                 || (prefix_len >0 && at_cmd_prefix != NULL && 0==strncmp("> ",at_cmd_prefix, prefix_len)))

         {

-        	at_print(AT_ERR,"receive client inform str = %s, fd = %d\n", at_str, at_fd);

+        	at_print(AT_ERR,"receive client inform str = %s, fd = %d\n", get_small_str(at_str), at_fd);

         	//оƬÈÏÖ¤ÅжϷÖÖ§

 			if(atcmd_stream_inform_proc(context, at_str))

 				return 0;			

@@ -1052,7 +1052,7 @@
         if( (prefix_len >0 && at_cmd_prefix != NULL && 0 == at_strncmp(fwd_context->at_cmd_prefix, (char*)at_cmd_prefix, prefix_len))

                 ||(prefix_len >0 && at_cmd_prefix != NULL && 0==strncmp("> ",at_cmd_prefix, prefix_len)) )

         {

-        	at_print(AT_ERR,"receive fwd_down inform str = %s, fd = %d\n", at_str, at_fd);

+			at_print(AT_ERR,"receive fwd_down inform str = %s, fd = %d\n", get_small_str(at_str), at_fd);

 			set_fwd_fd(fwd_context->fwd_context->at_channel->at_fd);

 			if(strstr(at_str,"> ") != NULL)

 			{

@@ -1066,7 +1066,7 @@
     /* Ò»°ãÖ÷¶¯Éϱ¨£¬½ö´¦Àíg_auto_fdͨµÀµÄÖ÷¶¯Éϱ¨ºÍVOLTEµÄÖ÷¶¯Éϱ¨£¬g_auto_fdĬÈÏÑ¡ÔñµÚÒ»¸ö´ò¿ªµÄNEAR_PSλÖõÄatͨµÀ*/

     if(g_auto_fd == at_fd || position == POSITION_VOLTE || position == FAR_PS)

     {

-    	at_print(AT_ERR,"receive auto report str = %s, fd = %d, g_auto_fd = %d, position = %d\n", at_str, at_fd, g_auto_fd, position);

+    	at_print(AT_DEBUG,"receive auto report str = %s, fd = %d, g_auto_fd = %d, position = %d\n", get_small_str(at_str), at_fd, g_auto_fd, position);

 

 		list_for_each_entry(entry,&g_inform_list,list)

 		{

@@ -1097,7 +1097,7 @@
             //ÏûÏ¢·¢ËÍʧ°Ü£¬Ö±½Ó·µ»ØERROR²¢ÊÍ·ÅͨµÀÉÏÏÂÎÄ

             if(at_cmd_paras && 0 != ipc_send_message2(MODULE_ID_AT_CTL, entry0->module_id, entry0->req_msg_id, strlen(at_cmd_paras)+1, at_cmd_paras,0))

             {

-                at_print(AT_ERR,"inform_act at_cmd_prefix0 ipc err\n");

+                at_print(AT_DEBUG,"inform_act at_cmd_prefix0 ipc err\n");

             }

            }

         }

@@ -1216,7 +1216,7 @@
     	if(fwd_fd != 0 && whole_at_type != at_str_type)

 			return 0;

 			

-    	at_print(AT_ERR,"at_rcvmsg_handle AT_TYPE_REQUEST str=%s, at_fd = %d, at_cmd_paras: %s, prefix_len: %d, paras_len: %d\n",at_str, at_fd,(char *)at_cmd_paras, prefix_len, paras_len);

+    	at_print(AT_DEBUG,"at_rcvmsg_handle AT_TYPE_REQUEST str=%s, at_fd = %d, at_cmd_paras: %s, prefix_len: %d, paras_len: %d\n",at_str, at_fd,(char *)at_cmd_paras, prefix_len, paras_len);

 		//µ±Ç°×º³¤¶È´óÓÚǰ׺×î´ó±£´æ³¤¶Èʱ£¬±¨´í add by zpr 210115

 		if(prefix_len >= AT_CMD_PREFIX)

 		{

@@ -1230,14 +1230,14 @@
     }

     else if(at_str_type == AT_TYPE_RESPONSE)//ÏìÓ¦ÀàÃüÁî´¦Àí

     {

-    	at_print(AT_ERR,"at_rcvmsg_handle AT_TYPE_RESPONSE str=%s, at_fd = %d, at_cmd_paras: %s, prefix_len: %d, paras_len: %d\n",at_str, at_fd,(char *)at_cmd_paras, prefix_len, paras_len);

+    	at_print(AT_DEBUG,"at_rcvmsg_handle AT_TYPE_RESPONSE str=%s, at_fd = %d, at_cmd_paras: %s, prefix_len: %d, paras_len: %d\n",at_str, at_fd,(char *)at_cmd_paras, prefix_len, paras_len);

         return rcv_at_rsp_handle(at_fd, at_str, at_cmd_prefix, prefix_len, at_cmd_paras, paras_len);

     }

     else if(at_str_type == AT_TYPE_INFORM)//Öмä½á¹ûÃüÁîºÍÖ÷¶¯Éϱ¨´¦Àí

         return rcv_at_inform_handle(at_fd, at_str, at_cmd_prefix, prefix_len, at_cmd_paras, paras_len);

     else if(at_str_type == AT_TYPE_PDU)//PDU´¦Àí

     {

-    	at_print(AT_ERR,"at_rcvmsg_handle AT_TYPE_PDU at_fd = %d, prefix_len: %d, paras_len: %d\n", at_fd, prefix_len, paras_len);

+    	at_print(AT_DEBUG,"at_rcvmsg_handle AT_TYPE_PDU at_fd = %d, prefix_len: %d, paras_len: %d\n", at_fd, prefix_len, paras_len);

 		if(at_cmd_paras)

 		return rcv_sms_pdu_handle(at_fd, at_str, at_cmd_prefix, prefix_len, at_cmd_paras, paras_len);

     }

diff --git a/ap/lib/libsoftap/softap_log.c b/ap/lib/libsoftap/softap_log.c
index 442770b..590b9e4 100755
--- a/ap/lib/libsoftap/softap_log.c
+++ b/ap/lib/libsoftap/softap_log.c
@@ -115,7 +115,7 @@
 }
 
 #define put_to_console(mod, fmt, arg) do {\
-	char buf[1024] = {0}; \
+	char buf[1024]; \
 	if(SLOG_SOCTIME_ON == soctime_sw) \
 		snprintf(buf, 1023, "%s[%d][%lld.%llds]: ", mod, syscall(SYS_gettid), time_us/1000000, time_us%1000000); \
 	else \