Support R311 platform, Add R311 OTA support
This commit is contained in:
parent
6c7364aa45
commit
697034e91c
|
@ -91,6 +91,7 @@ static void __uvThreadOTA(void *pParams)
|
|||
|
||||
memset(&otaInfo, 0, sizeof(OTA_DATA_INFO));
|
||||
|
||||
#if 0
|
||||
if(version == 130)
|
||||
{
|
||||
otaInfo.version = 132;
|
||||
|
@ -112,7 +113,12 @@ static void __uvThreadOTA(void *pParams)
|
|||
strcpy(otaInfo.otaFileInfo.md5, "c4085cb33d6dbd5ae5fdae948365023c");
|
||||
otaInfo.otaFileInfo.size = 22963814;
|
||||
}
|
||||
|
||||
#else
|
||||
otaInfo.version = 0x00000004;
|
||||
strcpy(otaInfo.otaFileInfo.url, "http://10.240.84.163/tina_r311_ota_34.tar.gz");
|
||||
strcpy(otaInfo.otaFileInfo.md5, "34c06f79806be978a328194fd883365d");
|
||||
otaInfo.otaFileInfo.size = 31581616;
|
||||
#endif
|
||||
otaInfo.otaCmd = OTA_CMD_DOWNLOAD;
|
||||
otaInfo.otaMode = OTA_MODE_FORCE_NOW;
|
||||
|
||||
|
@ -1808,6 +1814,18 @@ void test_netlink(void)
|
|||
close(sock_fd);
|
||||
}
|
||||
|
||||
static void __uvThreadSysPointUpload(void *pParams)
|
||||
{
|
||||
sleep(10);
|
||||
while(TRUE)
|
||||
{
|
||||
printf("++++++++++++++++++++++++++++++++++\n");
|
||||
SysPointMarkUpload();
|
||||
printf("----------------------------------\n");
|
||||
sleep(60);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_CPU
|
||||
static void __uvThreadNetlinkSend(void *pParams)
|
||||
{
|
||||
|
@ -1983,6 +2001,10 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//SysPointMarkInit(NULL, -1, -1);
|
||||
|
||||
//test_task_new(__uvThreadSysPointUpload, NULL);
|
||||
|
||||
//test_netlink();
|
||||
#ifndef PLATFORM_CPU
|
||||
//BL_Init(NULL);
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
static inline int fls(int x);
|
||||
|
||||
#ifdef PLATFORM_R16
|
||||
#if defined(PLATFORM_R16) || defined(PLATFORM_R311)
|
||||
static inline int constant_fls(int x)
|
||||
{
|
||||
int r = 32;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <sys/socket.h>
|
||||
#include <linux/netlink.h>
|
||||
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU)
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU) || defined(PLATFORM_R311)
|
||||
#include "log.h"
|
||||
#include "libuv_dbus.h"
|
||||
#include "boardlink_iot.h"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <time.h>
|
||||
#include <uthash/utlist.h>
|
||||
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU)
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU) || defined(PLATFORM_R311)
|
||||
#include "log.h"
|
||||
#include "libuv_dbus.h"
|
||||
#include "crypto.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <dbus/dbus.h>
|
||||
#include <readline/readline.h>
|
||||
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU)
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU) || defined(PLATFORM_R311)
|
||||
#include "log.h"
|
||||
#include "libuv_dbus.h"
|
||||
#include "json_struct.h"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,7 @@
|
|||
#include <uthash/utlist.h>
|
||||
#include <uthash/utarray.h>
|
||||
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU)
|
||||
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU) || defined(PLATFORM_R311)
|
||||
#include "log.h"
|
||||
#include "libuv_dbus.h"
|
||||
#include "json_struct.h"
|
||||
|
|
|
@ -19,6 +19,7 @@ TARGET_BOX =
|
|||
DEBUG = TRUE
|
||||
|
||||
PLAT_R16 ?= TRUE
|
||||
PLAT_R311 ?= TRUE
|
||||
PLAT_LINUX ?= TRUE
|
||||
PLAT_WIN32 ?= FALSE
|
||||
PLAT_WIN64 ?= FALSE
|
||||
|
@ -30,18 +31,21 @@ VPATH = ../Example
|
|||
# set the source file, don't used .o because of ...
|
||||
# MRS Board Source Files
|
||||
PLAT_R16_SRCS = main.c
|
||||
|
||||
PLAT_R311_SRCS := $(PLAT_R16_SRCS)
|
||||
PLAT_LINUX_SRCS := $(PLAT_R16_SRCS)
|
||||
# gcc CFLAGS
|
||||
|
||||
# gcc CFLAGS
|
||||
PLAT_R16_CFLAGS := -I./ -I../include
|
||||
PLAT_R311_CFLAGS := $(PLAT_R16_CFLAGS)
|
||||
PLAT_LINUX_CFLAGS := $(PLAT_R16_CFLAGS) -I/usr/include/dbus-1.0/ -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include/
|
||||
PLAT_LINUX_CFLAGS += -I../linux32/inc/ -I../linux32/inc/cjson/ -I../linux32/inc/uthash/
|
||||
|
||||
#R16_LIBS := -lgobject-2.0 -lffi -lglib-2.0 -ldbus-1 -ldbus-glib-1 -luv -lnghttp2
|
||||
R16_LIBS := $(COMMON_R16_LIBS) -lreadline -lcurses
|
||||
R16_LIBS += ./libuvdbus-r16.so
|
||||
|
||||
R311_LIBS := $(COMMON_R16_LIBS) -lreadline -lcurses
|
||||
R311_LIBS += ./libuvdbus-r311.so
|
||||
|
||||
LINUX_LIBS := $(COMMON_LINUX_LIBS) -lreadline -lnghttp2
|
||||
LINUX_LIBS += ./libuvdbus-linux.so
|
||||
|
||||
|
@ -50,6 +54,11 @@ DEPEND_LIB := ./debug/libuvdbus-r16.so
|
|||
USER_CLEAN_ITEMS += ./libuvdbus-r16.so
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT_R311), TRUE)
|
||||
DEPEND_LIB += ./debug/libuvdbus-r311.so
|
||||
USER_CLEAN_ITEMS += ./libuvdbus-r311.so
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT_LINUX), TRUE)
|
||||
DEPEND_LIB += ./debug/libuvdbus-linux.so
|
||||
USER_CLEAN_ITEMS += ./libuvdbus-linux.so
|
||||
|
|
|
@ -20,6 +20,7 @@ TARGET_BOX =
|
|||
DEBUG = TRUE
|
||||
|
||||
PLAT_R16 ?= TRUE
|
||||
PLAT_R311 ?= TRUE
|
||||
PLAT_LINUX ?= TRUE
|
||||
PLAT_WIN32 ?= FALSE
|
||||
PLAT_WIN64 ?= FALSE
|
||||
|
@ -55,17 +56,21 @@ PLAT_R16_SRCS = \
|
|||
PLAT_LINUX_SRCS := $(PLAT_R16_SRCS) \
|
||||
src/cJSON.c \
|
||||
src/s2j.c
|
||||
|
||||
|
||||
PLAT_R311_SRCS := $(PLAT_R16_SRCS)
|
||||
# gcc CFLAGS
|
||||
|
||||
PLAT_R16_CFLAGS := -I../include -fPIC -I../3partys/boardlink/
|
||||
PLAT_R311_CFLAGS := $(PLAT_R16_CFLAGS)
|
||||
PLAT_LINUX_CFLAGS := $(PLAT_R16_CFLAGS) -I/usr/include/dbus-1.0/ -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include/ -I../linux32/inc/ -I../linux32/inc/cjson/
|
||||
PLAT_LINUX_CFLAGS += -I../linux32/inc/uthash/
|
||||
|
||||
PLAT_R16_LDFLAGS := -shared -fPIC
|
||||
PLAT_R311_LDFLAGS := $(PLAT_R16_LDFLAGS)
|
||||
PLAT_LINUX_LDFLAGS := $(PLAT_R16_LDFLAGS)
|
||||
|
||||
R16_LIBS := $(COMMON_R16_LIBS)
|
||||
R311_LIBS := $(COMMON_R16_LIBS)
|
||||
LINUX_LIBS := $(COMMON_LINUX_LIBS)
|
||||
|
||||
# this line must be at below of thus, because of...
|
||||
|
|
|
@ -19,6 +19,7 @@ TARGET_BOX =
|
|||
DEBUG = TRUE
|
||||
|
||||
PLAT_R16 ?= TRUE
|
||||
PLAT_R311 ?= TRUE
|
||||
PLAT_LINUX ?= TRUE
|
||||
PLAT_WIN32 ?= FALSE
|
||||
PLAT_WIN64 ?= FALSE
|
||||
|
@ -30,17 +31,19 @@ VPATH = ../Modules/OTA/
|
|||
# set the source file, don't used .o because of ...
|
||||
# MRS Board Source Files
|
||||
PLAT_R16_SRCS = ota.c
|
||||
PLAT_R311_SRCS = ota_r311.c
|
||||
|
||||
PLAT_LINUX_SRCS := $(PLAT_R16_SRCS)
|
||||
# gcc CFLAGS
|
||||
|
||||
PLAT_R16_CFLAGS := -I./ -I../include
|
||||
PLAT_R311_CFLAGS := $(PLAT_R16_CFLAGS)
|
||||
PLAT_LINUX_CFLAGS := $(PLAT_R16_CFLAGS) -I/usr/include/dbus-1.0/ -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include/
|
||||
PLAT_LINUX_CFLAGS += -I../linux32/inc/ -I../linux32/inc/cjson/ -I../linux32/inc/uthash/
|
||||
|
||||
#R16_LIBS := -lgobject-2.0 -lffi -lglib-2.0 -ldbus-1 -ldbus-glib-1 -luv
|
||||
R16_LIBS := $(COMMON_R16_LIBS)
|
||||
R16_LIBS += ./libuvdbus-r16.so
|
||||
R311_LIBS := $(COMMON_R16_LIBS) ./libuvdbus-r311.so
|
||||
|
||||
LINUX_LIBS := $(COMMON_LINUX_LIBS)
|
||||
LINUX_LIBS += ./libuvdbus-linux.so
|
||||
|
@ -51,6 +54,11 @@ DEPEND_LIB += ./debug/libuvdbus-r16.so
|
|||
USER_CLEAN_ITEMS += ./libuvdbus-r16.so
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT_R311), TRUE)
|
||||
DEPEND_LIB += ./debug/libuvdbus-r311.so
|
||||
USER_CLEAN_ITEMS += ./libuvdbus-r311.so
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT_LINUX), TRUE)
|
||||
DEPEND_LIB += ./debug/libuvdbus-linux.so
|
||||
USER_CLEAN_ITEMS += ./libuvdbus-linux.so
|
||||
|
|
20
log/log.c
20
log/log.c
|
@ -1291,6 +1291,7 @@ int SysPointMark(char* pMarkInfo)
|
|||
|
||||
int SysPointMarkUpload(void)
|
||||
{
|
||||
int ret, size = 0;
|
||||
char path[MAX_PATH];
|
||||
|
||||
memset(path, 0, MAX_PATH);
|
||||
|
@ -1301,14 +1302,31 @@ int SysPointMarkUpload(void)
|
|||
unlink(path);
|
||||
}
|
||||
|
||||
GET_FILE_SIZE(g_SysPonitInfo.savePath, size);
|
||||
|
||||
if(size <= 0)
|
||||
{
|
||||
LOG_EX(LOG_Debug, "Upload System Mark Data [%s] Is Empty, Skip......\n", g_SysPonitInfo.savePath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rename(g_SysPonitInfo.savePath, path);
|
||||
|
||||
fclose(g_SysPonitInfo.pMarkFile);
|
||||
g_SysPonitInfo.pMarkFile = fopen(g_SysPonitInfo.savePath, "w+");
|
||||
|
||||
InetHttpUploadFileSync(GetCurServerAddr(MARK_POINT_MODULE), path, NULL);
|
||||
size = 0;
|
||||
|
||||
do
|
||||
{
|
||||
ret = InetHttpUploadFileSync(GetCurServerAddr(MARK_POINT_MODULE), path, NULL);
|
||||
sleep(1);
|
||||
} while(ret != 0 && ++size < 3);
|
||||
|
||||
LOG_EX(LOG_Debug, "Upload System Mark Data [%s] To Server [%s]\n", path, GetCurServerAddr(MARK_POINT_MODULE));
|
||||
|
||||
unlink(path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue