全志平台华为4G模块调试记录2

1. 前言

上篇主要是描述的需要修改的地方; 这里主要描述网络配置和调试方法

2. 修改ip-up脚本 #!/system/bin/sh PPPD_PID_FILE=/data/system/${PHYINTERFACE}_pppd.pid case $1 in ppp[1-9]) /android/bin/iptables –flush; /android/bin/iptables –table nat –flush; /android/bin/iptables –delete-chain; /android/bin/iptables –table nat –append POSTROUTING –out-interface ppp0 -j MASQUERADE; /android/bin/iptables –append FORWARD –in-interface $1 -j ACCEPT; echo 0 > /proc/sys/net/ipv4/ip_forward; echo 1 > /proc/sys/net/ipv4/ip_forward; ;; ppp0) /system/bin/setprop “net.interfaces.defaultroute” “gprs”; ;; esac #just for debug ……………shuge@allwinnertech.com #/system/bin/log -t aw-pppoe “0: $0” #/system/bin/log -t aw-pppoe “1: $1” #/system/bin/log -t aw-pppoe “2: $2” #/system/bin/log -t aw-pppoe “3: $3” #/system/bin/log -t aw-pppoe “4: $4” #/system/bin/log -t aw-pppoe “5: $5” #/system/bin/log -t aw-pppoe “6: $6” # #/system/bin/log -t aw-pppoe “LINKNAME: $LINKNAME” #/system/bin/log -t aw-pppoe “IFNAME: $IFNAME” #/system/bin/log -t aw-pppoe “DEVICE: $DEVICE” #/system/bin/log -t aw-pppoe “PPPLOGNAME: $PPPLOGNAME” #/system/bin/log -t aw-pppoe “PPPD_PID: $PPPD_PID” #/system/bin/log -t aw-pppoe “PEERNAME: $PEERNAME” #/system/bin/log -t aw-pppoe “SPEED: $SPEED” #/system/bin/log -t aw-pppoe “USEPEERDNS: $USEPEERDNS” #/system/bin/log -t aw-pppoe “LINKINTERFACE: $LINKINTERFACE” # Use interface name if linkname is not available NAME=”$PHYINTERFACE-“$1″” /system/bin/setprop “net.$NAME.dns1” “$DNS1” /system/bin/setprop “net.$NAME.dns2” “$DNS2” /system/bin/setprop “net.$NAME.local-ip” “$IPLOCAL” /system/bin/setprop “net.$NAME.remote-ip” “$IPREMOTE” /system/bin/setprop “net.${PHYINTERFACE}-pppoe.phyif” “$1” /system/bin/setprop “net.${PHYINTERFACE}-pppoe.status” “started”
<
3. 运行huawei-ppp-on脚本

sh ./huawei-ppp-on –user=card –pwd=card –pn=*99# –auth=chap –apn=1234 正常情况下打印为:

er=card –pwd=card –pn=*99# –auth=chap –apn=1234 < *=–user=card –pwd*=–pwd=card –pn*–pn=*99# –auth*=–auth=chap –apn*=–apn=1234 root@petrel-p1:/system/etc/ppp # abort on (NO CARRIER) abort on (NO DIALTONE) abort on (ERROR) abort on (NO ANSWER) abort on (BUSY) abort on (Username/Password Incorrect) send (AT^M) expect (OK) AT^M^M OK — got it send (ATH0^M) expect (OK) ^M ATH0^M^M OK — got it send (AT+CGDCONT=1,”IP”,”1234″^M) expect (OK) ^M AT+CGDCONT=1,”IP”,”1234″ OK — got it send (ATDT*99#^M) expect (CONNECT) ATDT*99#^M^M CONNECT — got it send
<
4. 查看虚拟网卡

执行命令busybox ifconfig,可以看到生成了ppp0网口,如下:

但是此时是无法连接互联网的,因为没有配置dns

5. 查看dns

首先看下通过pppoe报文交互获得dns是什么,利用命令获取如下:getprop | grep dns

