[Bugfix][T106BUG-313][AUTOSUSPEND]Repeatedly awakened due to no internet connection
Only Configure: No
Affected branch: master
Affected module: autosuspend
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: Yes
Change-Id: I41de748cdd87f6e62aeaf7adf227259597afc7d5
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
index 204660a..ea9b381 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
@@ -12,7 +12,7 @@
#include <lynq_autosuspend.h>
#include "lynq-qser-autosuspend.h"
#include "liblog/lynq_deflog.h"
-#include "sc_mnet_whitelist.h"
+#include <include/lynq_uci.h>
#ifdef __cplusplus
extern "C" {
@@ -26,6 +26,9 @@
#define USER_LOG_TAG "LYNQ_QSER_AUTOSUSPEND"
#define FILE_LOCK_TABLE "/tmp/.lock_table"
+#define LOG_UCI_MODULE "lynq_autosuspend"
+#define LOG_UCI_FILE "lynq_uci"
+
#define UEVENT_MSG_LEN 128
int device_fd;
@@ -445,80 +448,35 @@
return ret;
}
-int qser_whitelist_add(int id)
+int qser_whitelist_set(char *whitelist)
{
int ret;
- if(sc_mnet_whitelist_init() != 0)
+ char cmd[64];
+ if(strlen(whitelist) != 4)
{
- LYINFLOG("sc_mnet_whitelist_init failed.\n");
+ LYINFLOG("string len is error\n");
return -1;
}
-
- ret = sc_mnet_whitelist_add(id);
- LYINFLOG("sc_mnet_whitelist_add ret %d.\n", ret);
-
- sc_mnet_whitelist_deinit();
+ sprintf(cmd, "uci set lynq_uci.lynq_autosuspend.whitelist_state='%s'", whitelist);
+ ret = system(cmd);
+ system("uci commit");
+ if(ret != 0)
+ {
+ LYINFLOG("qser_whitlist_set fail");
+ }
return ret;
}
-int qser_whitelist_del(int id)
+int qser_whitelist_get(char *whitelist)
{
int ret;
- if(sc_mnet_whitelist_init() != 0)
- {
- LYINFLOG("sc_mnet_whitelist_init failed.\n");
- return -1;
- }
-
- ret = sc_mnet_whitelist_del(id);
- LYINFLOG("qser_whitelist_del ret %d.\n", ret);
-
- sc_mnet_whitelist_deinit();
+ ret = lynq_get_value(LOG_UCI_FILE, LOG_UCI_MODULE, "whitelist_state", whitelist);
+ LYERRLOG("ret =%d, whitelist_state is %s\n", ret, whitelist);
return ret;
}
-int qser_whitelist_get(char* whitelist)
-{
- int ret;
- if(sc_mnet_whitelist_init() != 0)
- {
- LYINFLOG("sc_mnet_whitelist_init failed.\n");
- return -1;
- }
-
- whitelist = sc_mnet_whitelist_get();
- if(NULL != whitelist)
- {
- LYINFLOG("sc_mnet_whitelist_get :%s\n",whitelist);
- ret = 0;
- }
- else
- {
- LYINFLOG("sc_mnet_whitelist_get empty\n");
- ret = -1;
- }
- sc_mnet_whitelist_deinit();
- return ret;
-}
-
-int qser_whitelist_clear(void)
-{
- int ret;
- if(sc_mnet_whitelist_init() != 0)
- {
- LYINFLOG("sc_mnet_whitelist_init failed.\n");
- return -1;
- }
- ret = sc_mnet_whitelist_clear();
- LYINFLOG("sc_mnet_whitelist_clear ret %d\n", ret);
- sc_mnet_whitelist_deinit();
- return ret;
-
-}
-
-
DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_AUTOSUSPEND)
#ifdef __cplusplus