Merge branch 'Branch_S550_Fast_Emmc' of gitlab.sifar.tech:linux-em-group/s530-ntk into Branch_S550_Fast_Emmc

This commit is contained in:
payton 2024-01-17 14:35:18 +08:00
commit 609e4ae3a5
2 changed files with 43 additions and 8 deletions

View File

@ -12,6 +12,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include "DCF.h" #include "DCF.h"
#include "sf_storeMng.h"
#define PAGE 32 #define PAGE 32
#define PER_PAGE_NUM 5 #define PER_PAGE_NUM 5
@ -52,23 +53,55 @@ void set_menu_changed(int value)
} }
static BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) static BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
{ {
DIR *dirp = NULL; DIR *dirp = NULL;
struct dirent *ptr = NULL; struct dirent *ptr = NULL;
UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
if ((dirp=opendir((char *)SF_SD_ROOT)) != 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';
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) 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 if(strcmp(ptr->d_name,".")==0 || strcmp(ptr->d_name,"..")==0) ///current dir OR parrent dir
continue; continue;
else if(ptr->d_type == 4) ///dir 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(strncmp(ptr->d_name, puiPara->ModuleVer, 6) == 0)
{
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", "/mnt/sd/", ptr->d_name);
}
//sprintf((char*)updateFname, "%s%s", strg_path, ptr->d_name);
closedir(dirp); 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; return TRUE;
} }
} }
@ -78,11 +111,13 @@ static BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
} }
} }
} }
closedir(dirp);
printf("no update file\n"); closedir(dirp);
//free(strg_path);
printf("[%s:%d]no update file\n", __FUNCTION__, __LINE__);
return FALSE; return FALSE;
} }
static unsigned char gBattery = 0; static unsigned char gBattery = 0;
#define UPGRADABLE 0 #define UPGRADABLE 0
#define NOT_UPGRADABLE -1 #define NOT_UPGRADABLE -1
@ -99,7 +134,7 @@ static int is_camera_fw_upgrade(void)
//if (gBattery < 40 || hFile == NULL) //if (gBattery < 40 || hFile == NULL)
if (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; return NOT_UPGRADABLE;
} }
else else

View File

@ -1462,7 +1462,7 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
} }
closedir(dirp); closedir(dirp);
free(strg_path); free(strg_path);
printf("no update file\n"); printf("[%s:%d]==no update file\n", __FUNCTION__, __LINE__);
return FALSE; return FALSE;
} }
/************************************************* /*************************************************