From f477da93e2bd370ee4e60e2a5a70e87aa7a79920 Mon Sep 17 00:00:00 2001 From: alisa Date: Wed, 6 Sep 2023 15:11:00 +0800 Subject: [PATCH] =?UTF-8?q?[lpa]1.=E6=B7=BB=E5=8A=A0eg91NAXD=E7=9A=84USBne?= =?UTF-8?q?t=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sf_app/code/source/app/sf_service.c | 103 ++++++++++++------ 1 file changed, 72 insertions(+), 31 deletions(-) diff --git a/code/application/source/sf_app/code/source/app/sf_service.c b/code/application/source/sf_app/code/source/app/sf_service.c index e29c8845a..6cc016453 100755 --- a/code/application/source/sf_app/code/source/app/sf_service.c +++ b/code/application/source/sf_app/code/source/app/sf_service.c @@ -169,6 +169,41 @@ static SINT16 app_Qlog_procress(void) { return s32ret; } #endif + +void sf_usb_net_init() +{ + static U16 flag = 0; + SF_CHAR cmdStr[128] ={0}; + int ret = 0; + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); + + if(flag == 0) + { + flag = 1; + + //sprintf(cmdStr, "insmod /appfs/bin/GobiNet.ko"); + //ret = system(cmdStr); + //sleep(3); + + if(strstr(puiPara->Sim4gApn, V_MODULE_APN)) + { + sprintf(cmdStr, "/usr/bin/quectel-CM-EG91 -n %d&", V_PDP_INDEX); + } + else if(strstr(puiPara->Sim4gApn, A_MODULE_APN)) + { + sprintf(cmdStr, "/usr/bin/quectel-CM-EG91 -n %d&", A_PDP_INDEX); + } + else + { + sprintf(cmdStr, "/usr/bin/quectel-CM-EG91 -n %d&", E_PDP_INDEX); + } + ret = system(cmdStr); + sleep(3); + } + + return; +} + SINT32 sf_USB_net_init(void) { //SF_CHAR cmdStr[128] = {0}; @@ -181,43 +216,49 @@ SINT32 sf_USB_net_init(void) if (flag == 0) { flag = 1; - if(AT_MANAGER_SUCCEED != at_usbnet_init()) + if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0) { - MLOGE("usb net err %d\n", AT_MANAGER_SUCCEED); - } - else - { - for (i = 0; i < 20; i++) + if(AT_MANAGER_SUCCEED != at_usbnet_init()) { - if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0) + MLOGE("usb net err %d\n", AT_MANAGER_SUCCEED); + } + } + else + { + sf_usb_net_init(); + } + + + for (i = 0; i < 20; i++) + { + if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0) + { + ret = sf_check_usb0(); + + if(ret != SUCCESS) + { + ret = sf_check_eth0(); + } + } + else + { + + ret = sf_check_eth0(); + if(ret != SUCCESS) { ret = sf_check_usb0(); - - if(ret != SUCCESS) - { - ret = sf_check_eth0(); - } - } - else - { - - ret = sf_check_eth0(); - if(ret != SUCCESS) - { - ret = sf_check_usb0(); - } - } - if (SUCCESS == ret) - { - ret = SF_SUCCESS; - MLOGI("usb net ip up\r\n"); - break; - } - else - { - sleep(1); } } + if (SUCCESS == ret) + { + ret = SF_SUCCESS; + MLOGI("usb net ip up\r\n"); + break; + } + else + { + sleep(1); + } } return ret;