Fix warning as error for V2
Change-Id: I70cfd971fda629011ba1be84fef15afea196d393
diff --git a/mbtk/libmbtk_lib_v2/fota/mbtk_fota.c b/mbtk/libmbtk_lib_v2/fota/mbtk_fota.c
index 68e2ba0..6d5d3e8 100755
--- a/mbtk/libmbtk_lib_v2/fota/mbtk_fota.c
+++ b/mbtk/libmbtk_lib_v2/fota/mbtk_fota.c
@@ -8,12 +8,23 @@
#include <pthread.h>
#include <libubox/blobmsg_json.h>
#include "libubus.h"
-#include "mbtk_fota.h"
+
#include <semaphore.h>
#include <cutils/properties.h>
+#include <libubox/blob.h>
+#include <libubox/uloop.h>
+#include <libubox/usock.h>
+#include <libubox/list.h>
+#include <libubus.h>
+#include <uci.h>
+#include <sys/ioctl.h>
+#include <mtd/mtd-user.h>
+
+#include "mbtk_fota.h"
#include "mbtk_log.h"
-
+#include "mbtk_utils.h"
+#include "mbtk_type.h"
#ifdef DEBUG
#define fota_log(...) printf(__VA_ARGS__)
@@ -21,7 +32,6 @@
#define fota_log(...)
#endif
-#define UNUSEDPARAM(param) (void)param;
#define OTA_MAX_STRING_LEN 128
static struct ubus_context *fota_ubus_ctx = NULL;
@@ -154,7 +164,7 @@
if(!access("/sys/power/wake_lock", W_OK))
{
sprintf(cmd, "echo %s > /sys/power/wake_lock", "ota_lock");
- system(cmd);
+ mbtk_system(cmd);
LOGE("/sys/power/wake_lock success\n");
}
else
@@ -192,7 +202,7 @@
{
char cmd[128]={0};
sprintf(cmd, "echo %s > /sys/power/wake_unlock", "ota_lock");
- system(cmd);
+ mbtk_system(cmd);
LOGE("/sys/power/wake_unlock success\n");
}
else
@@ -236,7 +246,7 @@
if(!access("/sys/power/wake_lock", W_OK))
{
sprintf(cmd, "echo %s > /sys/power/wake_lock", "ota_lock");
- system(cmd);
+ mbtk_system(cmd);
LOGE("/sys/power/wake_lock success\n");
}
else
@@ -275,7 +285,7 @@
{
char cmd[128]={0};
sprintf(cmd, "echo %s > /sys/power/wake_unlock", "ota_lock");
- system(cmd);
+ mbtk_system(cmd);
LOGE("/sys/power/wake_unlock success\n");
}
else
@@ -325,8 +335,8 @@
fota_cb = NULL;
if (is_reboot) {
- system("sync");
- system("reboot");
+ mbtk_system("sync");
+ mbtk_system("reboot");
}
return 0;
@@ -335,15 +345,15 @@
int mbtk_fota_done1(int is_reboot)
{
if (is_reboot) {
- system("sync");
- system("reboot");
+ mbtk_system("sync");
+ mbtk_system("reboot");
}
return 0;
}
void* mbtk_fota_thread(void* argc)
{
- int ret, retries = 0;
+ int ret;
UNUSEDPARAM(argc);
printf("mbtk_fota_thread() start\n");
@@ -368,7 +378,6 @@
int mbtk_fota_init(fota_callback cb)
{
- int id;
int retries = 0;
/*create ubus loop to listen to RIL event*/
@@ -425,3 +434,73 @@
MBTK_SOURCE_INFO_PRINT("mbtk_fota_lib");
}
+int mbtk_fota_get_active_absys_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.absys_active", tmp_type, "0");
+ type = atoi(tmp_type);
+ if (type == 97)
+ {
+ type = mbtk_sys_A;
+ }
+ else if (type == 98)
+ {
+ type = mbtk_sys_B;
+ }
+ else
+ {
+ LOGE("get_active_absys_type %s fail",tmp_type);
+ type = -1;
+ }
+
+ return type;
+}
+
+int mbtk_fota_get_tmp_absys_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.absys_tmp", tmp_type, "0");
+ type = atoi(tmp_type);
+ if (type == 97)
+ {
+ type = mbtk_sys_A;
+ }
+ else if (type == 98)
+ {
+ type = mbtk_sys_B;
+ }
+ else
+ {
+ LOGE("get_tmp_absys_type %s fail",tmp_type);
+ type = -1;
+ }
+
+ return type;
+}
+
+int mbtk_fota_get_sync_absys_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.absys_sync", tmp_type, "0");
+ type = atoi(tmp_type);
+
+ return type;
+}
+
+int mbtk_fota_get_mtd_check_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.mtd_check", tmp_type, "0");
+ type = atoi(tmp_type);
+
+ return type;
+}
+