1.修复A启动设置apn开启gps问题;2.优化usb net获取ip检查

This commit is contained in:
payton 2024-02-18 17:07:57 +08:00
parent 68d3f3577e
commit 6d87687d36
2 changed files with 33 additions and 4 deletions

View File

@ -24,7 +24,7 @@ case "$1" in
renew|bound)
echo "2 Setting IP address $ip on $interface"
ifconfig $interface $ip $NETMASK $BROADCAST
echo $ip > /tmp/ip
if [ -n "$router" ] ; then
echo "Deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do

View File

@ -285,7 +285,7 @@ SINT32 sf_USB_net_init(void)
{
//SF_CHAR cmdStr[128] = {0};
//char cmdtmp[20] = {0};
UINT8 i = 0;
int i = 0;
int ret = SF_SUCCESS;
static U16 flag = 0;
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
@ -311,8 +311,20 @@ SINT32 sf_USB_net_init(void)
}
for (i = 0; i < 100; i++)
for (i = 0; i < 5000; i++)
{
if(access("/tmp/ip", F_OK) == 0)
{
//remove("/tmp/ip");
ret = SF_SUCCESS;
MLOGI("usb net ip up\r\n");
break;
}
else
{
sf_sleep_ms(50);
}
#if 0
if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0)
{
ret = sf_check_usb0();
@ -341,6 +353,7 @@ SINT32 sf_USB_net_init(void)
{
sf_sleep_ms(100);
}
#endif
}
//sf_net_dns_ck();
return ret;
@ -1957,7 +1970,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST);
// sf_4G_usb_net_apn_cfg(pfnParam);
// set_at_parament();
set_at_parament();
// sf_USB_net_init();
s32ret = sf_get_utc();
@ -2285,6 +2298,14 @@ int sf_check_eth0(void)
// Check if ip_address_end is NULL before dereferencing
if (ip_address_end != NULL) {
*ip_address_end = '\0';
if(strstr(ip_address_start, "192.168.0.3"))
{
//192.168.0.3
MLOGI("IP address eth0: %s\n", ip_address_start);
pclose(fp);
free(output);
return 1;
}
MLOGI("IP address of network card eth0: %s\n", ip_address_start);
} else {
MLOGE("Error extracting IP address\n");
@ -2351,6 +2372,14 @@ int sf_check_usb0(void)
// Check if ip_address_end is NULL before dereferencing
if (ip_address_end != NULL) {
*ip_address_end = '\0';
if(strstr(ip_address_start, "192.168.0.3"))
{
//192.168.0.3
MLOGI("IP address eth0: %s\n", ip_address_start);
pclose(fp);
free(output);
return 1;
}
MLOGI("IP address of network card usb0: %s\n", ip_address_start);
} else {
MLOGE("Error extracting IP address\n");