[Feature][T8TSK-247][SDK-READY]add uci check

Only Configure: No
Affected branch: GSW3.0-No-Connman
Affected module: fota
Is it addected on both ZXIC and MTK: only MTK
Self-test: Yes
Doc Update: No

Change-Id: I0f40d2e964067bf218f5cb3ad4dedc26291e6bbd
diff --git a/lib/liblynq-uci/include/lynq_uci.h b/lib/liblynq-uci/include/lynq_uci.h
old mode 100644
new mode 100755
index 5ce7a63..904ff2b
--- a/lib/liblynq-uci/include/lynq_uci.h
+++ b/lib/liblynq-uci/include/lynq_uci.h
@@ -29,6 +29,8 @@
 

 int lynq_get_value(char *file, char *section, char *key, char *tmp);

 

+int lynq_load_config(char *filename);

+

 #ifdef __cplusplus

 }

 #endif

diff --git a/lib/liblynq-uci/makefile b/lib/liblynq-uci/makefile
old mode 100644
new mode 100755
index 87122ee..aecca27
--- a/lib/liblynq-uci/makefile
+++ b/lib/liblynq-uci/makefile
@@ -42,13 +42,15 @@
 LOCAL_C_INCLUDES = \
   -I. \
   -I$(LOCAL_PATH)/include \
-
+  -I$(ROOT)$(includedir)/logger \
 
 LOCAL_LIBS := \
     -L. \
     -ldl \
     -lpthread \
     -luci \
+    -llog \
+
 
 SOURCES = $(wildcard *.c wildcard *.h src/*.c)
 
diff --git a/lib/liblynq-uci/src/lynq_uci.c b/lib/liblynq-uci/src/lynq_uci.c
old mode 100644
new mode 100755
index 04b8f97..4f5f69a
--- a/lib/liblynq-uci/src/lynq_uci.c
+++ b/lib/liblynq-uci/src/lynq_uci.c
@@ -2,6 +2,7 @@
 #include <stdlib.h>

 #include <string.h>

 #include <lynq_uci.h>

+#include <log/log.h>

 

 

 int lynq_del(char *option)

@@ -194,3 +195,25 @@
 	ret = lynq_uci_get(buf, tmp);

 	return ret;

 }

+

+int lynq_load_config(char *filename)

+{

+    struct uci_context * ctx = NULL;

+    struct uci_element *e;

+    struct uci_package * pkg = NULL;

+    ctx = uci_alloc_context();

+    RLOGD("uci load start \n");

+    if (UCI_OK != uci_load(ctx, filename, &pkg))

+    {

+        RLOGD("uci config fail !!!\n");

+        uci_free_context(ctx);

+        ctx = NULL;

+        return -1;

+    }

+    uci_unload(ctx, pkg);

+    uci_free_context(ctx);

+    RLOGD("uci config success !!!\n");

+    ctx = NULL;

+    return 0;

+}

+