[net.-ppp0.dns1]: [211.136.20.203] [net.-ppp0.dns2]: [211.136.17.107] 6. 配置dsn root@petrel-p1:/system/etc/ppp # setprop net.dns1 211.136.20.203 root@petrel-p1:/system/etc/ppp # setprop net.dns2 211.136.17.107 root@petrel-p1:/system/etc/ppp # ndc resolver setifdns ppp0 “” 211.136.20.203 200 0 Resolver command succeeded root@petrel-p1:/system/etc/ppp # ndc resolver setdefaultif ppp0 7. ping百度

ping www.baidu.com

PING www.a.shifen.com (183.232.231.173) 56(84) bytes of data. 64 bytes from 183.232.231.173: icmp_seq=1 ttl=55 time=49.2 ms 64 bytes from 183.232.231.173: icmp_seq=2 ttl=55 time=31.4 ms 64 bytes from 183.232.231.173: icmp_seq=3 ttl=55 time=30.6 ms 64 bytes from 183.232.231.173: icmp_seq=4 ttl=55 time=29.7 ms 64 bytes from 183.232.231.173: icmp_seq=5 ttl=55 time=25.6 ms 64 bytes from 183.232.231.173: icmp_seq=6 ttl=55 time=32.8 ms 64 bytes from 183.232.231.173: icmp_seq=7 ttl=55 time=32.6 ms 64 bytes from 183.232.231.173: icmp_seq=8 ttl=55 time=28.5 ms 64 bytes from 183.232.231.173: icmp_seq=9 ttl=55 time=27.5 ms 64 bytes from 183.232.231.173: icmp_seq=10 ttl=55 time=33.8 ms 64 bytes from 183.232.231.173: icmp_seq=11 ttl=55 time=32.2 ms 64 bytes from 183.232.231.173: icmp_seq=12 ttl=55 time=31.3 ms 64 bytes from 183.232.231.173: icmp_seq=13 ttl=55 time=27.2 ms 64 bytes from 183.232.231.173: icmp_seq=14 ttl=55 time=33.6 ms 64 bytes from 183.232.231.173: icmp_seq=15 ttl=55 time=29.4 ms 64 bytes from 183.232.231.173: icmp_seq=16 ttl=55 time=31.2 ms 64 bytes from 183.232.231.173: icmp_seq=17 ttl=55 time=28.7 ms 64 bytes from 183.232.231.173: icmp_seq=18 ttl=55 time=33.5 ms 64 bytes from 183.232.231.173: icmp_seq=19 ttl=55 time=32.4 ms 64 bytes from 183.232.231.173: icmp_seq=20 ttl=55 time=30.1 ms 64 bytes from 183.232.231.173: icmp_seq=21 ttl=55 time=26.7 ms 64 bytes from 183.232.231.173: icmp_seq=22 ttl=55 time=33.5 ms 64 bytes from 183.232.231.173: icmp_seq=23 ttl=55 time=33.5 ms 64 bytes from 183.232.231.173: icmp_seq=24 ttl=55 time=28.5 ms 64 bytes from 183.232.231.173: icmp_seq=25 ttl=55 time=30.8 ms 64 bytes from 183.232.231.173: icmp_seq=26 ttl=55 time=33.6 ms 64 bytes from 183.232.231.173: icmp_seq=27 ttl=55 time=31.8 ms 64 bytes from 183.232.231.173: icmp_seq=28 ttl=55 time=29.5 ms 64 bytes from 183.232.231.173: icmp_seq=29 ttl=55 time=33.6 ms
<

表明手动测试,可以连接网络了。

8. 通过init.rc进行拨号

device/softwinner/petrel-p1/init.rc中可以修改如下

串口中输入setprop persist.has_LTE 1,即可进行拨号。

免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:全志平台华为4G模块调试记录2 https://www.yhzz.com.cn/a/17217.html

上一篇 2023-05-19 21:04:22
下一篇 2023-05-19 21:42:31

相关推荐

联系云恒

在线留言: 我要留言
客服热线:400-600-0310
工作时间:周一至周六,08:30-17:30,节假日休息。