From b95b5f9bbd8897ea8fca1330dc0f434261e13772 Mon Sep 17 00:00:00 2001 From: xiehongyan Date: Wed, 17 Jan 2024 08:45:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=8F=98=E7=81=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIFlowMenuCommonItemEventCallback.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c index 91b95d30a..c73cf15fc 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c @@ -54,6 +54,8 @@ static BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) { DIR *dirp = NULL; struct dirent *ptr = NULL; + UINT32 dcf_handle = (UINT32)System_Get_DCF_Handle(); /* 0:emmc 1:sd */ + char font = System_Get_DCF_Disk_Drive(dcf_handle) == 'B' ? 'B' : 'A'; UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); if ((dirp=opendir((char *)SF_SD_ROOT)) != NULL) @@ -66,7 +68,15 @@ static BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) { if(strncmp(ptr->d_name, puiPara->ModuleVer, 6) == 0) { - sprintf((char*)updateFname, "%s%s", "/mnt/sd/", ptr->d_name); + if(font == 'A') + { + sprintf((char*)updateFname, "%s%s", "/mnt/sd/", ptr->d_name); + + } + else + { + sprintf((char*)updateFname, "%s%s", "/mnt/sd2/", ptr->d_name); + } closedir(dirp); printf("[%s:%d] updateFname:%s\n", __FUNCTION__, __LINE__, updateFname); return TRUE; From 7b66e2beac1f84780e0c5aca9f17da1262ca7671 Mon Sep 17 00:00:00 2001 From: xiehongyan Date: Wed, 17 Jan 2024 13:45:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=8F=98=E7=81=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIFlowMenuCommonItemEventCallback.c | 51 ++++++++++++++----- .../sf_app/code/source/fileMng/sf_file.c | 2 +- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c index c73cf15fc..e4792ea55 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/UIFlowMenuCommonItemEventCallback.c @@ -12,6 +12,7 @@ #include #include #include "DCF.h" +#include "sf_storeMng.h" #define PAGE 32 #define PER_PAGE_NUM 5 @@ -52,33 +53,55 @@ void set_menu_changed(int value) } static BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) { + DIR *dirp = NULL; struct dirent *ptr = NULL; + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); + UINT32 dcf_handle = (UINT32)System_Get_DCF_Handle(); /* 0:emmc 1:sd */ char font = System_Get_DCF_Disk_Drive(dcf_handle) == 'B' ? 'B' : 'A'; - - UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); - if ((dirp=opendir((char *)SF_SD_ROOT)) != NULL) + if (font == 'B')// emmc { + dirp=opendir((char *)"/mnt/sd2/"); + } + else + { + dirp=opendir((char *)"/mnt/sd/"); + } + //char *strg_path = sf_get_root_path(); + //printf("[%s:%d]path: %s\n", __FUNCTION__, __LINE__, strg_path); + //if(strg_path == NULL) + //{ + // free(strg_path); + // return FALSE; + //} + + if (dirp != NULL) + { + //printf("[%s:%d] opendir success\n", __FUNCTION__, __LINE__); while ((ptr=readdir(dirp)) != NULL) { + //printf("[%s:%d] readdir success\n", __FUNCTION__, __LINE__); if(strcmp(ptr->d_name,".")==0 || strcmp(ptr->d_name,"..")==0) ///current dir OR parrent dir continue; else if(ptr->d_type == 4) ///dir { + //printf("[%s:%d] success strg_path:%s\n", __FUNCTION__, __LINE__, strg_path); + //printf("ptr->d_name: %s, puiPara->ModuleVer: %s\n", ptr->d_name, puiPara->ModuleVer); if(strncmp(ptr->d_name, puiPara->ModuleVer, 6) == 0) { - if(font == 'A') - { - sprintf((char*)updateFname, "%s%s", "/mnt/sd/", ptr->d_name); - - } - else + if (font == 'B')// emmc { sprintf((char*)updateFname, "%s%s", "/mnt/sd2/", ptr->d_name); } + else + { + sprintf((char*)updateFname, "%s%s", "/mnt/sd/", ptr->d_name); + } + //sprintf((char*)updateFname, "%s%s", strg_path, ptr->d_name); closedir(dirp); - printf("[%s:%d] updateFname:%s\n", __FUNCTION__, __LINE__, updateFname); + //free(strg_path); + printf("[%s:%d] success strg_path:%s\n", __FUNCTION__, __LINE__, updateFname); return TRUE; } } @@ -88,11 +111,13 @@ static BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) } } } + closedir(dirp); - - printf("no update file\n"); + //free(strg_path); + printf("[%s:%d]no update file\n", __FUNCTION__, __LINE__); return FALSE; } + static unsigned char gBattery = 0; #define UPGRADABLE 0 #define NOT_UPGRADABLE -1 @@ -109,7 +134,7 @@ static int is_camera_fw_upgrade(void) //if (gBattery < 40 || hFile == NULL) if (hFile == NULL) { - printf("[%s]sd card no update file\n", __FUNCTION__); + printf("[%s:%d]sd card no update file\n", __FUNCTION__, __LINE__); return NOT_UPGRADABLE; } else diff --git a/code/application/source/sf_app/code/source/fileMng/sf_file.c b/code/application/source/sf_app/code/source/fileMng/sf_file.c index 36d962269..94ebe5c40 100755 --- a/code/application/source/sf_app/code/source/fileMng/sf_file.c +++ b/code/application/source/sf_app/code/source/fileMng/sf_file.c @@ -1462,7 +1462,7 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) } closedir(dirp); free(strg_path); - printf("no update file\n"); + printf("[%s:%d]==no update file\n", __FUNCTION__, __LINE__); return FALSE; } /*************************************************