因为需要适配4G模块,这里总结下整个调试过程;
2. linux部分linux 部分主要是硬件识别,当拿到模块后,插入板子上,打印如下:
[ 185.120132] usb 3-1: new high-speed USB device number 2 using xhci-hcd [ 185.141610] usb 3-1: New USB device found, idVendor=12d1, idProduct=15c1 [ 185.149447] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 185.157830] usb 3-1: Product: HUAWEI Mobile V7R11 [ 185.164667] usb 3-1: Manufacturer: Huawei Technologies Co., Ltd. [ 185.171450] usb 3-1: SerialNumber: 0123456789ABCDEF [ 185.251621] cdc_ether 3-1:2.0 usb0: register cdc_ether at usb-xhci-hcd.0.auto-1, CDC Ethernet Device, 02:1e:10:1f:00:00 [ 185.271723] option 3-1:2.2: GSM modem (1-port) converter detected [ 185.286827] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0 [ 185.295963] option 3-1:2.3: GSM modem (1-port) converter detected [ 185.304478] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1 [ 185.313672] option 3-1:2.4: GSM modem (1-port) converter detected [ 185.320886] CPU1: Booted secondary processor [ 185.320886] CPU1: update cpu_power 1024 [ 185.332151] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2 [ 185.341133] option 3-1:2.5: GSM modem (1-port) converter detected [ 185.350048] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB3 [ 185.358760] option 3-1:2.6: GSM modem (1-port) converter detected [ 185.367116] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB4从打印可以看出如下信息: (1)USB串口驱动正常工作,设备加载正常。 (2)CDC ECM驱动正常工作。 (3)一共生成了5个虚拟的串口。
3. android部分 3.1 RIL库的移植在init.rc中添加服务如下:service ril-daemon /system/bin/rild -l libhuawei-ril.so
其中rild源码在/hardware/ril/rild/目录下, 然后将libhuawei-ril.so放到system/lib/目录中,在device/softwinner/common/目录下,新建文件夹LTE/,在该目录中添加文件firmware-LTE.mk, 然后将libhuawei-ril.so文件放入该目录,在firmware-LTE.mk中添加内容如下:
修改device/softwinner/petrel-p1,添加内容如下:
3.2 修改使用的USB或者PCM端口的权限device/softwinner/petrel-p1目录中,添加如下内容:
3.3 手动测试模组拨号过程(1)这时候可以借用SDK中PPP源码(对应目录为external/ppp)编译出来的pppoe可执行程序。 首先将部分linux-ppp-script中的相关文件拷贝到SDK中的对应目录,如下:
(2)同时,需要修改huawei-ppp-on脚本,内容如下:
#!/bin/sh # # Script to initiate a ppp connection. This is the first part of the # pair of scripts. This is not a secure pair of scripts as the codes # are visible with the ps command. However, it is simple. # Modify: fangxiaozhi <huananhu@huawei.com> programName=${0##*/} # These are the parameters. Change as needed. #DEVICE=/dev/usb/tts/0 #DEVICE=/dev/ttyACM0 #The modem file name of the data card DEVICE=/dev/ttyUSB0 #The modem file name of the data card TELEPHONE=*99# # The telephone number for the connection, by default, it will be *99# ACCOUNT=”” # The account name for logon, by default, it will be null PASSWORD=”” # The password for this account, by default, it will be null AUTH=”” # Authentic protocol,byi default, it will be null APN=1234 STR_USER=”user \”card\”” STR_PASSWD=”password \”card\”” show_usage(){ echo “usage:” echo ” $programName [–usr=username] [–pwd=password] [–pn=phonenumber][–apn=apn][–auth=authentic protocol]” echo ” [–local_ip=local_ip] [–remote_ip=remote_ip] [–usepeernds=usepeernds]” echo “username: The account name get from your ISP, by default, it will be null” echo “password: The password for your account, by default, it will be null” echo “phonenumber: The phone number for dialing up, by default, it will be *99#” echo “apn: access point name” echo “auth: chap/pap. for example: –auth=chap” exit 0 } PID=`ps -ef | grep -v grep | grep “huawei-dial” | grep “pppd” | busybox awk { print $2; exit }` if test $PID; then echo “PPP link is active” exit 1 fi if [ $# -eq 1 -a “$1” = “–help” ] then show_usage fi for i in “$@” do case $i in –device=*) echo “–device*=$i” DEVICE=${i#–device=} ;; –usr=*) echo “–usr*=$i” ACCOUNT=${i#–usr=} ;; –pwd=*) echo “–pwd*=$i” PASSWORD=${i#–pwd=} ;; –pn=*) echo “–pn*$i” TELEPHONE=${i#–pn=} ;; –apn=*) echo “–apn*=$i” APN=${i#–apn=} ;; –auth=*) echo “–auth*=$i” AUTH=${i#–auth=} if [ “$AUTH” = “chap” ]; then AUTH=-pap fi if [ “$AUTH” = “pap” ]; then AUTH=-chap fi ;; –local_ip=*) echo “–local_ip*=$i” PAR_LOCAL=${i#–local_ip=} ;; –remote_ip=*) echo “–remote_ip*=$i” PAR_REMOTE=${i#–remote_ip=} ;; –usepeernds=*) echo “–usepeernds*=$i” PAR_USEERDNS=${i#–usepeernds=} ;; *) echo “*=$i” esac done if [ “$PAR_LOCAL” = “” ]; then LOCAL_IP=0.0.0.0 else LOCAL_IP=$PAR_LOCAL fi if [ “$PAR_REMOTE” = “” ]; then REMOTE_IP=0.0.0.0 else REMOTE_IP=$PAR_REMOTE fi if [ ! “$PAR_USEERDNS” = “” ]; then USEPEERDNS= for NAMESERVER in `echo $PAR_USEERDNS | awk -F: {for (i=1;i<=NF;i++) print $i}` do echo “nameserver $NAMESERVER” >> /etc/ppp/resolv.conf done else USEPEERDNS=usepeerdns fi NETMASK=255.255.255.0 # The proper netmask if needed # # Export them so that they will be available at ppp-on-dialer time. export TELEPHONE APN ACCOUNT PASSWORD # # This is the location of the script which dials the phone and logs # in. Please use the absolute file name as the $PATH variable is not # used on the connect option. (To do so on a root account would be # a security hole so dont ask.) # # Initiate the connection # # I put most of the common options on this command. Please, dont # forget the lock option or some programs such as mgetty will not # work. The asyncmap and escape will permit the PPP link to work with # a telnet or rlogin connection. You are welcome to make any changes # as desired. Dont use the defaultroute option if you currently # have a default route to an ethernet gateway. # if [ ! -d “/data/ppp” ] then mkdir /data/ppp fi if [ -f “/data/ppp/options” ] then echo “” > /data/ppp/options fi if [ -f “/data/ppp/pap-secrets” ] then chmod 700 /data/ppp/pap-secrets fi if [ -f “/data/ppp/chap-secrets” ] then chmod 700 /data/ppp/chap-secrets fi if [ ! “$ACCOUNT” = “” ] then echo “$ACCOUNT * $PASSWORD *” > /data/ppp/pap-secrets echo “$ACCOUNT * $PASSWORD *” > /data/ppp/chap-secrets STR_USER=”user \”$ACCOUNT\”” STR_PASSWD=”password \”$PASSWORD\”” else echo “* * * *” > /data/ppp/pap-secrets echo “* * * *” > /data/ppp/chap-secrets fi chmod 400 /data/ppp/pap-secrets chmod 400 /data/ppp/chap-secrets if [ “$TELEPHONE” = “*99#” ]; then echo ” ABORT \”NO CARRIER\” ABORT \”NO DIALTONE\” ABORT \”ERROR\” ABORT \”NO ANSWER\” ABORT \”BUSY\” ABORT \”Username/Password Incorrect\” \”\” AT \”OK-+++\c-OK\” ATH0 OK AT+CGDCONT=1,\”IP\”,\”$APN\” OK ATDT$TELEPHONE CONNECT \”\” ” > /data/ppp/huawei-chat fi if [ “$TELEPHONE” = “#777” ]; then echo -e “at^pppcfg=\”$ACCOUNT\”,\”$PASSWORD\”\r\n” > $DEVICE echo ” ABORT \”NO CARRIER\” ABORT \”NO DIALTONE\” ABORT \”ERROR\” ABORT \”NO ANSWER\” ABORT \”BUSY\” TIMEOUT 120 ABORT \”Username/Password Incorrect\” \”\” AT OK ATDT#777 CONNECT \”\” ” > /data/ppp/huawei-chat fi if [ ! -d “/data/ppp/peers” ] then mkdir /data/ppp/peers fi echo “$DEVICE 115200 crtscts modem debug nodetach usepeerdns noipdefault defaultroute $LOCAL_IP:$REMOTE_IP $STR_USER $STR_PASSWD noauth $AUTH -mschap -mschap-v2 ipcp-accept-local ipcp-accept-remote connect /system/bin/chat -s -v -f /data/ppp/huawei-chat ” > /data/ppp/peers/huawei-dial #/bin/cp ./ip-up /etc/ppp/ip-up #/bin/cp ./ip-down /etc/ppp/ip-down exec /system/bin/pppoe call huawei-dial& exit 0(3)需要修改external/pppd/pathname.h文件
#define _PATH_PEERFILES _ROOT_PATH “/etc/ppp/peers/” 改成 #define _PATH_PEERFILES _ROOT_PATH “/data/ppp/peers/”免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:全志平台华为4G模块调试记录1 https://www.yhzz.com.cn/a/17219.html