1.根据模块版本选择使用对应的方式

This commit is contained in:
payton 2023-07-21 16:49:00 +08:00
parent e5a5805740
commit d65a930ad1
6 changed files with 114 additions and 119 deletions

View File

@ -110,9 +110,9 @@ typedef enum USBNET_APN_INIT_E
typedef enum set_usbnet
{
SET_USBNET_START = (unsigned char)0x01,
SET_USBNET_ECM_TYPE,
SET_USBNET_DIAL,
SET_USBNET_END
SET_USBNET_ECM_TYPE,
SET_USBNET_DIAL,
SET_USBNET_END
} SET_USBNET;
typedef enum SF_QUECTEL_NETREG
@ -133,7 +133,6 @@ typedef enum SF_QUECTEL_NETREG
QUECTEL_NETREG_ATI,
QUECTEL_NETREG_QFLST,
QUECTEL_NETREG_QGMR,
QUECTEL_NETREG_QSIMDET,
QUECTEL_NETREG_QFOPEN,
QUECTEL_NETREG_QNVFR,
QUECTEL_NETREG_CPIN,

View File

@ -34,7 +34,6 @@ extern "C" {
#define GPRS_MODULE_TYPE_EG91 "EG91"
#define GPRS_MODULE_TYPE_EG95 "EG95"
#define GPRS_MODULE_TYPE_EG915Q "EG915Q"
#define GPRS_MODULE_TYPE_EG91_V "EG91VX"
#define GPRS_MODULE_TYPE_EG95_V "EG95VX"

View File

@ -2484,14 +2484,15 @@ SINT32 sf_module_complete_init(void)
sf_quectel_module_subver_change(pTemp);
SLOGI(puiPara->ModuleSubver);
}
#ifdef NETWORK_MODULE_EG915Q
eNetRegLocation = QUECTEL_NETREG_QSIMDET;
strcpy((char *)gsmPara, "AT+QSIMDET=0,1\r");
#endif
#ifdef NETWORK_MODULE_EG91
eNetRegLocation = QUECTEL_NETREG_QSIMSTAT;
strcpy((char *)gsmPara, "AT+QSIMSTAT?\r");
#endif
if(SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
eNetRegLocation = QUECTEL_NETREG_QSIMDET;
strcpy((char *)gsmPara, "AT+QSIMDET=0,1\r");
}
else{
eNetRegLocation = QUECTEL_NETREG_QSIMSTAT;
strcpy((char *)gsmPara, "AT+QSIMSTAT?\r");
}
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
@ -2510,15 +2511,6 @@ SINT32 sf_module_complete_init(void)
}
break;
case QUECTEL_NETREG_QSIMDET:
if(strstr((const char *)gsmPara, "OK"))
{
eNetRegLocation = QUECTEL_NETREG_QSIMSTAT;
strcpy((char *)gsmPara, "AT+QSIMSTAT?\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case QUECTEL_NETREG_QSIMDET:
if(strstr((const char *)gsmPara, "OK"))
{
@ -2746,52 +2738,58 @@ SINT32 sf_module_complete_init(void)
break;
case QUECTEL_NETREG_QLWCFG_URC:
#ifdef NETWORK_MODULE_EG915Q
// ignore
#endif
#ifdef NETWORK_MODULE_EG91
if(strstr((const char *)gsmPara, "OK"))
#endif
{
if(SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
eNetRegLocation = QUECTEL_NETREG_QLWCFG_STARTUP;
strcpy((char *)gsmPara, "AT+QLWCFG=\"urc\",0\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else{
if(strstr((const char *)gsmPara, "OK"))
{
eNetRegLocation = QUECTEL_NETREG_QLWCFG_STARTUP;
strcpy((char *)gsmPara, "AT+QLWCFG=\"urc\",0\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
}
break;
case QUECTEL_NETREG_QLWCFG_STARTUP:
#ifdef NETWORK_MODULE_EG915Q
// ignore
#endif
#ifdef NETWORK_MODULE_EG91
if(strstr((const char *)gsmPara, "OK"))
#endif
{
if(SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
eNetRegLocation = QUECTEL_NETREG_CPIN;
strcpy((char *)gsmPara, "AT+QLWCFG=\"auto_reg\",0\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else{
if(strstr((const char *)gsmPara, "OK"))
{
eNetRegLocation = QUECTEL_NETREG_CPIN;
strcpy((char *)gsmPara, "AT+QLWCFG=\"auto_reg\",0\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
}
break;*/
case QUECTEL_NETREG_CPIN:
#ifdef NETWORK_MODULE_EG915Q
// ignore
#endif
#ifdef NETWORK_MODULE_EG91
if(strstr((const char *)gsmPara, "OK"))
#endif
{
if(SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
eNetRegLocation = QUECTEL_NETREG_READY;
strcpy((char *)gsmPara, "AT+CPIN?\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else{
if(strstr((const char *)gsmPara, "OK"))
{
eNetRegLocation = QUECTEL_NETREG_READY;
strcpy((char *)gsmPara, "AT+CPIN?\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
}
break;
case QUECTEL_NETREG_READY:
@ -3860,13 +3858,13 @@ SINT32 sf_auto_net_reg(void)
else
{
eNetRegLocation = QUECTEL_NETREG_QLWCFG_URC;
if(strstr(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q)){
if(strstr(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q)){
strcpy((char *)gsmPara, "AT+QLWCFG=\"auto_reg\",0\r");
}
else{
strcpy((char *)gsmPara, "AT+QLWCFG=\"startup\",0\r");
}
}
}
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
@ -4322,9 +4320,9 @@ SINT32 eg915q_set_usbnet(SF_FN_PARAM_S *pfnParam)
SINT32 ret1 = SF_SUCCESS;
SF_CHAR ttyData[SF_TTYUSB_RECV_MAX] = { 0 };
UINT8 sts = 1;
USBNET_APN_INIT_e enMmcLocation;
SET_USBNET enMmcLocation;
enMmcLocation = SET_USBNET_START;
UIMenuStoreInfo *pStaticParam = sf_app_ui_para_get();
//UIMenuStoreInfo *pStaticParam = sf_app_ui_para_get();
sprintf(ttyData, "AT\r");

View File

@ -178,7 +178,6 @@ SINT32 sf_check_max_num(void)
*************************************************/
SINT32 sf_ftp_config(UINT8 ssl, UINT8 GprsMode, UINT8 timeout)
{
#ifdef NETWORK_MODULE_EG915Q
UIMenuStoreInfo *pPara = sf_app_ui_para_get();
FtpSslFlag ssl_flag = FTP_SSL_FLAG_END;
const unsigned char *ftpIP;
@ -222,8 +221,8 @@ SINT32 sf_ftp_config(UINT8 ssl, UINT8 GprsMode, UINT8 timeout)
// printf("ftp_manager_init password = %s\n", config.password);
ftp_manager_init(config);
return SF_SUCCESS;
#endif
#if 0
SINT32 ret = SF_SUCCESS;
FTP_SIM_E eFtpLocation = FTP_SIM_CGDCONT;
SINT32 ttyRet = 0;
@ -544,6 +543,7 @@ SINT32 sf_ftp_config(UINT8 ssl, UINT8 GprsMode, UINT8 timeout)
FtpOpenOk = ret;
return ret;
#endif
}
/*************************************************
@ -556,11 +556,11 @@ SINT32 sf_ftp_config(UINT8 ssl, UINT8 GprsMode, UINT8 timeout)
*************************************************/
SINT32 sf_ftp_send(UINT8 *ftpFileName, UINT8 *filePath, UINT8 timeout)
{
#ifdef NETWORK_MODULE_EG915Q
// printf(" ftp_upload_file ftpFileName = %s filePath = %s\n", ftpFileName, filePath);
return ftp_upload_file((const char *)ftpFileName, (const char *)filePath, timeout);
#endif
#if 0
SINT32 ret = SF_SUCCESS;
FTP_SIM_E eFtpLocation = FTP_SIM_CFTPSCFG;
SINT32 ttyRet = 0;
@ -679,6 +679,7 @@ SINT32 sf_ftp_send(UINT8 *ftpFileName, UINT8 *filePath, UINT8 timeout)
SF_FTP_SEND_END:
printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret);
return ret;
#endif
}
/*************************************************
@ -691,9 +692,8 @@ SINT32 sf_ftp_send(UINT8 *ftpFileName, UINT8 *filePath, UINT8 timeout)
*************************************************/
SINT32 sf_ftp_stop(UINT8 ssl, UINT8 GprsMode)
{
#ifdef NETWORK_MODULE_EG915Q
return SF_SUCCESS;
#endif
#if 0
SINT32 ret = SF_SUCCESS;
FTP_SIM_E eFtpLocation = FTP_SIM_CFTPSLOGOUT;
SINT32 ttyRet = 0;
@ -853,6 +853,7 @@ SINT32 sf_ftp_stop(UINT8 ssl, UINT8 GprsMode)
SF_FTP_STOP_END:
printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret);
return ret;
#endif
}
SINT32 sf_pic_send_ftp(void)
@ -908,9 +909,9 @@ SINT32 sf_pic_send_ftp(void)
}else{
sprintf((char *)ftpFileName[piccount], "%s%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName);
}
#ifdef NETWORK_MODULE_EG915Q
sprintf((char *)filePath[piccount], "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath);
#endif
#ifdef NETWORK_MODULE_EG91
sprintf((char *)filePath[piccount], "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName);
#endif
@ -927,9 +928,9 @@ SINT32 sf_pic_send_ftp(void)
}else{
sprintf((char *)ftpFileName[piccount], "%s%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName);
}
#ifdef NETWORK_MODULE_EG915Q
sprintf((char *)filePath[piccount], "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath);
#endif
#ifdef NETWORK_MODULE_EG91
sprintf((char *)filePath[piccount], "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName);
#endif
@ -943,9 +944,9 @@ SINT32 sf_pic_send_ftp(void)
}else{
sprintf((char *)ftpFileName[piccount], "%s%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName);
}
#ifdef NETWORK_MODULE_EG915Q
sprintf((char *)filePath[piccount], "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath);
#endif
#ifdef NETWORK_MODULE_EG91
sprintf((char *)filePath[piccount], "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName);
#endif
@ -959,9 +960,9 @@ SINT32 sf_pic_send_ftp(void)
}else{
sprintf((char *)ftpFileName[piccount], "%s%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName);
}
#ifdef NETWORK_MODULE_EG915Q
sprintf((char *)filePath[piccount], "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath);
#endif
#ifdef NETWORK_MODULE_EG91
sprintf((char *)filePath[piccount], "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName);
#endif
@ -975,9 +976,9 @@ SINT32 sf_pic_send_ftp(void)
}else{
sprintf((char *)ftpFileName[piccount], "%s%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName);
}
#ifdef NETWORK_MODULE_EG915Q
sprintf((char *)filePath[piccount], "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath);
#endif
#ifdef NETWORK_MODULE_EG91
sprintf((char *)filePath[piccount], "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName);
#endif

View File

@ -146,58 +146,43 @@ static SINT16 app_Qlog_procress(void) {
}
#endif
SINT32 sf_USB_net_init(void) {
static UINT8 flag = 0;
SF_CHAR cmdStr[128] = {0};
int ret = SF_FAILURE;
// SF_PDT_PARAM_STATISTICS_S *sfPara = sf_statistics_param_get();
if (flag == 0) {
flag = 1;
/*if(strstr(sfPara->ApnGPRS, V_MODULE_APN))
{
sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", V_PDP_INDEX);
}
else if(strstr(sfPara->ApnGPRS, A_MODULE_APN))
{
sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", A_PDP_INDEX);
}
else*/
SF_CHAR cmdStr[128] = {0};
char cmdtmp[20] = {0};
//{ sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", E_PDP_INDEX); }
}
sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&",A_PDP_INDEX);
for (UINT8 i = 0; i < 40; i++) {
#ifdef NETWORK_MODULE_EG915Q
if (access("/dev/ttyUSB3", F_OK) == SF_SUCCESS) {
#endif
#ifdef NETWORK_MODULE_EG91
if (access("/dev/qcqmi0", F_OK) == SF_SUCCESS) {
#endif
ret = SF_SUCCESS;
printf("usb net ko exist!\r\n");
break;
} else {
usleep(100 * 1000);
}
}
#ifdef NETWORK_MODULE_EG915Q
// TODO: quectel-CM should be improved by original.
system("ifconfig usb0 up");
system("udhcpc -n -t 5 -i usb0");
#endif
int ret = SF_FAILURE;
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
if (ret == SF_SUCCESS) {
system(cmdStr);
if (sf_poweron_type_get() == SF_MCU_STARTUP_RING) {
sleep(2);
} else {
sleep(5);
if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
sprintf(cmdStr, "/usr/bin/quectel-CM-EG915Q -n %d&",A_PDP_INDEX);
sprintf(cmdtmp, "/dev/ttyUSB3");
}else {
sprintf(cmdStr, "/usr/bin/quectel-CM-EG91 -n %d&",A_PDP_INDEX);
sprintf(cmdtmp, "/dev/qcqmi0");
}
for (UINT8 i = 0; i < 40; i++) {
if (access(cmdtmp, F_OK) == SF_SUCCESS) {
ret = SF_SUCCESS;
printf("usb net ko exist!\r\n");
break;
} else {
usleep(100 * 1000);
}
}
if (ret == SF_SUCCESS) {
system(cmdStr);
if (sf_poweron_type_get() == SF_MCU_STARTUP_RING) {
sleep(2);
} else {
sleep(5);
}
return ret;
}
printf("usb net ko no exist!\r\n");
return ret;
}
printf("usb net ko no exist!\r\n");
return ret;
}
}
SINT32 app_gps_map_update(SF_FN_PARAM_S *pfnParam) {
SINT16 ret = SF_SUCCESS;

View File

@ -41,6 +41,7 @@
#include "IOCfg.h"
#include <dirent.h>
#include "sf_file.h"
#include "sf_hal_ttyusb.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
@ -1139,15 +1140,23 @@ void sf_cmd_4g_usb_boot(void)
UINT32 sf_4g_update(UINT8 *upFname)
{
SF_CHAR cmdStr[128] = {0};
char cmdtmp[20] = {0};
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
int ret = SF_FAILURE;
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
sprintf(cmdStr, "/usr/bin/DownloadCLI -p /dev/ttyACM0 -c %s/cfg_ec618_usb.ini -B \"BL AP CP\" -r", upFname);
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
sprintf(cmdStr, "/usr/bin/DownloadCLI-EG915Q -p /dev/ttyACM0 -c %s/cfg_ec618_usb.ini -B \"BL AP CP\" -r", upFname);
sprintf(cmdtmp, "/dev/ttyACM0");
}else {
sprintf(cmdStr, "/customer/QFirehose -f %s",upFname);
sprintf(cmdtmp, "/dev/ttyUSB0");
}
printf("[%s:%d] cmd:%s\n", __FUNCTION__, __LINE__,cmdStr);
for (UINT8 i = 0; i < 40; i++) {
if (access("/dev/ttyACM0", F_OK) == SF_SUCCESS) {
if (access(cmdtmp, F_OK) == SF_SUCCESS) {
ret = SF_SUCCESS;
printf("[%s:%d] ttyACM0 exist!\r\n", __FUNCTION__, __LINE__);
printf("[%s:%d] %s exist!\r\n", __FUNCTION__, __LINE__,cmdtmp);
break;
}
else {
@ -1174,6 +1183,7 @@ void* sf_sys_do_4g_upgrade(void *arg)
{
//int s32Ret = 0;
UINT8 updateFileName[60] = {0};
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
SLOGW("Begin to do 4G Upgrade!\n");
if(sf_is_enough_power_to_update() == FALSE)
@ -1184,7 +1194,10 @@ void* sf_sys_do_4g_upgrade(void *arg)
if(sf_is_4g_module_usb_update_file_exist(updateFileName))
{
sf_cmd_4g_usb_boot();
if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){
sf_cmd_4g_usb_boot();
}
sf_mcu_reg_set(SF_MCU_SOFT_UPDATE, 1);
sf_set_module_update(1);
//sf_set_send_statu(TRUE);