修改sf_app所有默认存储路径为动态获取当前存储设备路径
This commit is contained in:
parent
4b89619984
commit
1ccde70aa2
|
@ -932,14 +932,15 @@
|
|||
#define MOVIE_THUMB_PATH ":\\THUMB\\"
|
||||
|
||||
#define SF_SD_ROOT "/mnt/sd/"
|
||||
#define SF_SEND_LIST_DIR "/mnt/sd/THUMB/"
|
||||
#define SF_EMMC_ROOT "/mnt/sd2/"
|
||||
|
||||
#define SF_SEND_LIST_DIR "THUMB/"
|
||||
#define SF_THUMB_SEND_LIST SF_SEND_LIST_DIR"send.list"
|
||||
#define SF_THUMB_SEND_AUTO SF_SEND_LIST_DIR"auto.list"
|
||||
#define SF_HD_DIR_LIST SF_SEND_LIST_DIR"HD/send.list"
|
||||
#define SF_HD_DIR_LIST SF_SEND_LIST_DIR"HD/send.list" //No use
|
||||
#define SF_HD_DIR SF_SEND_LIST_DIR"HD"
|
||||
#define SF_HD_DIR_CARDV "A:\\THUMB\\HD\\"
|
||||
#define SF_HD_DIR_CARDV "A:\\THUMB\\HD\\" //No use
|
||||
|
||||
#define SF_EMMC_ROOT "/mnt/sd2/"
|
||||
|
||||
#define SF_FW_CFG_FILE_NAME "SPHOST_REVEAL.CFG"
|
||||
#define SF_FW_FILE_NAME "SPHOST_REVEAL.BRN"
|
||||
|
@ -970,9 +971,9 @@
|
|||
#define SF_BATTERY_TEST_FILE "A:\\BATTERY.TXT"
|
||||
#define SF_HW_TEST DISABLE
|
||||
#define SF_MODULE_UP_FILE "EG915QNA.tar.bz2"
|
||||
#define SF_MODULE_UP_FILE_PATH "/mnt/sd/EG915QNA.tar.bz2"
|
||||
#define SF_MODULE_UP_FILE_PATH "EG915QNA.tar.bz2"
|
||||
#define SF_CAM_UP_FILE "CAM_OTA_S550/SPHOST_REVEAL.BIN"
|
||||
#define SF_CAM_UP_FILE_PATH "/mnt/sd/FW98565A.bin"
|
||||
#define SF_CAM_UP_FILE_PATH "FW98565A.bin"
|
||||
#define SF_CAMERA_GPS_INFO_FILENAME "/tmp/gps.txt"
|
||||
#define SF_UBOOT_UPDATA_FW ENABLE
|
||||
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
#include <sf_param_struct.h>
|
||||
#include <FileSysTsk.h>
|
||||
#include "sf_mcu.h"
|
||||
|
||||
#if HUNTING_CAMERA_MCU == ENABLE
|
||||
#include <sf_message_queue.h>
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int event;
|
||||
|
@ -33,7 +38,6 @@ SF_THREAD_S MMCMonitorTskCfg =
|
|||
.TskId = -1,
|
||||
};
|
||||
|
||||
|
||||
#define MIN_DISK_FREE_SIZE_MB 30
|
||||
|
||||
|
||||
|
@ -338,12 +342,31 @@ SF_ST_MMC_DEV *SF_StrgCheckWorkableDev(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int sfStrgOnActionSendCurrentDev(SF_ST_MMC_DEV *pMMCDev)
|
||||
{
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
stMessageBuf.s32Wait = SF_SYS_STRG_DEV_MSG;
|
||||
stMessageBuf.arg1 = pMMCDev->dev_type;
|
||||
stMessageBuf.arg2 = pMMCDev->node;
|
||||
stMessageBuf.arg3 = pMMCDev->moumted_state;
|
||||
stMessageBuf.cmdId = CMD_SD;
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void* mmc_monitoring_thread(void *arg)
|
||||
{
|
||||
static MMC_DEV_TYPE current_dev = MMC_DEV_NO;
|
||||
while(MMCMonitorTskCfg.IsRun)
|
||||
{
|
||||
pMMCDev = SF_StrgCheckWorkableDev();
|
||||
|
||||
if(current_dev != pMMCDev->dev_type)
|
||||
{
|
||||
current_dev = pMMCDev->dev_type;
|
||||
sfStrgOnActionSendCurrentDev(pMMCDev);
|
||||
}
|
||||
|
||||
sf_sleep_ms(1000);
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
#define USE_MMC_DEV_CHECK (1)
|
||||
|
||||
#define SF_SYS_STRG_DEV_MSG (7)
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MMC_DEV_SD = 0,
|
||||
|
|
|
@ -274,6 +274,7 @@ SRC = \
|
|||
./code/source/app/sf_dbg.c \
|
||||
./code/source/gpio/sf_hal_gpio.c \
|
||||
./code/source/logMng/sf_log.c \
|
||||
./code/source/storeMng/sf_storeMng.c \
|
||||
./code/source/commMng/sf_message_queue.c \
|
||||
./code/source/commMng/sf_share_mem.c \
|
||||
./code/source/fileMng/cJSON.c \
|
||||
|
@ -297,7 +298,6 @@ SRC = \
|
|||
./code/source/qrcodeMng/sf_bmp.c \
|
||||
./code/source/qrcodeMng/sf_qrcode.c \
|
||||
./code/source/qrcodeMng/split.c \
|
||||
./code/source/storeMng/sf_storeMng.c \
|
||||
./code/source/ttyusb/sf_hal_ttyusb.c \
|
||||
./code/source/4gMng/sf_4g_lpa.c \
|
||||
./code/source/4gMng/sf_4G_sms_lpa_cmd.c \
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
#define SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME "/tmp/download_ac.txt"
|
||||
#define SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME "/tmp/download_enable_ac.txt"
|
||||
#define SF_LPA_PROFILE_INFO_FILENEME "/tmp/profile_info.txt"
|
||||
#define SF_LPA_PROFILE_INFO_BACKUP_FILENEME "/mnt/sd/profile_info.txt"
|
||||
#define SF_LPA_LOG_FILE_PATH "/mnt/sd/"
|
||||
#define SF_LPA_PROFILE_INFO_BACKUP_FILENEME "profile_info.txt"
|
||||
#define SF_LPA_LOG_FILE_PATH "/mnt/sd/" //No use
|
||||
|
||||
#endif
|
||||
typedef struct SF_SMS_LPA_CMD_S{
|
||||
|
|
|
@ -138,16 +138,18 @@ extern "C" {
|
|||
|
||||
#define DEFAULT_RTC_DEVICE "/dev/rtc0"
|
||||
|
||||
//#define SF_SD_ROOT "/mnt/sd/"
|
||||
|
||||
#define SIFAR_CUSTOMER_PARAM_PATH "/misc/sfSysParm.bin"
|
||||
#define SIFAR_STATISTICS_PARAM_PATH "/mnt/sd/THUMB/sfStatisticsParm.bin"
|
||||
#define SIFAR_STATISTICS_PARAM_PATH "THUMB/sfStatisticsParm.bin"
|
||||
//#define SF_SEND_LIST_DIR SF_SD_ROOT"THUMB"
|
||||
#define SF_DAILYREPORT_FILENAME SF_SD_ROOT"THUMB/d.txt"
|
||||
#define SF_ERROR_CODE SF_SD_ROOT"THUMB/warning.txt"
|
||||
#define SF_DAILYREPORT_FILENAME "THUMB/d.txt"
|
||||
#define SF_ERROR_CODE "THUMB/warning.txt"
|
||||
#define SF_DAILYREPORT_TXT "DailyReport.txt"
|
||||
#define SF_LOG_TXT "log.txt"
|
||||
#define SF_LOW_POWER_WARN_FILENAME SF_SD_ROOT"/THUMB/btalarm.txt"
|
||||
#define SF_LOW_POWER_WARN_FILENAME "/THUMB/btalarm.txt"
|
||||
|
||||
#define UPGRADE_FIRMWARE_NANE (char*)"Mupgrade.bin"
|
||||
|
||||
|
||||
#define GPIO_DIR_OUT 1
|
||||
#define GPIO_DIR_IN 0
|
||||
|
@ -158,9 +160,9 @@ extern "C" {
|
|||
#define SECRET_VER "aws4_request"
|
||||
#define AMZ "s3"
|
||||
|
||||
#define SF_4G_PIC_THUMB_PATH SF_SD_ROOT"DCIM/THUMB/"
|
||||
#define SF_4G_SMALL_VIDEO_STREAM_PATH SF_SD_ROOT"DCIM/SMALL/"
|
||||
#define SIM_AUTO_MATCH_FILE_PATH SF_SD_ROOT"SIM Auto Match.TXT"
|
||||
#define SF_4G_PIC_THUMB_PATH SF_SD_ROOT"DCIM/THUMB/" //No use
|
||||
#define SF_4G_SMALL_VIDEO_STREAM_PATH "DCIM/SMALL/"
|
||||
#define SIM_AUTO_MATCH_FILE_PATH "SIM Auto Match.TXT"
|
||||
|
||||
#define SF_DCF_DIR_NAME_SUFFIX DCF_FILE_NAME /**< DCF Directory Name (it must be 5-characters) */
|
||||
#define SF_DCF_ROOT_DIR_NAME "DCIM" /**< DCF Root Directory Name */
|
||||
|
@ -181,12 +183,12 @@ extern "C" {
|
|||
|
||||
#define GPRS_INFO_LINE_MAX 512
|
||||
#define MAX_CALL_TIMES 100
|
||||
#define SF_SD_DISK "/mnt/sd/"
|
||||
#define SF_DCIM_DIR SF_SD_ROOT"DCIM"
|
||||
#define SF_THUMB_DIR SF_SD_DISK"THUMB"
|
||||
#define SF_THUMB_SMALL_DIR SF_SD_DISK"THUMB/small"
|
||||
#define SF_THUMB_BIG_DIR SF_SD_DISK"THUMB/big"
|
||||
#define SF_THUMB_VIDEO_DIR SF_SD_DISK"THUMB/video"
|
||||
#define SF_SD_DISK "/mnt/sd/" //No use
|
||||
#define SF_DCIM_DIR "DCIM"
|
||||
#define SF_THUMB_DIR "THUMB"
|
||||
#define SF_THUMB_SMALL_DIR SF_SD_DISK"THUMB/small" //No use
|
||||
#define SF_THUMB_BIG_DIR SF_SD_DISK"THUMB/big" //No use
|
||||
#define SF_THUMB_VIDEO_DIR SF_SD_DISK"THUMB/video" //No use
|
||||
|
||||
#define SF_TRUE 1
|
||||
#define SF_FALSE 0
|
||||
|
@ -404,6 +406,7 @@ typedef enum sf_MESSAGE_CMD_SD_e
|
|||
CMD_SD_STRG_CB_UNMOUNT_FINISH = 4, ///< The type for calling after storage unmounted
|
||||
CMD_SD_FULL = 5,
|
||||
CMD_SD_FORMAT = 6,
|
||||
CMD_SD_STRG_WORKABLE_DEV = 7,
|
||||
CMD_SD_SYSTEM_CB_CONFIG = 0xFFFFFFFF,
|
||||
|
||||
}SF_MESSAGE_CMD_SD_E;
|
||||
|
|
|
@ -7,7 +7,7 @@ extern "C" {
|
|||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
#define QLOG_PATH SF_SD_ROOT"qlog/"
|
||||
#define QLOG_PATH "qlog/"
|
||||
|
||||
#define SF_APP_ERROR_NO_SUPPOET SF_ERR_ID(SF_MOD_APP, ERROR_NO_SUPPORT)
|
||||
#define SF_APP_ERROR_REQUEST SF_ERR_ID(SF_MOD_APP, ERROR_REQUEST)
|
||||
|
|
|
@ -63,6 +63,34 @@ typedef enum
|
|||
MMC_DEV_NO = 2,
|
||||
}MMC_DEV_TYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MMC_DEV_NODE_STATE_NO = 0,
|
||||
MMC_DEV_NODE_STATE_EXIST = 1,
|
||||
MMC_DEV_NODE_STATE_NO_EXIST = 2,
|
||||
}MMC_DEV_NODE_STATE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MMC_DEV_MOUNT_STATE_NO = 0,
|
||||
MMC_DEV_MOUNT_STATE_MOUNTED = 1,
|
||||
MMC_DEV_MOUNT_STATE_UNMOUNTED = 2,
|
||||
}MMC_DEV_MOUNT_STATE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MMC_DEV_TYPE dev_type;
|
||||
MMC_DEV_NODE_STATE node;
|
||||
MMC_DEV_MOUNT_STATE moumted_state;
|
||||
}SF_STRG_DEV;
|
||||
|
||||
|
||||
void sf_strg_dev_init(void);
|
||||
void sf_strg_dev_uninit(void);
|
||||
void sf_strg_dev_register(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
MMC_DEV_TYPE sf_get_strg_dev(void);
|
||||
char *sf_root_path_strcat(char *path_name);
|
||||
char *sf_get_root_path(void);
|
||||
|
||||
SINT32 sf_sd_info_get(SF_STORE_ATTR_S *pstoreattrs);
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@
|
|||
#define DEV_UPLOADFILE_END 0x1008
|
||||
#define DEV_UPLOADFILE_END_RSP 0x1009
|
||||
|
||||
#define SF_DCF_SD_ROOT "/mnt/sd/" /**< DCF File Name (it must be 4-characters) */
|
||||
#define SD_PATH SF_DCF_SD_ROOT //"/sdcard/mmcblk0p1" //mnt/hgfs
|
||||
#define SF_DCF_SD_ROOT "/mnt/sd/" /**< DCF File Name (it must be 4-characters) */ //No use
|
||||
#define SD_PATH SF_DCF_SD_ROOT //"/sdcard/mmcblk0p1" //mnt/hgfs //No use
|
||||
#define THUMB_PATH SF_SEND_LIST_DIR
|
||||
#define THUMB_HD_PATH SD_PATH "/DCIM/THUMB/LARGE"
|
||||
#define THUMB_HD_PATH "/DCIM/THUMB/LARGE" //No use
|
||||
|
||||
/*typedef enum {
|
||||
POWEROFF_COUNTDOWN = 1,
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "sf_log.h"
|
||||
#include "sf_sim.h"
|
||||
#include "sf_systemMng.h"
|
||||
#include "sf_storeMng.h"
|
||||
#include "sf_service.h"
|
||||
#include "sf_4G_sms_lpa_cmd.h"
|
||||
#include "sf_file.h"
|
||||
|
@ -810,7 +811,14 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho
|
|||
|
||||
UIMenuStoreInfo *sfParam = sf_app_ui_para_get();
|
||||
|
||||
SF_SPRINTF(filePath, "%sLPA%sTS.log", SF_LPA_LOG_FILE_PATH, sfParam->ModuleImei);
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
SF_SPRINTF(filePath, "%sLPA%sTS.log", strg_path, sfParam->ModuleImei);
|
||||
SLOGD("filePath:%s\n", filePath);
|
||||
|
||||
fdOld = SF_OPEN(filePath, O_RDWR, 0777);
|
||||
|
@ -828,7 +836,7 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho
|
|||
sf_move_line(fdOld, delLineNum + 1);
|
||||
SLOGD("delLineNum:%d\n", delLineNum);
|
||||
|
||||
SF_SPRINTF(newFilePath, "%sLPA.log", SF_LPA_LOG_FILE_PATH);
|
||||
SF_SPRINTF(newFilePath, "%sLPA.log", strg_path);
|
||||
fdNew = SF_OPEN(newFilePath, O_WRONLY | O_CREAT, 0777);
|
||||
if(fdNew >= 0)
|
||||
{
|
||||
|
@ -864,14 +872,14 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho
|
|||
{
|
||||
//old log file in sd card, not exist
|
||||
SLOGD("\n");
|
||||
SF_SPRINTF(filePath, "%sLPA%sTS.log", SF_LPA_LOG_FILE_PATH, sfParam->ModuleImei);
|
||||
SF_SPRINTF(filePath, "%sLPA%sTS.log", strg_path, sfParam->ModuleImei);
|
||||
SLOGD("filePath:%s\n", filePath);
|
||||
fdNew = SF_OPEN(filePath, O_WRONLY | O_CREAT, 0777);
|
||||
if(fdNew >= 0)
|
||||
sf_write_log_content(fdNew, pLpaCmd, status, errorCode, Source);
|
||||
SF_CLOSE(fdNew);
|
||||
}
|
||||
|
||||
free(strg_path);
|
||||
SF_SYNC();
|
||||
|
||||
}
|
||||
|
@ -879,8 +887,14 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho
|
|||
void sf_sms_lpa_delete_lpa_log(void)
|
||||
{
|
||||
UINT8 fileName[64] = { 0 };
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
SF_SPRINTF(fileName, "%s%s", SF_LPA_LOG_FILE_PATH, sf_sms_lpa_log_file_name_get());
|
||||
SF_SPRINTF(fileName, "%s%s", strg_path, sf_sms_lpa_log_file_name_get());
|
||||
|
||||
if(sf_file_exsit(fileName) == SF_SUCCESS)
|
||||
{
|
||||
|
@ -888,6 +902,7 @@ void sf_sms_lpa_delete_lpa_log(void)
|
|||
SF_DELETE(fileName);
|
||||
SF_SYNC();
|
||||
}
|
||||
free(strg_path);
|
||||
}
|
||||
|
||||
SINT32 sf_sms_lpa_command_recombination(SF_SMS_LPA_CMD_T *pLpaCmd)
|
||||
|
@ -1145,6 +1160,13 @@ SINT32 sf_sms_lpa_save_profile_info_item(const SINT8* iccid, const SINT8* apn, c
|
|||
UINT32 fd = 0;
|
||||
SINT8 buff[256] = {0};
|
||||
|
||||
char *file_path = sf_root_path_strcat(SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if((iccid == NULL) || (apn == NULL) || (activationCodeStr == NULL))
|
||||
{
|
||||
return SF_FAILURE;
|
||||
|
@ -1166,7 +1188,8 @@ SINT32 sf_sms_lpa_save_profile_info_item(const SINT8* iccid, const SINT8* apn, c
|
|||
SF_WRITE(fd, (UINT8 *)buff, SF_STRLEN(buff));
|
||||
SF_CLOSE(fd);
|
||||
|
||||
SF_DELETE(SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
SF_DELETE(file_path);
|
||||
free(file_path);
|
||||
memset(buff, '\0', sizeof(buff));
|
||||
sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME);
|
||||
system(buff);
|
||||
|
@ -1194,6 +1217,13 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid)
|
|||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
char *file_path = sf_root_path_strcat(SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
SLOGD("Delete %s to %s\n", iccid, SF_LPA_PROFILE_INFO_FILENEME);
|
||||
|
||||
fSize = sf_get_file_size(SF_LPA_PROFILE_INFO_FILENEME);
|
||||
|
@ -1269,7 +1299,7 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid)
|
|||
if(sf_save_file(SF_LPA_PROFILE_INFO_FILENEME, tmpFileBuff, len) == FAIL)
|
||||
{
|
||||
memset(buff, '\0', sizeof(buff));
|
||||
sprintf(buff, "cp %s /appfs/ -f", SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
sprintf(buff, "cp %s /appfs/ -f", file_path);
|
||||
system(buff);
|
||||
SF_SYNC();
|
||||
|
||||
|
@ -1279,12 +1309,13 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid)
|
|||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
SF_DELETE(SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
SF_DELETE(file_path);
|
||||
memset(buff, '\0', sizeof(buff));
|
||||
sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME);
|
||||
system(buff);
|
||||
SF_SYNC();
|
||||
|
||||
free(file_path);
|
||||
free(fileBuff);
|
||||
free(tmpFileBuff);
|
||||
}
|
||||
|
@ -1310,16 +1341,23 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a
|
|||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
char *file_path = sf_root_path_strcat(SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if((sf_sd_status_get() == SF_SD_OK) || (sf_sd_status_get() == SF_SD_FULL))
|
||||
{
|
||||
if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) != SUCCESS) && (sf_file_exsit(SF_LPA_PROFILE_INFO_BACKUP_FILENEME) == SUCCESS))
|
||||
if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) != SUCCESS) && (sf_file_exsit(file_path) == SUCCESS))
|
||||
{
|
||||
memset(buff, '\0', sizeof(buff));
|
||||
sprintf(buff, "cp %s /appfs/ -f", SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
sprintf(buff, "cp %s /appfs/ -f", file_path);
|
||||
system(buff);
|
||||
SF_SYNC();
|
||||
}
|
||||
else if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) == SUCCESS) && (sf_file_exsit(SF_LPA_PROFILE_INFO_BACKUP_FILENEME) != SUCCESS))
|
||||
else if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) == SUCCESS) && (sf_file_exsit(file_path) != SUCCESS))
|
||||
{
|
||||
memset(buff, '\0', sizeof(buff));
|
||||
sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME);
|
||||
|
@ -1335,9 +1373,10 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a
|
|||
|
||||
if(fSize == 0)
|
||||
{
|
||||
sprintf(fileName, "%s", SF_LPA_PROFILE_INFO_BACKUP_FILENEME);
|
||||
sprintf(fileName, "%s", file_path);
|
||||
fSize = sf_get_file_size(fileName);
|
||||
}
|
||||
free(file_path);
|
||||
|
||||
if(fSize != 0)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ extern "C" {
|
|||
|
||||
#include "sf_hal_ttyusb.h"
|
||||
#include "sf_systemMng.h"
|
||||
#include "sf_storeMng.h"
|
||||
#include "sf_commu_mcu_reg.h"
|
||||
#include "sf_opera_adapt.h"
|
||||
#include "sf_eg91_sim.h"
|
||||
|
@ -329,12 +330,21 @@ SINT32 eg91_other_sim_apn_cfg(UIMenuStoreInfo *pstaticParam)
|
|||
//SF_CHAR *pTemp = SF_NULL;
|
||||
int enbleValue = 0;
|
||||
|
||||
fp = fopen(SIM_AUTO_MATCH_FILE_PATH, "r");
|
||||
char *file_path = sf_root_path_strcat(SIM_AUTO_MATCH_FILE_PATH);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
fp = fopen(file_path, "r");
|
||||
if(fp == NULL)
|
||||
{
|
||||
SLOGE("open file [%s] failed!\n", SIM_AUTO_MATCH_FILE_PATH);
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
free(file_path);
|
||||
|
||||
{
|
||||
fgets(linestr, 128, fp);
|
||||
|
|
|
@ -1108,12 +1108,21 @@ SINT32 sf_ftp_dailyreport_send(void)
|
|||
|
||||
MLOGD("start\n");
|
||||
|
||||
char *file_path = NULL;
|
||||
file_path = sf_root_path_strcat(SF_DAILYREPORT_FILENAME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if(SUCCESS != sf_create_dailyreport_file())
|
||||
{
|
||||
printf("%s:%d err create dailyreport file\n", __FUNCTION__, __LINE__);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
sprintf((char *)filePath, "%s", SF_DAILYREPORT_FILENAME);
|
||||
sprintf((char *)filePath, "%s", file_path);
|
||||
free(file_path);
|
||||
//sprintf((char *)filePath, "UFS:/%s-dr.txt", pPara->ModuleImei);
|
||||
|
||||
printf("%s:%d filePath:%s\n", __FUNCTION__, __LINE__, filePath);
|
||||
|
@ -1123,6 +1132,12 @@ SINT32 sf_ftp_dailyreport_send(void)
|
|||
|
||||
ret = SF_SUCCESS;//sf_quectel_upload_file_to_module((UINT8 *)SF_DAILYREPORT_FILENAME, (UINT8 *)SF_DAILYREPORT_TXT);
|
||||
|
||||
file_path = sf_root_path_strcat(SF_ERROR_CODE);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
if(SF_SUCCESS != ret)
|
||||
{
|
||||
printf("%s:%d upload err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath);
|
||||
|
@ -1153,12 +1168,12 @@ SINT32 sf_ftp_dailyreport_send(void)
|
|||
pSifarPara->videoSendFailCount = 0;
|
||||
pSifarPara->videoSendSucessCount = 0;
|
||||
pSifarPara->SendlowPowerWarnCnt = 0;
|
||||
sf_file_remove(SF_ERROR_CODE);
|
||||
sf_file_remove(file_path);
|
||||
}
|
||||
sf_dailyReport_set();
|
||||
}
|
||||
MLOGD(" end ret:[0x%08X]\n", ret);
|
||||
|
||||
free(file_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1366,9 +1381,11 @@ SINT32 sf_4g_module_ota_ftp(void)
|
|||
const UINT8 *password;
|
||||
// FtpConfig config;
|
||||
MLOGD("start\n");
|
||||
char tmp_path[64] = {'\0'};
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1392,15 +1409,15 @@ SINT32 sf_4g_module_ota_ftp(void)
|
|||
printf("ftp_manager_init password = %s\n", config.password);
|
||||
*/
|
||||
ftp_manager_init(config);
|
||||
|
||||
if(SF_TRUE == sf_file_IsExsit(SF_MODULE_UP_FILE_PATH)){
|
||||
sf_file_remove(SF_MODULE_UP_FILE_PATH);
|
||||
snprintf(tmp_path, sizeof(tmp_path), "%s%s", strg_path, SF_MODULE_UP_FILE_PATH);
|
||||
if(SF_TRUE == sf_file_IsExsit(tmp_path)){
|
||||
sf_file_remove(tmp_path);
|
||||
}
|
||||
|
||||
ret = ftp_download_file(SF_MODULE_UP_FILE,SF_MODULE_UP_FILE_PATH,0);
|
||||
ret = ftp_download_file(SF_MODULE_UP_FILE,tmp_path,0);
|
||||
if(SUCCESS == ret){
|
||||
system("sync");
|
||||
sprintf(Cmd, "tar -xjvf %s -C %s", SF_MODULE_UP_FILE_PATH, strg_path);
|
||||
sprintf(Cmd, "tar -xjvf %s -C %s", tmp_path, strg_path);
|
||||
MLOGD("%s\n", Cmd);
|
||||
ret = system(Cmd);
|
||||
if(SUCCESS == ret){
|
||||
|
@ -1413,7 +1430,7 @@ SINT32 sf_4g_module_ota_ftp(void)
|
|||
sf_set_module_update(0);
|
||||
}
|
||||
}
|
||||
|
||||
free(strg_path);
|
||||
MLOGD(" end ret:[0x%08X]\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1492,6 +1509,13 @@ SINT32 sf_camera_ota_ftp(void)
|
|||
// FtpConfig config;
|
||||
MLOGD("start\n");
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
ssl_flag = FTP_SSL_FLAG_DISABLE;
|
||||
ftpIP = pPara->OtaFtpIp;
|
||||
port = atoi((const char *)(pPara->OtaFtpPort));
|
||||
|
@ -1512,12 +1536,14 @@ SINT32 sf_camera_ota_ftp(void)
|
|||
printf("ftp_manager_init password = %s\n", config.password);
|
||||
*/
|
||||
ftp_manager_init(config);
|
||||
char tmp[64] = {'\0'};
|
||||
snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_CAM_UP_FILE_PATH);
|
||||
|
||||
if(SF_TRUE == sf_file_IsExsit(SF_CAM_UP_FILE_PATH)){
|
||||
sf_file_remove(SF_CAM_UP_FILE_PATH);
|
||||
if(SF_TRUE == sf_file_IsExsit(tmp)){
|
||||
sf_file_remove(tmp);
|
||||
}
|
||||
|
||||
ret = ftp_download_file(SF_CAM_UP_FILE,SF_CAM_UP_FILE_PATH,0);
|
||||
ret = ftp_download_file(SF_CAM_UP_FILE,tmp,0);
|
||||
//if(SUCCESS == ret)
|
||||
{
|
||||
// sprintf(Cmd, "tar -xjvf %s -C %s", SF_CAM_UP_FILE_PATH, SF_SD_ROOT);
|
||||
|
@ -1539,7 +1565,7 @@ SINT32 sf_camera_ota_ftp(void)
|
|||
sf_log_error_code(logStr);
|
||||
}
|
||||
}
|
||||
|
||||
free(strg_path);
|
||||
MLOGD(" end ret:[0x%08X]\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1774,6 +1800,13 @@ SINT32 sf_hd_ftp_send(void)
|
|||
UINT8 timeoutCnt = 0;
|
||||
double elapsed_time = 0;
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
sf_set_send_hd(0);
|
||||
sf_custom_str_get(CamNameStr);
|
||||
sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel);
|
||||
|
@ -1788,8 +1821,8 @@ SINT32 sf_hd_ftp_send(void)
|
|||
while((sf_app_while_flag()) && (((piccount) < SendFileTotal)) && ((pPara->GprsMode == 1) || ((pSifarPara->subscribeSendCnt < SUBSCRIBE_SEND_MAX_NUM) && (pPara->GprsMode != 1))))
|
||||
{
|
||||
snprintf((char *)ftpFileName, sizeof(ftpFileName), "W%03d%04d.JPG", fileCfg->stfileattr[piccount].dirKey, fileCfg->stfileattr[piccount].fileKey);
|
||||
snprintf((char *)filePath, sizeof(filePath), "%s/%s", SF_HD_DIR, ftpFileName);
|
||||
|
||||
snprintf((char *)filePath, sizeof(filePath), "%s%s/%s", strg_path, SF_HD_DIR, ftpFileName);
|
||||
free(strg_path);
|
||||
sf_set_del_flag(FALSE);
|
||||
ret1 = SF_SUCCESS;//sf_quectel_upload_file_to_module(filePath, ftpFileName);
|
||||
|
||||
|
@ -1933,13 +1966,20 @@ UINT32 sf_video_find_file(UINT16 dirKey, UINT16 fileKey, UINT8 *destFname)
|
|||
char fname[50] = {0};
|
||||
//UINT8 srcFname[50] = {0};
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
fileIndex = dirKey * 10000 + fileKey + 1;
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
dirKey = fileIndex / 10000;
|
||||
fileKey = fileIndex % 10000;
|
||||
SF_SPRINTF(fname, "%s/%03dMEDIA/%s%04d.MP4", SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey);
|
||||
SF_SPRINTF(fname, "%s%s/%03dMEDIA/%s%04d.MP4", strg_path, SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey);
|
||||
|
||||
//fileSize = sf_get_file_size(fname);
|
||||
sf_file_size_get(fname,&fileSize);
|
||||
|
@ -1952,6 +1992,7 @@ UINT32 sf_video_find_file(UINT16 dirKey, UINT16 fileKey, UINT8 *destFname)
|
|||
}
|
||||
fileIndex++;
|
||||
}
|
||||
free(strg_path);
|
||||
return fileSize;
|
||||
}
|
||||
/*************************************************
|
||||
|
@ -2252,7 +2293,14 @@ SINT32 sf_low_power_warn_send_ftp(void)
|
|||
}
|
||||
MLOGD("start\n");
|
||||
|
||||
sprintf((char *)filePath, "%s", SF_LOW_POWER_WARN_FILENAME);
|
||||
char *file_path = sf_root_path_strcat(SF_LOW_POWER_WARN_FILENAME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
sprintf((char *)filePath, "%s", file_path);
|
||||
|
||||
sf_custom_str_get(customStr);
|
||||
sprintf((char *)uploadFname, "%s-%s-btalarm.txt",pPara->ModuleImei, customStr);
|
||||
|
@ -2270,6 +2318,7 @@ SINT32 sf_low_power_warn_send_ftp(void)
|
|||
}
|
||||
MLOGD(" end ret:[0x%08X]\n", ret);
|
||||
//printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret);
|
||||
free(file_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1980,7 +1980,14 @@ void sf_hd_pic_add_to_list(UINT8 *fileName)
|
|||
SF_STRNCPY(tempStr, fileName+1, 3);
|
||||
dirKey = atoi((const char *)tempStr);
|
||||
fileKey = atoi((const char *)fileName+4);
|
||||
SF_SPRINTF(fname, "%s/%03dMEDIA/%s%04d.JPG", SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey);
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return;
|
||||
}
|
||||
SF_SPRINTF(fname, "%s%s/%03dMEDIA/%s%04d.JPG", strg_path, SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey);
|
||||
free(strg_path);
|
||||
if(sf_file_IsExsit(fname) != SF_TRUE)
|
||||
{
|
||||
MLOGE("%s\n", fname);
|
||||
|
@ -2032,17 +2039,28 @@ void sf_hd_pic_list_print(void)
|
|||
UINT8 i = 0;
|
||||
//int fd = 0;
|
||||
struct stat st_buffer;
|
||||
char hd_dir[64] = {'\0'};
|
||||
//char sendListName[64] = {0};
|
||||
//char buff[SF_SEND_LIST_ITEM_LENGTH+1] = {0};
|
||||
SubImgList_t *pList = pSubImgListHead->pNext;
|
||||
printf("[%s:%d] print list:\n", __FUNCTION__, __LINE__);
|
||||
SF_HDFILE_ATTR_S* fileCfg = sf_file_hd_cfg_get();
|
||||
|
||||
if (stat(SF_HD_DIR, &st_buffer) == 0 && S_ISDIR(st_buffer.st_mode)) {
|
||||
printf("%s exists\n", SF_HD_DIR);
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(hd_dir, sizeof(hd_dir), "%s%s", strg_path, SF_HD_DIR);
|
||||
free(strg_path);
|
||||
|
||||
if (stat(hd_dir, &st_buffer) == 0 && S_ISDIR(st_buffer.st_mode)) {
|
||||
printf("%s exists\n", hd_dir);
|
||||
}
|
||||
else{
|
||||
if (mkdir(SF_HD_DIR, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
|
||||
if (mkdir(hd_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
|
||||
printf("Failed to create directory");
|
||||
}
|
||||
}
|
||||
|
@ -2101,6 +2119,13 @@ void sf_video_add_to_list(UINT8 *fileName)
|
|||
UINT16 fileKeytmp = 0;
|
||||
printf("add to list:%s\n", fileName);
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return;
|
||||
}
|
||||
|
||||
SF_STRNCPY(tempStr, fileName+1, 3);
|
||||
dirKey = atoi((const char *)tempStr);
|
||||
fileKey = atoi((const char *)fileName+4);
|
||||
|
@ -2111,7 +2136,8 @@ void sf_video_add_to_list(UINT8 *fileName)
|
|||
{
|
||||
dirKeytmp = fileIndex / 10000;
|
||||
fileKeytmp = fileIndex % 10000;
|
||||
SF_SPRINTF(fname, "%s/%03dMEDIA/%s%04d.MP4", SF_DCIM_DIR, dirKeytmp, DCF_FILE_NAME, fileKeytmp);
|
||||
SF_SPRINTF(fname, "%s%s/%03dMEDIA/%s%04d.MP4", strg_path, SF_DCIM_DIR, dirKeytmp, DCF_FILE_NAME, fileKeytmp);
|
||||
free(strg_path);
|
||||
sf_file_size_get(fname,&fileSize);
|
||||
printf("find video:%s size=%d\n", fname, fileSize);
|
||||
|
||||
|
|
|
@ -144,6 +144,8 @@ int main(int argc, char *argv[])
|
|||
sf_com_message_app_init();
|
||||
sf_com_message_cardv_init();
|
||||
|
||||
//init stroage_dev struct
|
||||
sf_strg_dev_init();
|
||||
//app_led_group_register();
|
||||
app_message_recv_start();
|
||||
|
||||
|
@ -259,6 +261,9 @@ int main(int argc, char *argv[])
|
|||
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
}*/
|
||||
|
||||
//init stroage_dev struct
|
||||
sf_strg_dev_uninit();
|
||||
|
||||
ftp_manager_uninit();
|
||||
sf_share_mem_file_deinit();
|
||||
sf_share_mem_customer_deinit();
|
||||
|
|
|
@ -415,6 +415,12 @@ static SINT32 process_cmd_shortclick(SF_MESSAGE_BUF_S *pMessageBuf)
|
|||
}
|
||||
static SINT32 process_cmd_longclick(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
char *file_path = sf_root_path_strcat("EG95");
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
switch(pMessageBuf->arg2) {
|
||||
case SF_KEY_PIN_RESET:
|
||||
|
||||
|
@ -426,15 +432,22 @@ static SINT32 process_cmd_longclick(SF_MESSAGE_BUF_S *pMessageBuf)
|
|||
break;
|
||||
}
|
||||
MLOGI("BatRemainCap = [%d]\n", sf_statistics_param_get()->BatRemainCap);
|
||||
if((access("/mnt/sd/EG95", F_OK) == 0) && (sf_statistics_param_get()->BatRemainCap > 40))
|
||||
if((access(file_path, F_OK) == 0) && (sf_statistics_param_get()->BatRemainCap > 40))
|
||||
{
|
||||
MLOGI("eg95\n");
|
||||
bmoduleupdate = 1;
|
||||
if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY)
|
||||
sf_led_event_process(LED_STATUS_QUICKFLASH_ON,LED_GROUP_SD,LED_TYPE_GREEN);
|
||||
system("/usr/bin/QFirehose -f /mnt/sd/EG95");
|
||||
if(strcmp(file_path, "/mnt/sd/EG95") == 0)
|
||||
{
|
||||
system("/usr/bin/QFirehose -f /mnt/sd/EG95");
|
||||
}
|
||||
else
|
||||
{
|
||||
system("/usr/bin/QFirehose -f /mnt/sd2/EG95");
|
||||
}
|
||||
free(file_path);
|
||||
app_system_poweroff(SF_POWEROFF_REBOOT);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -588,172 +601,139 @@ static SINT32 sf_app_process_cmd_keyctrl(SF_MESSAGE_BUF_S *pMessageBuf)
|
|||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
static SINT32 sf_app_process_cmd_SD(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
|
||||
static SINT32 sfStrgDevOnActionMount(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
//static SINT8 bsdstatus = 0;
|
||||
//static SINT8 bsdoutstatus = 0;
|
||||
UINT32 status;
|
||||
SINT16 startup = sf_poweron_type_get();
|
||||
SINT16 startup = sf_poweron_type_get();
|
||||
UINT32 status = 0;
|
||||
status = pMessageBuf->arg3;
|
||||
switch (status)
|
||||
{
|
||||
case FST_STA_OK:
|
||||
sf_set_card(1);
|
||||
sf_sd_status_set(SF_SD_OK);
|
||||
|
||||
MLOGD("[dev_id:%d,evt:%s]\n",pMessageBuf->arg2,app_process_SD_getstatusstring(pMessageBuf->arg1));
|
||||
if(SF_MCU_STARTUP_ONKEY == startup)
|
||||
{
|
||||
SF_STORE_ATTR_S storeattrs = {0};
|
||||
sf_sd_info_get(&storeattrs);
|
||||
printf("SD free=%dM/%dM\n", storeattrs.SDFree, storeattrs.SDTotalSize);
|
||||
if (storeattrs.SDFree < 30) /* 30MB */
|
||||
{
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_NORMAL);
|
||||
}
|
||||
}
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
MLOGI("card-%d mount OK\r\n", pMessageBuf->arg2 + 1);
|
||||
sf_set_key_fw_update(sf_get_fw_update());//up fw
|
||||
if(sf_get_mcu_update_flag())//up mcu
|
||||
{
|
||||
sf_app_mcu_updata_start();
|
||||
}
|
||||
break;
|
||||
case FST_STA_DISK_UNFORMAT:
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
MLOGI("^Rcard-%d mount FAIL: Unformat\r\n", pMessageBuf->arg2 + 1);
|
||||
break;
|
||||
case FST_STA_DISK_UNKNOWN_FORMAT:
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL);
|
||||
MLOGI("^Rcard-%d mount FAIL: Unknown Format\r\n", pMessageBuf->arg2 + 1);
|
||||
break;
|
||||
case FST_STA_CARD_ERR:
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR);
|
||||
MLOGI("^Rcard-%d mount FAIL: Card Error\r\n", pMessageBuf->arg2 + 1);
|
||||
break;
|
||||
default:
|
||||
MLOGI("^Rcard-%d mount FAIL: ErrID=%d\r\n", pMessageBuf->arg2 + 1, status);
|
||||
break;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
static SINT32 sfStrgDevSdHandler(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
switch(pMessageBuf->arg1)
|
||||
{
|
||||
case CMD_SD_STRG_CB_UNKNOWN:
|
||||
case CMD_SD_STRG_CB_UNKNOWN:
|
||||
sf_set_card_full(1);
|
||||
break;
|
||||
case CMD_SD_STRG_CB_INSERTED:
|
||||
sf_set_card(1);
|
||||
break;
|
||||
case CMD_SD_STRG_CB_REMOVED:
|
||||
sf_set_card(0);
|
||||
sf_sd_status_set(SF_SD_OUT);
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR);
|
||||
break;
|
||||
case CMD_SD_STRG_CB_MOUNT_FINISH:
|
||||
sfStrgDevOnActionMount(pMessageBuf->arg3);
|
||||
break;
|
||||
case CMD_SD_STRG_CB_UNMOUNT_FINISH:
|
||||
sf_set_card(0);
|
||||
sf_sd_status_set(SF_SD_OUT);
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR);
|
||||
MLOGI("CMD_SD_STRG_CB_UNMOUNT_FINISH\r\n");
|
||||
break;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
static SINT32 sfStrgDevEmmcHandler(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
switch(pMessageBuf->arg1)
|
||||
{
|
||||
case CMD_SD_STRG_CB_UNKNOWN:
|
||||
sf_set_card_full(1);
|
||||
break;
|
||||
case CMD_SD_STRG_CB_INSERTED:
|
||||
sf_set_card(1);
|
||||
// sf_sd_status_set(SF_SD_OK);
|
||||
break;
|
||||
case CMD_SD_STRG_CB_REMOVED:
|
||||
sf_set_card(0);
|
||||
sf_sd_status_set(SF_SD_OUT);
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR);
|
||||
break;
|
||||
|
||||
case CMD_SD_STRG_CB_MOUNT_FINISH:
|
||||
|
||||
status = pMessageBuf->arg3;
|
||||
switch (status)
|
||||
{
|
||||
case FST_STA_OK:
|
||||
sf_set_card(1);
|
||||
sf_sd_status_set(SF_SD_OK);
|
||||
|
||||
if(SF_MCU_STARTUP_ONKEY == startup)
|
||||
{
|
||||
SF_STORE_ATTR_S storeattrs = {0};
|
||||
sf_sd_info_get(&storeattrs);
|
||||
printf("SD free=%dM/%dM\n", storeattrs.SDFree, storeattrs.SDTotalSize);
|
||||
if (storeattrs.SDFree < 30) /* 30MB */
|
||||
{
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
MLOGI("card-%d mount OK\r\n", pMessageBuf->arg2 + 1);
|
||||
|
||||
sf_set_key_fw_update(sf_get_fw_update());//up fw
|
||||
|
||||
if(sf_get_mcu_update_flag())//up mcu
|
||||
{
|
||||
sf_app_mcu_updata_start();
|
||||
}
|
||||
break;
|
||||
case FST_STA_DISK_UNFORMAT:
|
||||
//sf_set_card(1);
|
||||
//sf_sd_status_set(SF_SD_OK);
|
||||
//sf_sys_status_led_set(SF_LED_SYS_STATE_SD_NORMAL);
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
MLOGI("^Rcard-%d mount FAIL: Unformat\r\n", pMessageBuf->arg2 + 1);
|
||||
break;
|
||||
case FST_STA_DISK_UNKNOWN_FORMAT:
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL);
|
||||
MLOGI("^Rcard-%d mount FAIL: Unknown Format\r\n", pMessageBuf->arg2 + 1);
|
||||
break;
|
||||
case FST_STA_CARD_ERR:
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR);
|
||||
MLOGI("^Rcard-%d mount FAIL: Card Error\r\n", pMessageBuf->arg2 + 1);
|
||||
break;
|
||||
default:
|
||||
MLOGI("^Rcard-%d mount FAIL: ErrID=%d\r\n", pMessageBuf->arg2 + 1, status);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
sfStrgDevOnActionMount(pMessageBuf->arg3);
|
||||
break;
|
||||
case CMD_SD_STRG_CB_UNMOUNT_FINISH:
|
||||
sf_set_card(0);
|
||||
sf_sd_status_set(SF_SD_OUT);
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR);
|
||||
MLOGI("CMD_SD_STRG_CB_UNMOUNT_FINISH\r\n");
|
||||
break;
|
||||
case CMD_SD_SYSTEM_CB_CONFIG:
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static SINT32 sf_app_process_cmd_SD(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
MLOGD("[dev_id:%d,evt:%s]\n",pMessageBuf->arg2,app_process_SD_getstatusstring(pMessageBuf->arg1));
|
||||
|
||||
if(pMessageBuf->arg2 == MMC_DEV_SD)
|
||||
{
|
||||
sfStrgDevSdHandler(pMessageBuf);
|
||||
}
|
||||
else if(pMessageBuf->arg2 == MMC_DEV_EMMC)
|
||||
{
|
||||
sfStrgDevEmmcHandler(pMessageBuf);
|
||||
}
|
||||
|
||||
switch(pMessageBuf->arg1)
|
||||
{
|
||||
case CMD_SD_SYSTEM_CB_CONFIG:
|
||||
break;
|
||||
case CMD_SD_FULL:
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR);
|
||||
MLOGI("CMD_SD_FULL\r\n");
|
||||
sf_set_card_full(1);
|
||||
sf_sd_status_set(SF_SD_FULL);
|
||||
/*sf_sd_status_set(SF_SD_FULL);
|
||||
if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) {
|
||||
if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get()))
|
||||
sf_led_event_process(LED_STATUS_HOLD_ON,LED_GROUP_SD,LED_TYPE_YELLOW);
|
||||
}
|
||||
|
||||
if(!bsdstatus) {
|
||||
bsdstatus = 1;
|
||||
|
||||
sf_upgrade_ota_param_recover();
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
app_system_param_update();
|
||||
if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) {
|
||||
app_t110();
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
/*case CMD_SD_MOUNT_SUCCESS:
|
||||
sf_sd_status_set(SF_SD_OK);
|
||||
if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) {
|
||||
if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get()))
|
||||
sf_led_event_process((sf_customer_param_get()->DebugMode?LED_STATUS_SLOWFLASH_ON:LED_STATUS_HOLD_ON),LED_GROUP_SD,LED_TYPE_GREEN);
|
||||
}
|
||||
if(!bsdstatus) {
|
||||
bsdstatus = 1;
|
||||
sf_upgrade_ota_param_recover();
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
app_system_param_update();
|
||||
if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) {
|
||||
app_t110();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CMD_SD_ERROR:
|
||||
sf_sd_status_set(SF_SD_ERROR);
|
||||
if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) {
|
||||
if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get()))
|
||||
sf_led_event_process(LED_STATUS_HOLD_ON,LED_GROUP_SD,LED_TYPE_YELLOW);
|
||||
}
|
||||
|
||||
if(!bsdstatus) {
|
||||
sf_statistics_param_reset(sf_statistics_param_get());
|
||||
app_system_param_update();
|
||||
if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) {
|
||||
app_t110();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_SD_MOUNT_FAILURE:
|
||||
case CMD_SD_OUT:
|
||||
sf_sd_status_set(SF_SD_OUT);
|
||||
if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) {
|
||||
if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get()))
|
||||
sf_led_event_process(LED_STATUS_HOLD_ON,LED_GROUP_SD,LED_TYPE_RED);
|
||||
}
|
||||
|
||||
if((sf_poweron_type_get() == SF_MCU_STARTUP_PIR) || (sf_poweron_type_get() == SF_MCU_STARTUP_TIMELAPSE))
|
||||
{
|
||||
app_system_poweroff(SF_POWEROFF_NO_SD);
|
||||
}
|
||||
if((!bsdoutstatus) && (!bsdstatus)) {
|
||||
sf_statistics_param_reset(sf_statistics_param_get());
|
||||
app_system_param_update();
|
||||
bsdoutstatus = 1;
|
||||
if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) {
|
||||
app_t110();
|
||||
}
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case CMD_SD_FORMAT:
|
||||
sf_set_card_statu(pMessageBuf->arg2);
|
||||
break;
|
||||
case CMD_SD_STRG_WORKABLE_DEV:
|
||||
sf_strg_dev_register(pMessageBuf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -153,6 +153,12 @@ SF_BOOL app_disconnect_4g_module(void) {
|
|||
#if SF_QLOG_ENABLE
|
||||
static SINT16 app_Qlog_procress(void) {
|
||||
SINT16 s32ret = SF_SUCCESS;
|
||||
char *file_path = sf_root_path_strcat(QLOG_PATH);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
char qlogPath[128] = {0};
|
||||
char qlogDirCmd[128] = {0};
|
||||
|
@ -161,19 +167,20 @@ static SINT16 app_Qlog_procress(void) {
|
|||
if(SF_FAILURE == sf_check_sd())
|
||||
{
|
||||
MLOGE("ERROR sf_check_sd\n");
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
time(&timep);
|
||||
p = gmtime(&timep);
|
||||
if (access("/mnt/sd/qlog", F_OK) != 0) {
|
||||
s32ret = mkdir("/mnt/sd/qlog", S_IRWXU);
|
||||
if (access(file_path, F_OK) != 0) {
|
||||
s32ret = mkdir(file_path, S_IRWXU);
|
||||
if (s32ret != 0)
|
||||
return s32ret;
|
||||
}
|
||||
sprintf(qlogPath, "%04d%02d%02d%02d%02d%02d", p->tm_year + 1900,
|
||||
p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec);
|
||||
sprintf(qlogDirCmd, "/usr/bin/QLog -s %s%s &", QLOG_PATH, qlogPath);
|
||||
sprintf(qlogDirCmd, "/usr/bin/QLog -s %s%s%s &", file_path, qlogPath);
|
||||
MLOGD("%s\n", qlogDirCmd);
|
||||
s32ret = system(qlogDirCmd);
|
||||
while (sf_app_while_flag())
|
||||
|
@ -187,6 +194,7 @@ static SINT16 app_Qlog_procress(void) {
|
|||
s32ret = system("killall QLog");
|
||||
QlogTsk.IsRun = 0;
|
||||
MLOGI("exit QlogTsk.IsRun:%d\n", QlogTsk.IsRun);
|
||||
free(file_path);
|
||||
return s32ret;
|
||||
}
|
||||
|
||||
|
@ -874,6 +882,7 @@ SINT16 sf_thumb_file_creat(void) {
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
SF_SRCFILE_ATTR_S *fileCfg = sf_file_thumb_cfg_get();
|
||||
|
@ -898,7 +907,7 @@ SINT16 sf_thumb_file_creat(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(strg_path);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2059,13 +2068,20 @@ SINT32 sf_app_to_cardv_hd_ture(void) {
|
|||
SINT32 s32ret = SF_FAILURE;
|
||||
MLOGI(" falg:%d\n",falg);
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
char sendHDName[64] = {0};
|
||||
if(falg)
|
||||
{
|
||||
return falg;
|
||||
}
|
||||
falg = 1;
|
||||
snprintf(sendHDName, sizeof(sendHDName), "%s", SF_HD_DIR);
|
||||
snprintf(sendHDName, sizeof(sendHDName), "%s%s", strg_path, SF_HD_DIR);
|
||||
|
||||
if(sf_file_IsExsit((CHAR *)sendHDName) != SF_TRUE)
|
||||
{
|
||||
|
|
|
@ -1623,8 +1623,14 @@ void* sf_app_mcu_updata_thread(void *arg)
|
|||
MLOGI("MCU_UPGRADE\n");
|
||||
UINT32 McuFsize = 0;
|
||||
SINT8 ret = 0;
|
||||
ret = Fw_GetFirmwareSize((char*)"/mnt/sd/Mupgrade.bin", &McuFsize);
|
||||
if((sf_in_card_exist() == SF_TRUE) && (access("/mnt/sd/Mupgrade.bin", F_OK) == 0)
|
||||
|
||||
char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
ret = Fw_GetFirmwareSize(file_path, &McuFsize);
|
||||
if((sf_in_card_exist() == SF_TRUE) && (access(file_path, F_OK) == 0)
|
||||
&& (ret == 0) && (McuFsize > 1024) && (sf_is_enough_power_to_update() == SF_TRUE))
|
||||
{
|
||||
sf_set_mcu_update_flag(SF_TRUE);
|
||||
|
|
|
@ -942,18 +942,26 @@ UINT32 sf_create_dailyreport_file(void)
|
|||
char imageSize = 0;
|
||||
char videoSize = 0;
|
||||
/*Avoid New Card*/
|
||||
char *file_path = NULL;
|
||||
file_path = sf_root_path_strcat(SF_THUMB_DIR);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if (access(SF_THUMB_DIR, F_OK) == -1) {
|
||||
printf("%s directory does not exist. Creating...\n", SF_THUMB_DIR);
|
||||
if (access(file_path, F_OK) == -1) {
|
||||
printf("%s directory does not exist. Creating...\n", file_path);
|
||||
|
||||
if (mkdir(SF_THUMB_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) {
|
||||
if (mkdir(file_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) {
|
||||
perror("mkdir() error");
|
||||
} else {
|
||||
printf("%s directory created.\n", SF_THUMB_DIR);
|
||||
printf("%s directory created.\n", file_path);
|
||||
}
|
||||
} else {
|
||||
printf("%s directory exists.\n", SF_THUMB_DIR);
|
||||
printf("%s directory exists.\n", file_path);
|
||||
}
|
||||
free(file_path);
|
||||
//sf_create_thumb_dir();
|
||||
|
||||
if(SF_CAMID_ON == pPara->CamNameSwitch)
|
||||
|
@ -1280,14 +1288,20 @@ UINT32 sf_create_dailyreport_file(void)
|
|||
printf("szTmp2=%s\n",szTmp2);
|
||||
printf("cfgTmp:%s\n", cfgTmp);
|
||||
|
||||
if(sf_file_IsExsit(SF_DAILYREPORT_FILENAME) == SF_TRUE){
|
||||
sf_file_remove(SF_DAILYREPORT_FILENAME);
|
||||
file_path = sf_root_path_strcat(SF_DAILYREPORT_FILENAME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
if(sf_file_IsExsit(file_path) == SF_TRUE){
|
||||
sf_file_remove(file_path);
|
||||
}
|
||||
|
||||
fd = open(SF_DAILYREPORT_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
|
||||
fd = open(file_path, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
if(fd)
|
||||
{
|
||||
free(file_path);
|
||||
szTmpsize=SF_STRLEN(szTmp);
|
||||
//printf("szTmpsize=%d\n",szTmpsize);
|
||||
write(fd, szTmp, szTmpsize);
|
||||
|
@ -1298,10 +1312,15 @@ UINT32 sf_create_dailyreport_file(void)
|
|||
//printf("szTmpsize=%d\n",szTmpsize);
|
||||
write(fd, szTmp2, szTmpsize);
|
||||
|
||||
|
||||
if(sf_file_IsExsit(SF_ERROR_CODE) == SF_TRUE){
|
||||
size = sf_get_file_size((UINT8 *)SF_ERROR_CODE);
|
||||
fd1 = open(SF_ERROR_CODE, O_RDONLY, S_IRUSR | S_IWUSR);
|
||||
file_path = sf_root_path_strcat(SF_ERROR_CODE);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
if(sf_file_IsExsit(file_path) == SF_TRUE){
|
||||
size = sf_get_file_size((UINT8 *)file_path);
|
||||
fd1 = open(file_path, O_RDONLY, S_IRUSR | S_IWUSR);
|
||||
if(fd1)
|
||||
{
|
||||
//size = sp5kFsFileSizeGet(fd1);
|
||||
|
@ -1327,7 +1346,7 @@ UINT32 sf_create_dailyreport_file(void)
|
|||
ret = SUCCESS;
|
||||
close(fd);
|
||||
}
|
||||
|
||||
free(file_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1357,29 +1376,44 @@ UINT32 sf_create_low_power_warn_file(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
char *file_path = NULL;
|
||||
file_path = sf_root_path_strcat(SF_THUMB_DIR);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
/*Avoid New Card*/
|
||||
|
||||
if (access(SF_THUMB_DIR, F_OK) == -1) {
|
||||
printf("%s directory does not exist. Creating...\n", SF_THUMB_DIR);
|
||||
if (access(file_path, F_OK) == -1) {
|
||||
printf("%s directory does not exist. Creating...\n", file_path);
|
||||
|
||||
if (mkdir(SF_THUMB_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) {
|
||||
if (mkdir(file_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) {
|
||||
//perror("mkdir() error");
|
||||
} else {
|
||||
printf("%s directory created.\n", SF_THUMB_DIR);
|
||||
printf("%s directory created.\n", file_path);
|
||||
}
|
||||
} else {
|
||||
printf("%s directory exists.\n", SF_THUMB_DIR);
|
||||
printf("%s directory exists.\n", file_path);
|
||||
}
|
||||
free(file_path);
|
||||
|
||||
file_path = sf_root_path_strcat(SF_LOW_POWER_WARN_FILENAME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
if(sf_file_IsExsit(file_path) == SF_TRUE){
|
||||
sf_file_remove(file_path);
|
||||
}
|
||||
|
||||
if(sf_file_IsExsit(SF_LOW_POWER_WARN_FILENAME) == SF_TRUE){
|
||||
sf_file_remove(SF_LOW_POWER_WARN_FILENAME);
|
||||
}
|
||||
|
||||
fd = open(SF_LOW_POWER_WARN_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
fd = open(file_path, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
|
||||
if(!fd)
|
||||
{
|
||||
fd = open(SF_LOW_POWER_WARN_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
fd = open(file_path, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
}
|
||||
|
||||
if(fd)
|
||||
|
@ -1409,7 +1443,7 @@ UINT32 sf_create_low_power_warn_file(void)
|
|||
if(ret <0)
|
||||
{
|
||||
close(fd);
|
||||
sf_file_remove(SF_LOW_POWER_WARN_FILENAME);
|
||||
sf_file_remove(file_path);
|
||||
printf("write low power warn file failed!,ret:%d\n",ret);
|
||||
ret = FAIL;
|
||||
}
|
||||
|
@ -1420,7 +1454,7 @@ UINT32 sf_create_low_power_warn_file(void)
|
|||
ret = SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
free(file_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1456,6 +1490,7 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1482,7 +1517,7 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
|
|||
}
|
||||
}
|
||||
closedir(dirp);
|
||||
|
||||
free(strg_path);
|
||||
printf("no update file\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1509,13 +1544,20 @@ UINT8 sf_get_send_file_list(char *sendfileList, UINT8 *fileTotal)
|
|||
char *pFileHasSend = NULL;
|
||||
UINT32 fileOffset = 0;
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if(0 == pPara->SendType){
|
||||
snprintf(sendListName, sizeof(sendListName), "%s", SF_THUMB_SEND_AUTO);
|
||||
snprintf(sendListName, sizeof(sendListName), "%s%s", strg_path, SF_THUMB_SEND_AUTO);
|
||||
}else {
|
||||
snprintf(sendListName, sizeof(sendListName), "%s", SF_THUMB_SEND_LIST);
|
||||
snprintf(sendListName, sizeof(sendListName), "%s%s", strg_path, SF_THUMB_SEND_LIST);
|
||||
}
|
||||
sf_file_size_get(sendListName, &fsize);
|
||||
|
||||
free(strg_path);
|
||||
fd = fopen(sendListName,"r");
|
||||
if(fd == 0)
|
||||
{
|
||||
|
@ -1601,6 +1643,13 @@ BOOL sf_check_auto_thumb_file(VOID)
|
|||
|
||||
char tmp[64] = {'\0'};
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SF_SRCFILE_ATTR_S* fileCfg = sf_file_thumb_cfg_get();
|
||||
if(0 == puiPara->SendType){
|
||||
snprintf(tmp, sizeof(tmp), "%s", SF_THUMB_SEND_AUTO);
|
||||
|
@ -1620,14 +1669,16 @@ BOOL sf_check_auto_thumb_file(VOID)
|
|||
fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_SMALL;
|
||||
}
|
||||
snprintf(fileCfg->stfileattr[fileIndex].thumbfileName, sizeof(fileCfg->stfileattr[fileIndex].thumbfileName), "%s", &SendFileList[fileIndex][1]);
|
||||
snprintf(fileCfg->stfileattr[fileIndex].thumbfilePath, sizeof(fileCfg->stfileattr[fileIndex].thumbfilePath), "%s%s", SF_SEND_LIST_DIR, &SendFileList[fileIndex][1]);
|
||||
printf("%s:%d thumbfileSize:%d thumbfileName:%s thumbfilePath:%s\n", __FUNCTION__, __LINE__,fileCfg->stfileattr[fileIndex].thumbfileSize,fileCfg->stfileattr[fileIndex].thumbfileName,fileCfg->stfileattr[fileIndex].thumbfilePath);
|
||||
snprintf(fileCfg->stfileattr[fileIndex].thumbfilePath, sizeof(fileCfg->stfileattr[fileIndex].thumbfilePath), "%s%s%s", strg_path, SF_SEND_LIST_DIR,
|
||||
&SendFileList[fileIndex][1]);
|
||||
printf("%s:%d thumbfileSize:%d thumbfileName:%s thumbfilePath:%s\n", __FUNCTION__, __LINE__,
|
||||
fileCfg->stfileattr[fileIndex].thumbfileSize,fileCfg->stfileattr[fileIndex].thumbfileName,fileCfg->stfileattr[fileIndex].thumbfilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("%s:%d e \n", __FUNCTION__, __LINE__);
|
||||
|
||||
free(strg_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1899,10 +1950,16 @@ UINT8 sf_save_sd_log(void)
|
|||
void sf_log_error_code(char* buff)
|
||||
{
|
||||
UINT32 fd = 0;
|
||||
char *file_path = sf_root_path_strcat(SF_ERROR_CODE);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return;
|
||||
}
|
||||
|
||||
if(sf_in_card_exist())
|
||||
{
|
||||
fd = open(SF_ERROR_CODE, O_WRONLY | O_CREAT);
|
||||
fd = open(file_path, O_WRONLY | O_CREAT);
|
||||
if(fd)
|
||||
{
|
||||
lseek(fd, 0, SEEK_END);
|
||||
|
@ -1911,6 +1968,7 @@ void sf_log_error_code(char* buff)
|
|||
system("sync");
|
||||
}
|
||||
}
|
||||
free(file_path);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "sf_fileMng.h"
|
||||
#include "sf_common.h"
|
||||
#include "sf_battery.h"
|
||||
#include "sf_storeMng.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
@ -313,6 +315,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -328,7 +331,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S
|
|||
MLOGD("FileName:%s, fileKey:%d\n", fileName, fileKey);
|
||||
for(int i=0; i<SF_VIDEO_LOOP_NUM;i++)
|
||||
{
|
||||
sprintf(filePath, "%s%s", SF_4G_SMALL_VIDEO_STREAM_PATH,fileName );
|
||||
sprintf(filePath, "%s%s%s", strg_path, SF_4G_SMALL_VIDEO_STREAM_PATH,fileName );
|
||||
MLOGD("srcFile:%s\n", filePath);
|
||||
pstfileAttr->enFileTye = SF_FILE_TYPE_VIDEO;
|
||||
ret = sf_file_IsExsit((CHAR*)filePath);
|
||||
|
@ -381,7 +384,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S
|
|||
MLOGE("CMD[%d] no process!!!\n",pSubscribe->subscribeType);
|
||||
}
|
||||
|
||||
|
||||
free(strg_path);
|
||||
if(ret != SF_TRUE)
|
||||
return SF_FILE_ERROR_NO_FILE;
|
||||
|
||||
|
@ -548,6 +551,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S*
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -634,7 +638,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S*
|
|||
SLOGD("CMD[%d] no process!!!\n", pSendFileAttr->enFileTye);
|
||||
}
|
||||
|
||||
|
||||
free(strg_path);
|
||||
if(ret != SF_TRUE)
|
||||
return SF_FILE_ERROR_NO_FILE;
|
||||
|
||||
|
|
|
@ -1283,14 +1283,21 @@ SINT32 sf_statistics_param_save(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam)
|
|||
UINT32 CheckSum = 0;
|
||||
SINT32 lenth = 0;
|
||||
|
||||
char *file_path = sf_root_path_strcat(SIFAR_STATISTICS_PARAM_PATH);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
lenth = sizeof(SF_PDT_PARAM_STATISTICS_S);
|
||||
|
||||
fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0);
|
||||
fd = open(file_path, O_CREAT|O_RDWR, 0);
|
||||
if(fd < 0) {
|
||||
fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0); /*open jpg file*/
|
||||
fd = open(file_path, O_CREAT|O_RDWR, 0); /*open jpg file*/
|
||||
if(fd < 0) {
|
||||
MLOGE("errno = [%d,%s]\n",errno,strerror(errno));
|
||||
SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,SIFAR_STATISTICS_PARAM_PATH,SF_FAILURE);
|
||||
SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,file_path,SF_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1304,7 +1311,7 @@ SINT32 sf_statistics_param_save(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam)
|
|||
MLOGE("save param failed!!!\n");
|
||||
fsync(fd);
|
||||
close(fd);
|
||||
|
||||
free(file_path);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1320,6 +1327,13 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam)
|
|||
static SINT32 loadFalg = 0;
|
||||
SF_PDT_PARAM_CFG_S *pSfCustomerPara = sf_customer_param_get();
|
||||
|
||||
char *file_path = sf_root_path_strcat(SIFAR_STATISTICS_PARAM_PATH);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if(loadFalg)
|
||||
return SF_SUCCESS;
|
||||
|
||||
|
@ -1335,9 +1349,9 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam)
|
|||
MLOGI("FirstUpdateFlag = [%d],First start!!!,reset all param \n",pSfCustomerPara->FirstUpdateFlag);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
if(access((char*)SIFAR_STATISTICS_PARAM_PATH, F_OK) == 0)
|
||||
if(access((char*)file_path, F_OK) == 0)
|
||||
{
|
||||
fd = open(SIFAR_STATISTICS_PARAM_PATH, O_RDWR);
|
||||
fd = open(file_path, O_RDWR);
|
||||
if(fd < 0) {
|
||||
|
||||
//SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
|
@ -1345,10 +1359,10 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam)
|
|||
//stMessageBuf.arg1 = 0;
|
||||
//sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
//usleep(500000);
|
||||
fd = open(SIFAR_STATISTICS_PARAM_PATH, O_RDWR); /*open jpg file*/
|
||||
fd = open(file_path, O_RDWR); /*open jpg file*/
|
||||
if(fd < 0) {
|
||||
MLOGE("errno = [%d,%s]\n",errno,strerror(errno));
|
||||
SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,SIFAR_STATISTICS_PARAM_PATH,SF_FAILURE);
|
||||
SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,file_path,SF_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1374,17 +1388,17 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam)
|
|||
}
|
||||
else
|
||||
{
|
||||
fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0);
|
||||
fd = open(file_path, O_CREAT|O_RDWR, 0);
|
||||
if(fd < 0) {
|
||||
//SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
//stMessageBuf.cmdId = 0x0113;
|
||||
///stMessageBuf.arg1 = 0;
|
||||
//sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
//usleep(500000);
|
||||
fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0); /*open jpg file*/
|
||||
fd = open(file_path, O_CREAT|O_RDWR, 0); /*open jpg file*/
|
||||
if(fd < 0) {
|
||||
MLOGE("errno = [%d,%s]\n",errno,strerror(errno));
|
||||
SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,SIFAR_STATISTICS_PARAM_PATH,SF_FAILURE);
|
||||
SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,file_path,SF_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1405,7 +1419,7 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam)
|
|||
MLOGD("SendPicDayCnt::%d\n", pStatisticsParam->SendPicDayCnt);
|
||||
//if(strlen(pStatisticsParam->WebIP) < 1)
|
||||
// sf_statistics_param_specify(pStatisticsParam);
|
||||
|
||||
free(file_path);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
void sf_all_param_reset(void)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "sf_base64.h"
|
||||
#include "sf_qrcode.h"
|
||||
#include "sf_4g_lpa.h"
|
||||
#include "sf_storeMng.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
@ -33,6 +34,7 @@ extern "C" {
|
|||
|
||||
|
||||
#define SIZE 6
|
||||
#define QR_CODE_NAME "QR.BMP"
|
||||
|
||||
static void strConv(char *p)
|
||||
{
|
||||
|
@ -82,18 +84,29 @@ static int sf_qrcode_encode(char *intext, int length, char *outfile)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SINT16 sf_qrcode_create(SF_CHAR *pIMEI,SF_CHAR *pSimID ,SF_CHAR* pVersion)
|
||||
{
|
||||
SINT16 ret = SF_SUCCESS;
|
||||
SF_CHAR qrsrc_Str[160] = { 0 };
|
||||
SF_CHAR qrdst_Str[160] = { 0 };
|
||||
|
||||
char *file_path = sf_root_path_strcat(QR_CODE_NAME);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if(strlen(pIMEI) == 0 ) {
|
||||
SLOGE("the current IEMI is null!!!\n");
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if(strlen(pVersion) == 0) {
|
||||
SLOGE("the current Version is null!!!\n");
|
||||
free(file_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
#if 0
|
||||
|
@ -112,9 +125,9 @@ SINT16 sf_qrcode_create(SF_CHAR *pIMEI,SF_CHAR *pSimID ,SF_CHAR* pVersion)
|
|||
sprintf(qrsrc_Str, "{\"imei\":\"%s\",\"verizonICCID\":\"%s\",\"attICCID\":\"%s\",\"isEsim\":%s}",
|
||||
puiPara->ModuleImei, puiPara->SimIccidV, puiPara->SimIccidA, sf_is_esim_card() == 1 ? "true" : "false");
|
||||
MLOGI("qrStr = %s\n",qrsrc_Str);
|
||||
sf_qrcode_encode(qrsrc_Str, strlen(qrsrc_Str), "/mnt/sd/QR.BMP");
|
||||
sf_qrcode_encode(qrsrc_Str, strlen(qrsrc_Str), file_path);
|
||||
MLOGI("QR.BMP have existed \n");
|
||||
|
||||
free(file_path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,33 @@ UINT32 gnFileIdx = 0;
|
|||
UINT32 gnDirIdx = 0;
|
||||
|
||||
static SF_SD_STATUS_E SdStatus = SF_SD_BUTT;
|
||||
SF_STRG_DEV *sf_strg_dev = NULL;
|
||||
|
||||
MMC_DEV_TYPE mmc_dev = MMC_DEV_NO;
|
||||
void sf_strg_dev_init(void)
|
||||
{
|
||||
sf_strg_dev = (SF_STRG_DEV *)malloc(sizeof(SF_STRG_DEV));
|
||||
sf_strg_dev->dev_type = MMC_DEV_NO;
|
||||
sf_strg_dev->node = MMC_DEV_NODE_STATE_NO;
|
||||
sf_strg_dev->moumted_state = MMC_DEV_MOUNT_STATE_NO;
|
||||
}
|
||||
|
||||
void sf_strg_dev_uninit(void)
|
||||
{
|
||||
free(sf_strg_dev);
|
||||
sf_strg_dev = NULL;
|
||||
}
|
||||
|
||||
void sf_strg_dev_register(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
sf_strg_dev->dev_type = pMessageBuf->arg1;
|
||||
sf_strg_dev->node = pMessageBuf->arg2;
|
||||
sf_strg_dev->moumted_state = pMessageBuf->arg3;
|
||||
}
|
||||
|
||||
MMC_DEV_TYPE sf_get_strg_dev(void)
|
||||
{
|
||||
return sf_strg_dev->dev_type;
|
||||
}
|
||||
|
||||
static SINT32 sd_file_Isexsit(SF_CHAR *fileName)
|
||||
{
|
||||
|
@ -78,31 +103,47 @@ static SINT32 sd_Isdirempty(char *dirname)
|
|||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
void sf_set_workable_strg_id(UINT32 strg_id)
|
||||
{
|
||||
mmc_dev = strg_id;
|
||||
}
|
||||
|
||||
MMC_DEV_TYPE sf_get_workable_strg_id(void)
|
||||
{
|
||||
return mmc_dev;
|
||||
}
|
||||
|
||||
char *sf_get_root_path(void)
|
||||
{
|
||||
char *strg_path = NULL;
|
||||
char *strg_path = NULL;
|
||||
MMC_DEV_TYPE mmc_dev = MMC_DEV_NO;
|
||||
|
||||
if(mmc_dev == MMC_DEV_NO)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
mmc_dev = sf_get_strg_dev();
|
||||
if (mmc_dev == MMC_DEV_NO)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(sf_get_workable_strg_id() == MMC_DEV_SD){
|
||||
strg_path = SF_SD_ROOT;
|
||||
}else if(sf_get_workable_strg_id() == MMC_DEV_EMMC){
|
||||
strg_path = SF_EMMC_ROOT;
|
||||
}
|
||||
return strg_path;
|
||||
if (mmc_dev == MMC_DEV_SD)
|
||||
{
|
||||
strg_path = (char *)malloc(strlen(SF_SD_ROOT) + 1);
|
||||
strcpy(strg_path, SF_SD_ROOT);
|
||||
}
|
||||
else if (mmc_dev == MMC_DEV_EMMC)
|
||||
{
|
||||
strg_path = (char *)malloc(strlen(SF_EMMC_ROOT) + 1);
|
||||
strcpy(strg_path, SF_EMMC_ROOT);
|
||||
}
|
||||
return strg_path;
|
||||
}
|
||||
|
||||
char *sf_root_path_strcat(char *path_name)
|
||||
{
|
||||
char *tmp = NULL;
|
||||
char *strg_path = sf_get_root_path();
|
||||
if (strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tmp = (char *)malloc(strlen(strg_path) + strlen(path_name) + 1);
|
||||
strcpy(tmp, strg_path);
|
||||
strcat(tmp, path_name);
|
||||
|
||||
free(strg_path); // 释放内存
|
||||
return tmp;
|
||||
}
|
||||
|
||||
SINT32 sf_sd_info_get(SF_STORE_ATTR_S *pstoreattrs)
|
||||
|
@ -112,6 +153,7 @@ SINT32 sf_sd_info_get(SF_STORE_ATTR_S *pstoreattrs)
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -121,7 +163,7 @@ SINT32 sf_sd_info_get(SF_STORE_ATTR_S *pstoreattrs)
|
|||
{
|
||||
struct statfs diskInfo;
|
||||
statfs(strg_path, &diskInfo);
|
||||
|
||||
free(strg_path);
|
||||
if(diskInfo.f_bsize > 1024)
|
||||
{
|
||||
pstoreattrs->SDTotalSize = (diskInfo.f_blocks * (diskInfo.f_bsize >> 10)) >> 10 ; //blocks * 4096 / 1024 /1024 = MB
|
||||
|
@ -444,16 +486,26 @@ SINT32 sf_sd_status_set(SF_SD_STATUS_E enStatus)
|
|||
UINT32 sf_delete_send_flie_list(void)
|
||||
{
|
||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||
char tmp[64] = {'\0'};
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(0 == puiPara->SendType){
|
||||
if(sf_file_IsExsit(SF_THUMB_SEND_AUTO) == SF_TRUE)
|
||||
sf_file_remove(SF_THUMB_SEND_AUTO);
|
||||
snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_THUMB_SEND_AUTO);
|
||||
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
||||
sf_file_remove(tmp);
|
||||
}
|
||||
else{
|
||||
snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_THUMB_SEND_LIST);
|
||||
printf("delete %s\n", SF_SEND_LIST_DIR);
|
||||
if(sf_file_IsExsit(SF_THUMB_SEND_LIST) == SF_TRUE)
|
||||
sf_file_remove(SF_THUMB_SEND_LIST);
|
||||
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
||||
sf_file_remove(tmp);
|
||||
}
|
||||
|
||||
free(strg_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -742,11 +794,13 @@ int sf_dcf_resort_min(void)
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
strcpy(sRootPath, strg_path); // "/mnt/sd/"
|
||||
strcat(sRootPath, SF_DCF_ROOT_DIR_NAME); // ""/mnt/sd/DCIM/"
|
||||
free(strg_path);
|
||||
|
||||
trave_dir(sRootPath,0);
|
||||
MLOGD("gnDirIdx:%d,gDirList:%d\n", gnDirIdx, gnDirList[gnDirIdx-1]);
|
||||
|
@ -819,6 +873,7 @@ int sf_app_sd_loop(void)
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -916,7 +971,7 @@ int sf_app_sd_loop(void)
|
|||
}
|
||||
|
||||
sync();
|
||||
|
||||
free(strg_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "sf_type.h"
|
||||
#include "sf_system.h"
|
||||
#include "sf_fileMng.h"
|
||||
#include "sf_storeMng.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
|
@ -45,7 +46,6 @@ extern "C" {
|
|||
|
||||
extern int gsfd;
|
||||
|
||||
#define UPGRADE_FIRMWARE_NANE (char*)"/mnt/sd/Mupgrade.bin"
|
||||
#define UART_PATH "dev/ttyS2"
|
||||
|
||||
//unsigned char mcu_upgrade_buf[32] = {0};
|
||||
|
@ -340,6 +340,13 @@ static void * FwUpgradeTask(void * argv)
|
|||
SINT8 param[1] = {0};
|
||||
param[0] = 0;
|
||||
|
||||
char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE);
|
||||
if(file_path == NULL)
|
||||
{
|
||||
free(file_path);
|
||||
return;
|
||||
}
|
||||
|
||||
while(FwUpgradeExit == 0)
|
||||
{
|
||||
switch (FwUpgradeState)
|
||||
|
@ -351,7 +358,7 @@ static void * FwUpgradeTask(void * argv)
|
|||
fw_packet.fw_total_size = 0;
|
||||
fw_packet.fw_remain_size = 0;
|
||||
fw_packet.fw_complete_size = 0;
|
||||
ret = Fw_GetFirmwareSize(UPGRADE_FIRMWARE_NANE, &fw_packet.fw_total_size);
|
||||
ret = Fw_GetFirmwareSize(file_path, &fw_packet.fw_total_size);
|
||||
|
||||
if(ret < 0)
|
||||
{
|
||||
|
@ -368,7 +375,7 @@ static void * FwUpgradeTask(void * argv)
|
|||
FwUpgradeState = FWUPGRADE_ERROR_OCCUR_STATE;
|
||||
break;
|
||||
}
|
||||
ret = Fw_GetFirmwareContent(UPGRADE_FIRMWARE_NANE, fw_packet.fw_content, fw_packet.fw_total_size);
|
||||
ret = Fw_GetFirmwareContent(file_path, fw_packet.fw_content, fw_packet.fw_total_size);
|
||||
fw_packet.fw_crc = sf_crc16_check(fw_packet.fw_content, fw_packet.fw_total_size);
|
||||
|
||||
if(sf_poweron_type_get() != 0x0f) /*at upgrade start mode already*/
|
||||
|
@ -521,6 +528,7 @@ static void * FwUpgradeTask(void * argv)
|
|||
|
||||
usleep(200000);
|
||||
}
|
||||
free(file_path);
|
||||
printf("ret is %d\r\n", ret);
|
||||
pthread_exit(NULL);
|
||||
|
||||
|
|
|
@ -159,11 +159,19 @@ void dataClientListPrint(void);
|
|||
static S32 sf_get_sd_info(UINT32 *pSDStatus, UINT32 *pSDFree, UINT32 *pSDTotalSize)
|
||||
{
|
||||
int fd = -1;
|
||||
fd = open(SD_PATH, O_RDONLY,0);
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
fd = open(strg_path, O_RDONLY,0);
|
||||
if(fd >= 0)
|
||||
{
|
||||
struct statfs diskInfo;
|
||||
statfs(SD_PATH, &diskInfo);
|
||||
statfs(strg_path, &diskInfo);
|
||||
/*printf("f_type=%ld\n", diskInfo.f_type);
|
||||
printf("f_bsize=%ld\n", diskInfo.f_bsize);
|
||||
printf("f_blocks=%ld\n", diskInfo.f_blocks);
|
||||
|
@ -204,7 +212,7 @@ static S32 sf_get_sd_info(UINT32 *pSDStatus, UINT32 *pSDFree, UINT32 *pSDTotalSi
|
|||
MLOGI("pSDStatus = %d\n", *pSDStatus);
|
||||
MLOGI("pSDFree = %d MB\n", *pSDFree);
|
||||
MLOGI("pSDTotalSize = %d MB\n", *pSDTotalSize);
|
||||
|
||||
free(strg_path);
|
||||
return *pSDStatus;
|
||||
}
|
||||
#if 0
|
||||
|
@ -416,22 +424,29 @@ S8 *appThumbKeyToName(thumbSize_t imgSize, thumbType_t fileType, UINT16 dirKey,
|
|||
}
|
||||
#endif
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if(imgSize == THUMB_320x240)
|
||||
{
|
||||
sprintf((char *)tempPath, "%s/small", THUMB_PATH);
|
||||
sprintf((char *)tempPath, "%s%s/small", strg_path, THUMB_PATH);
|
||||
sprintf((char *)path, "%s/%03d", tempPath, dirKey);
|
||||
}
|
||||
else if(imgSize == THUMB_1280x960)
|
||||
{
|
||||
sprintf((char *)tempPath, "%s/middle", THUMB_PATH);
|
||||
sprintf((char *)tempPath, "%s%s/middle", strg_path, THUMB_PATH);
|
||||
sprintf((char *)path, "%s/%03d", tempPath, dirKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf((char *)tempPath, "%s/large", THUMB_PATH);
|
||||
sprintf((char *)tempPath, "%s%s/large", strg_path, THUMB_PATH);
|
||||
sprintf((char *)path, "%s/%03d", tempPath, dirKey);
|
||||
}
|
||||
|
||||
free(strg_path);
|
||||
/****check floder and creat it if that is not exist ***start****/
|
||||
#if 0
|
||||
printf("Thumb key s");
|
||||
|
@ -720,6 +735,13 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
|
|||
|
||||
MLOGI("fileName:%s\n",fileName);
|
||||
|
||||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if(fileName != NULL && fileName[0] != '\0' && fileName[0] != '0' && (strstr((char *)fileName, SF_DCF_EXT_MOV) || strstr((char *)fileName, SF_DCF_EXT_PHOTO)))
|
||||
{
|
||||
MLOGI("fileName2:%s\n",fileName);
|
||||
|
@ -739,8 +761,8 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
|
|||
gDevFileListNums = 0;
|
||||
//printf("get dir s\n");
|
||||
//sprintf((char *)dirPath, "%s/", THUMB_PATH);
|
||||
snprintf((char *)dirPath, sizeof(dirPath), "%s", (char *)THUMB_PATH);
|
||||
|
||||
snprintf((char *)dirPath, sizeof(dirPath), "%s%s", strg_path, (char *)THUMB_PATH);
|
||||
free(strg_path);
|
||||
appsvr_getFileList(dirPath, startFileKey);
|
||||
// appsvr_getDirList(dirPath, startDirKey);
|
||||
|
||||
|
@ -817,6 +839,8 @@ void sf_app_Get_Camera_Info(MSG_DEV_INFO_Get_Rsp_T *camInfo)
|
|||
{
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
|
||||
|
||||
|
||||
MLOGI("camInfo:%x\n",camInfo->cmdRet);
|
||||
//MLOGI("[sf_app_Get_Camera_Info],sf_get_sifar_param\n");
|
||||
|
||||
|
@ -1113,6 +1137,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
|
|||
char *strg_path = sf_get_root_path();
|
||||
if(strg_path == NULL)
|
||||
{
|
||||
free(strg_path);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1348,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
|
|||
{
|
||||
strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.getHdFile.dirName);
|
||||
strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.getHdFile.dirName, 3);
|
||||
sprintf((char *)gFileName, "%s%s/%s", THUMB_PATH, tempbuf2, tempbuf);
|
||||
sprintf((char *)gFileName, "%s%s%s/%s", strg_path, THUMB_PATH, tempbuf2, tempbuf);
|
||||
}
|
||||
else if(pMsgStruct->msgBuf.getHdFile.type == 1) //srouce file
|
||||
{
|
||||
|
@ -1862,7 +1887,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
|
|||
//strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName);
|
||||
memcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName,strlen((char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName));
|
||||
|
||||
sprintf((char *)fileName, "%s%s", THUMB_PATH, tempbuf);
|
||||
sprintf((char *)fileName, "%s%s%s", strg_path, THUMB_PATH, tempbuf);
|
||||
|
||||
}
|
||||
else if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 1) //srouce file
|
||||
|
@ -1872,7 +1897,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
|
|||
|
||||
tempbuf[8] = '\0';
|
||||
sprintf((char *)fileName, "%sDCIM/%s%s/%s%s%s",
|
||||
SD_PATH,
|
||||
strg_path,
|
||||
tempbuf2,
|
||||
DCF_DIR_NAME,
|
||||
DCF_FILE_NAME,
|
||||
|
@ -2212,7 +2237,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
|
|||
printf("offset=%d\n",offset);
|
||||
}
|
||||
}
|
||||
|
||||
free(strg_path);
|
||||
return ntohs(pMsgStruct->cmd);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ SRC = \
|
|||
code/source/common/sf_sd_common.c \
|
||||
code/source/common/sf_common.c \
|
||||
code/source/common/sf_led.c \
|
||||
$(APP_DIR)/source/sf_app/code/source/storeMng/sf_storeMng.c \
|
||||
$(APP_DIR)/source/sf_app/code/source/logMng/sf_log.c \
|
||||
$(APP_DIR)/source/sf_app/code/source/qrcodeMng/sf_base64.c \
|
||||
$(APP_DIR)/source/sf_app/code/source/paramMng/sf_param_common.c \
|
||||
|
|
|
@ -2172,7 +2172,21 @@ void sf_file_thumb_cfg_sava(void)
|
|||
INT32 ret_fs = 0;
|
||||
FST_FILE_STATUS FileStat;
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
#if USE_MMC_DEV_CHECK
|
||||
|
||||
SF_ST_MMC_DEV *mmc_dev = SF_GetMMCDev();
|
||||
if(mmc_dev == NULL)
|
||||
{
|
||||
DBG_ERR("No MMC_Dev Can use!\n");
|
||||
return;
|
||||
}
|
||||
if(mmc_dev->dcf_handle < 0)
|
||||
{
|
||||
DBG_ERR("dcf_handle err!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (pThumbFileCfg != NULL) {
|
||||
|
||||
char sendListName[64] = {0};
|
||||
|
@ -2185,7 +2199,18 @@ void sf_file_thumb_cfg_sava(void)
|
|||
char tmp[64] = {'\0'};
|
||||
INT32 uiStatus = 0;
|
||||
UINT8 ucAttrib = 0;
|
||||
snprintf(tmp, sizeof(tmp), "%c%s", 'A', PHOTO_THUMB_PATH);
|
||||
#if USE_MMC_DEV_CHECK
|
||||
if(mmc_dev->dev_type == MMC_DEV_SD)
|
||||
{
|
||||
snprintf(tmp, sizeof(tmp), "%c%s", 'A', PHOTO_THUMB_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(tmp, sizeof(tmp), "%c%s", 'B', PHOTO_THUMB_PATH);
|
||||
}
|
||||
#else
|
||||
snprintf(tmp, sizeof(tmp), "%c%s", 'A', PHOTO_THUMB_PATH);
|
||||
#endif
|
||||
|
||||
uiStatus = FileSys_GetAttrib(tmp, &ucAttrib);
|
||||
if (uiStatus == FST_STA_OK) {
|
||||
|
@ -2195,8 +2220,10 @@ void sf_file_thumb_cfg_sava(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
//printf("Add %s to send.List\n", sendfname);
|
||||
if(0 == puiPara->SendType){
|
||||
#if USE_MMC_DEV_CHECK
|
||||
if(mmc_dev->dev_type == MMC_DEV_SD)
|
||||
{
|
||||
if(0 == puiPara->SendType){
|
||||
snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_AUTO);
|
||||
fs = FileSys_OpenFile(sendListName, FST_CREATE_ALWAYS | FST_OPEN_WRITE);
|
||||
|
||||
|
@ -2204,6 +2231,31 @@ void sf_file_thumb_cfg_sava(void)
|
|||
snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_LIST);
|
||||
fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(0 == puiPara->SendType){
|
||||
snprintf(sendListName, sizeof(sendListName), "B%s", SF_THUMB_SEND_AUTO);
|
||||
fs = FileSys_OpenFile(sendListName, FST_CREATE_ALWAYS | FST_OPEN_WRITE);
|
||||
|
||||
}else {
|
||||
snprintf(sendListName, sizeof(sendListName), "B%s", SF_THUMB_SEND_LIST);
|
||||
fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(0 == puiPara->SendType){
|
||||
snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_AUTO);
|
||||
fs = FileSys_OpenFile(sendListName, FST_CREATE_ALWAYS | FST_OPEN_WRITE);
|
||||
|
||||
}else {
|
||||
snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_LIST);
|
||||
fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE);
|
||||
}
|
||||
#endif
|
||||
|
||||
//printf("Add %s to send.List\n", sendfname);
|
||||
|
||||
|
||||
/*if(access(sendListName, F_OK) == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user