1.Fix CAM_INFO.TXT file no ModuleVER bug and write failed bug.

2.Improve at command error handle way.
This commit is contained in:
xiaojiazhu 2023-08-17 19:30:04 +08:00
parent fe94eb8ad1
commit fcf604c606
5 changed files with 28 additions and 26 deletions

@ -1 +1 @@
Subproject commit 6cda096a723e0e0c52bc302ddd1a60f47a07c40f Subproject commit 4fab386ee16f4716fba25bb439f17cd360a7135d

View File

@ -59,7 +59,7 @@ int sf_check_eth0(void);
int sf_check_usb0(void); int sf_check_usb0(void);
void serach_gps_onkey_start(void); void serach_gps_onkey_start(void);
void open_gps(const SINT32 utc); SINT32 open_gps(const SINT32 utc);
int get_gps_location(void); int get_gps_location(void);
void keep_get_gps_location(const SF_GPS_PARAM param); void keep_get_gps_location(const SF_GPS_PARAM param);
void keep_seraching_gps_location(const int timeout_ms); void keep_seraching_gps_location(const int timeout_ms);

View File

@ -2216,7 +2216,7 @@ SINT32 eg91_register_net_manual(SF_FN_PARAM_S *pfnParam)
Return: 0 SUCCESS, 1 error Return: 0 SUCCESS, 1 error
Others: N/A Others: N/A
*************************************************/ *************************************************/
void sf_quectel_module_subver_change(char *pTemp) void sf_quectel_module_subver_change(char *pTemp, const char *keyword)
{ {
//EUROPE: EG91EXGAR08A07M1G_20.002.20.002 //EUROPE: EG91EXGAR08A07M1G_20.002.20.002
//AMERICA: EG91NAXDGAR07A01M1G_20.005.20.005 //AMERICA: EG91NAXDGAR07A01M1G_20.005.20.005
@ -2228,13 +2228,7 @@ void sf_quectel_module_subver_change(char *pTemp)
UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
pT1 = strstr((const char *)pTemp, "FAR"); pT1 = strstr((const char *)pTemp, keyword);
if(pT1 == NULL)
{
pT1 = strstr((const char *)pTemp, "GAR");
}
pT2 = strstr((const char *)pTemp, "BETA"); pT2 = strstr((const char *)pTemp, "BETA");
pT3 = strstr((const char *)pTemp, "_"); pT3 = strstr((const char *)pTemp, "_");
@ -2488,19 +2482,23 @@ SINT32 sf_module_complete_init(void)
if(strstr((const char *)gsmPara, "OK")) if(strstr((const char *)gsmPara, "OK"))
{ {
pTemp = strstr((const char *)gsmPara, EG91);
if(pTemp != NULL)
{
sf_quectel_module_subver_change(pTemp);
SLOGI(puiPara->ModuleSubver);
}
if(SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){ if(SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
pTemp = strstr((const char *)gsmPara, GPRS_MODULE_TYPE_EG915Q);
if(pTemp != NULL)
{
sf_quectel_module_subver_change(pTemp, "LGR");
SLOGI(puiPara->ModuleSubver);
}
eNetRegLocation = QUECTEL_NETREG_QSIMDET; eNetRegLocation = QUECTEL_NETREG_QSIMDET;
strcpy((char *)gsmPara, "AT+QSIMDET=0,1\r"); strcpy((char *)gsmPara, "AT+QSIMDET=0,1\r");
} }
else{ else{
pTemp = strstr((const char *)gsmPara, GPRS_MODULE_TYPE_EG91);
if(pTemp != NULL)
{
sf_quectel_module_subver_change(pTemp, "GAR");
SLOGI(puiPara->ModuleSubver);
}
eNetRegLocation = QUECTEL_NETREG_QSIMSTAT; eNetRegLocation = QUECTEL_NETREG_QSIMSTAT;
strcpy((char *)gsmPara, "AT+QSIMSTAT?\r"); strcpy((char *)gsmPara, "AT+QSIMSTAT?\r");
} }

View File

@ -1301,7 +1301,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) {
sf_4G_usb_net_apn_cfg(pfnParam); sf_4G_usb_net_apn_cfg(pfnParam);
sf_USB_net_init(); sf_USB_net_init();
if ((SF_ON == pCustomerParam->GpsSwitch)) { if ((SF_ON == pCustomerParam->GpsSwitch)) {
open_gps(s32ret); s32ret = open_gps(s32ret);
serach_gps_onkey_start(); serach_gps_onkey_start();
} }
@ -1438,7 +1438,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) {
s32ret = sf_get_ntp(s32ret, &current_time); s32ret = sf_get_ntp(s32ret, &current_time);
} }
if ((SF_ON == pCustomerParam->GpsSwitch)) { if ((SF_ON == pCustomerParam->GpsSwitch)) {
open_gps(s32ret); s32ret = open_gps(s32ret);
} }
if (1 == pCustomerParam->NeedTimeSyncStartUp) { if (1 == pCustomerParam->NeedTimeSyncStartUp) {
printf("[%s:%d]8 between A and B,no reg net again,no reset time sync.\n", printf("[%s:%d]8 between A and B,no reg net again,no reset time sync.\n",
@ -1484,7 +1484,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) {
s32ret = sf_get_ntp(s32ret, &current_time); s32ret = sf_get_ntp(s32ret, &current_time);
} }
if ((SF_ON == pCustomerParam->GpsSwitch)) { if ((SF_ON == pCustomerParam->GpsSwitch)) {
open_gps(s32ret); s32ret = open_gps(s32ret);
} }
if (0 != sf_get_cq_signal()) { if (0 != sf_get_cq_signal()) {
@ -1761,7 +1761,7 @@ int sf_check_usb0(void)
return 0; return 0;
} }
void open_gps(const SINT32 utc) SINT32 open_gps(const SINT32 utc)
{ {
UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get(); UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get();
SINT32 s32ret = 0; SINT32 s32ret = 0;
@ -1773,7 +1773,11 @@ void open_gps(const SINT32 utc)
current_time.Year, current_time.Mon, current_time.Day, current_time.Year, current_time.Mon, current_time.Day,
current_time.Hour, current_time.Min, current_time.Sec); current_time.Hour, current_time.Min, current_time.Sec);
gps_map_update(pCustomerParam->Sim4gApn, pCustomerParam->Sim4gUsr, pCustomerParam->Sim4gPwd, ntp_time); gps_map_update(pCustomerParam->Sim4gApn, pCustomerParam->Sim4gUsr, pCustomerParam->Sim4gPwd, ntp_time);
gps_open(ntp_time); if (AT_MANAGER_SUCCEED == gps_open(ntp_time))
{
return SF_SUCCESS;
}
return SF_FAILURE;
} }
#define GPS_GET_SUCCEED 0 #define GPS_GET_SUCCEED 0
#define GPS_GET_FAILED -1 #define GPS_GET_FAILED -1
@ -1842,7 +1846,6 @@ static void *serach_gps_onkey_thread(void *param)
SF_GPS_PARAM gps_param; SF_GPS_PARAM gps_param;
gps_param.timeout_ms = SERACH_GPS_TIMEOUT_MS; gps_param.timeout_ms = SERACH_GPS_TIMEOUT_MS;
gps_param.period_ms = SERACH_PERIOD_MS; gps_param.period_ms = SERACH_PERIOD_MS;
// open_gps();
keep_get_gps_location(gps_param); keep_get_gps_location(gps_param);
return NULL; return NULL;
} }

View File

@ -2301,7 +2301,7 @@ void sf_save_camera_info(void)
if(access((char*)SF_CAMERA_INFO_FILENAME, F_OK) == 0) if(access((char*)SF_CAMERA_INFO_FILENAME, F_OK) == 0)
{ {
system("rm -rf /mnt/sd/CAM_INFO.TXT"); system("rm -rf /mnt/sd/CAM_INFO.TXT");
sync(); system("sync");
//FileSys_DeleteFile(); //FileSys_DeleteFile();
} }
fd = open(SF_CAMERA_INFO_FILENAME, O_WRONLY | O_CREAT); fd = open(SF_CAMERA_INFO_FILENAME, O_WRONLY | O_CREAT);
@ -2310,6 +2310,7 @@ void sf_save_camera_info(void)
lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_END);
write(fd, temp, strlen(temp)); write(fd, temp, strlen(temp));
close(fd); close(fd);
system("sync");
} }
free(temp); free(temp);