1.cardv解析升級標識

This commit is contained in:
payton 2023-08-17 15:12:05 +08:00
parent 931c1d8f9a
commit d5cd453d04

View File

@ -318,7 +318,59 @@ void System_WaitForPowerOffStart(void)
FLGPTN uiFlag; FLGPTN uiFlag;
vos_flag_wait(&uiFlag, FLG_ID_MAIN, FLG_MAIN_OFF, TWF_ORW); vos_flag_wait(&uiFlag, FLG_ID_MAIN, FLG_MAIN_OFF, TWF_ORW);
} }
#if HUNTING_CAMERA_MCU == ENABLE
UINT8 sf_cardv_check_power_on_mode(void)
{
FILE *fp = NULL;
UINT32 u32ize = 0;
char *pStrSrc = NULL;
char *pStrOtsOk = "Mode=";
char *pStrUpFw = "UpFw=";
char *temp = NULL;
UINT8 startup = 0;
UINT8 UpFw = 0;
system("cat /proc/cmdline > /tmp/Mode.txt");
fp = fopen("/tmp/Mode.txt","r");
if(fp == NULL){
return FALSE;
}
fseek(fp, 0, SEEK_END);
u32ize = ftell(fp); // take file size
fseek(fp, 0, SEEK_SET); // move to position zero
pStrSrc = (char *)malloc(u32ize*sizeof(char));
if (pStrSrc) {
fread(pStrSrc, 1, u32ize, fp);
temp = strstr(pStrSrc, pStrOtsOk);
if ( temp != NULL) {
temp += strlen("Mode=");
sscanf(temp, "%hhd", &startup);
sf_set_power_on_mode(startup);
//printf("%s: PowerOnModeStr=%d\r\n", __func__,startup);
//printf("%s: temp=%s\r\n", __func__,temp);
}
temp = strstr(pStrSrc, pStrUpFw);
if ( temp != NULL) {
temp += strlen("UpFw=");
sscanf(temp, "%hhd", &UpFw);
//printf("%s: UpFw=%d\r\n", __func__,UpFw);
sf_set_fw_update(UpFw);
}
printf("%s: PowerOnModeStr=%d UpFw=%d\r\n", __func__,startup,UpFw);
free(pStrSrc);
}
fclose(fp);
fp = NULL;
pStrSrc = NULL;
u32ize = 0;
return startup;
}
#endif
int NvtMain(void) int NvtMain(void)
{ {
@ -355,6 +407,7 @@ int NvtMain(void)
nvt_hdal_init(); nvt_hdal_init();
nvt_user_init(); nvt_user_init();
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
sf_cardv_check_power_on_mode();
BOOL inUsb = GxUSB_GetIsUSBPlug(); BOOL inUsb = GxUSB_GetIsUSBPlug();
if(TRUE == inUsb)//(!sf_gpio_get_status(GPIO_INT_USBPLUGIN)) if(TRUE == inUsb)//(!sf_gpio_get_status(GPIO_INT_USBPLUGIN))
{ {
@ -381,9 +434,9 @@ int NvtMain(void)
SF_MESSAGE_BUF_S stMessageBuf = {0}; SF_MESSAGE_BUF_S stMessageBuf = {0};
if(!sf_gpio_get_status(GPIO_KEY_TEST)){ /*if(!sf_gpio_get_status(GPIO_KEY_TEST)){
sf_set_fw_update(1);//update sf_set_fw_update(1);//update
} }*/
if(TRUE != inUsb) if(TRUE != inUsb)
{ {
stMessageBuf.arg1 = SF_MCU_CMD_POWERON; stMessageBuf.arg1 = SF_MCU_CMD_POWERON;