Merge "[Feature][T106][task-view-1454]Add interface function for real-time control log level"
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp
index 5eead08..5255025 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp
@@ -3,12 +3,13 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
+#include <liblog/lynq_deflog.h>
#include "lynq_timer.h"
#ifdef __cplusplus
extern "C" {
#endif
-
+#define USER_LOG_TAG "LYNQ_SDK_READY"
int main(void){
start_timer_request();
@@ -19,6 +20,7 @@
return 0;
}
+DEFINE_LYNQ_EXE_LOG(LYNQ_SDK_READY)
#ifdef __cplusplus
}
#endif
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile
index 56280dd..50b9b84 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile
+++ b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile
@@ -44,6 +44,7 @@
-lbinder \
-lpthread \
-llynq-uci \
+ -llynq-log \
LOCAL_SRC_FILES_CPP = $(wildcard *.cpp)
EXECUTABLE = lynq-sdk-ready
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
index d1ca261..afa272e 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
@@ -28,7 +28,7 @@
int lynq_set_special_log_level(const char * exe_name, const char * module_name, log_level_enum level);
int lynq_get_special_log_level(const char * exe_name, const char * module_name, log_level_enum *level);
int lynq_notify_recalc_log_level(pid_t pid);
-
+int lynq_notify_recalc_log_level_bottom(char *log_level);
#ifdef __cplusplus
}
#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
index 6256d4f..51c209f 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
@@ -13,6 +13,7 @@
#ifdef MOBILETEK_TARGET_PLATFORM_T106
extern "C" {
#include <cfg_api.h>
+extern int log_level(char *level_name);
}
#endif
@@ -546,14 +547,74 @@
return system(cmd_buf);
}
+#define MAX_PIDS 128
+int kill_pid(char *command,int signal)
+{
+ int pids[MAX_PIDS];
+ int pid_count = 0;
+ FILE *fp = popen(command, "r");
+ if (fp == NULL)
+ {
+ perror("popen failed");
+ return -1;
+ }
+ char line[1024];
+ while(fgets(line, sizeof(line), fp) != NULL)
+ {
+ if (pid_count < MAX_PIDS)
+ {
+ pids[pid_count] = atoi(line);
+ kill(pids[pid_count], signal);
+ pid_count++;
+ }
+ }
+ pclose(fp);
+ return 0;
+}
+
+int lynq_notify_recalc_log_level_bottom(char *log_level)
+{
+ sc_cfg_set("print_level", log_level);
+ sc_cfg_set("syslog_level", log_level);
+
+ const char* process_names[] = {
+ "at_ctl",
+ "mnet_whitelist_proxy",
+ "rtc-service",
+ "msm_svr",
+ "zxic_mainctrl",
+ "zxic_mmi",
+ "lynq-ril-service"
+ };
+ const int process_count = sizeof(process_names) / sizeof(process_names[0]);
+
+
+ char command[1024] = "";
+ for (int i = 0; i < process_count; i++)
+ {
+ strcat(command, "pidof ");
+ strcat(command, process_names[i]);
+ if (i < process_count - 1)
+ strcat(command, " && ");
+ }
+/*close zxic-process kill SIGUSR2*/
+ kill_pid(command, SIGUSR2);
+/*close lynq-process kill SIGUSR1*/
+ kill_pid("ls /tmp/log_level/", SIGUSR1);
+ return 0;
+}
+
+
static void log_signal_handler(int signum) {
if (SIGUSR1 != signum)
return;
// 处理信号
+ log_level("syslog_level");
+ log_level("print_level");
for(int i=0; i < s_curr_reg_count; i++)
{
get_module_log_level(s_log_module_entries[i]);
- }
+ }
}
void __attribute__((constructor)) lynq_log_init()
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
index 017fc6a..d08765c 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
@@ -18,15 +18,16 @@
LOCAL_C_INCLUDES = \
-I. \
-I$(LOCAL_PATH)/../include/liblog \
- -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/logger \
LOCAL_LIBS := \
-L. \
-ldl \
- -lstdc++ \
+ -lstdc++ \
-llynq-uci \
-llog \
+ -lbinder
ifeq ($(strip $(TARGET_PLATFORM)), T106)
LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106